Alter LibProperties

If you have searched the other User Creations subforums and an answer to your question has not been found, please post here!

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
blakdeth19
Cave Troll
Posts: 30
Joined: Sat Jan 03, 2015 11:05 am

Alter LibProperties

Post by blakdeth19 »

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...

blakdeth19
Cave Troll
Posts: 30
Joined: Sat Jan 03, 2015 11:05 am

Re: Alter LibProperties

Post by blakdeth19 »

nvm!! i figured it all by myself lol

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))]
	}
]
this^ adds "Cost" to everything listed in "ArmorDetails" property for people who also are having trouble with this

Post Reply

Return to “Requests for HELLLLP!”