Hello There!
I Have Been Working For 10 Days In A Raw To Take An Old Java Script Game To The New World Of Block Chain. I Have Learned HTML, CSS, Swift, And C Programming Languages So Editing And Developing With JavaScript Is Very Nice, Specially When Its Combined With Such A Grate Platformā¦
I Have Successfully Applied A LOT Of Moralis In My Project But Now I am Facing An Issue.
I Would Like To Add The Items That The Player Owns To Moralis Serverā¦ I Am Successfuly Added Data Like Money Count, Level, Current Map, Current Power And More To The Moralis Server
But The Items Giving Me An Error.
Succesfully Added Item Name, And Propperties Of Item When Its Being Picked Up, But The Only Thing Missing Is An Object That Seem To Be A Problematic Object When It Comes To syncing With Moralis Server.
That Is The Function:
async function checkCloudBackExist ()
{
//check if existing player
let user = Moralis.User.current();
let query = new Moralis.Query('PlayerBpMRL');
query.equalTo("player", user.get("ethAddress"));
const results = await query.find();
//if 0 results lenght for logged in user, means its their first time Picking Up An Item .
if (results.length == 0) {
//create tables for the first time.
console.log(" create tables for the first time.")
const PlayerBpMRL = Moralis.Object.extend("PlayerBpMRL");
const playerBpMRL = new PlayerBpMRL();
playerBpMRL.set("player",user.get("ethAddress"));
//Whatitem.name = NameString
playerBpMRL.set("EquipName" ,Whatitem.name);
//The Problematic Object Line Is This: playerBpMRL.set("EquipIMGsrc" ,Whatitem.img);
//Whatitem.des = Array With Properties
playerBpMRL.set("EquipDES" ,Whatitem.des);
//Whatitem.properties = Another Array With Properties
playerBpMRL.set("EquipProperties" ,Whatitem.properties);
await playerBpMRL.save();
}
Every Thing Works Great Except This Line: playerBpMRL.set(āEquipIMGsrcā ,Whatitem.img);
When Its Not Noted Line It Returns An Error:!
Screenshot 2021-12-10 145817|690x408
As You Can See, When I Console.log(Whatitem.img)
It Shows That Whatitem.img Contains:
But Not As A String Because String Shows As White Text, And Also I Tried Using It As A String But Thats Not What The Code Needs To Work With.
When I Try To Console.log(typeof Whatitem.img) It Print Objectā¦
But Also When i Console.log(typeof Whatitem.properties) I Get Object But Still Whatitem.properties does updating perfectly to Moralis Servers, While .img Gives an Error And Undifined.
As I Said I Am Pretty New To JS And Tottaly New With Moralis So I Would Like To Get An Idea Of What Am I Doing Wrong Or How I Can Fix That Issue.
I Made Such A Great Progress And A Lot Of People I Know Would Like To Start Play The Game I Am Developing Here.