Hey guys! I have some cloud script i'm trying to do to increment a variable in an ItemInstance.CustomData. I"ve read a GREAT deal on this topic, how to access and write to CustomData - which as i understand it is a DICT - but doing the following (from the below code example) isnt working.
EXAMPLE: JSON PARSE CODE
CODE:
var MatchedItem; var MatchedPerkLevel; var dataPayload = {}; var keyString = "CurrentUpgradeLevel"; for (var i = 0; i < RetInv.Inventory.length; i++) //iterate returned inventory, find itemids matching { if(RetInv.Inventory[i].ItemId == PerkID) { //RetVal = Convert.ToInt32(RetInv[i].Inventory.ItemId); MatchedItem = RetInv.Inventory[i]; var ItemCustomData = MatchedItem.CustomData; var ItemCustomDataUnEncoded = JSON.parse(JSON.Stringify(ItemCustomData)); MatchedPerkLevel = Number(ItemCustomDataUnEncoded.CurrentUpgradeLevel); MatchedPerkLevel += 1; break; } } dataPayload[keyString] = MatchedPerkLevel; return {PerkLevel: MatchedPerkLevel};