I'm trying to add a cost to each item listed in Plo's Inventory Manager
however i cant figure out how to do it. i can get it to work if i do 1 at a time,
rewriting the script constantly but i want to add it to everything at once.
[h: data= getLibProperty("ArmorDetails")]
[h: listdata= json.toList(data)]
[r: listdata]
This ^ gets each item in Armor listed
[h: data= json.get(getLibProperty("ArmorDetails"), "Padded Armor")]
[h: listdata= json.toList(data)]
[r: listdata]
And This ^ Lists the "properties" of that item in the Armor list.
I want to add 2 to this ^ list...
Alter LibProperties
Moderators: dorpond, trevor, Azhrei, Gamerdude
-
- Cave Troll
- Posts: 30
- Joined: Sat Jan 03, 2015 11:05 am
Re: Alter LibProperties
nvm!! i figured it all by myself lol
this^ adds "Cost" to everything listed in "ArmorDetails" property for people who also are having trouble with this
Code: Select all
[h:lp = getLibProperty("ArmorDetails")]
[h:lpList = json.toList(lp)]
[h, FOREACH(item, lpList, "<br>"), CODE:
{
[data = json.get(getLibProperty("ArmorDetails"), item)]
[listdata = json.set(data, "Cost", 0)]
[setLibProperty("ArmorDetails", json.set(getLibProperty("ArmorDetails"), item, listdata))]
}
]