RPTools.net

Discussion and Support

Skip to content

It is currently Tue Feb 20, 2018 4:59 am 






Reply to topic  [ 2 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Cave Troll
 
Joined: Sat Jan 03, 2015 11:05 am
Posts: 37
 Post subject: Alter LibProperties
PostPosted: Mon Feb 01, 2016 2:57 pm 
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...


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Sat Jan 03, 2015 11:05 am
Posts: 37
 Post subject: Re: Alter LibProperties
PostPosted: Mon Feb 01, 2016 3:58 pm 
nvm!! i figured it all by myself lol

Code:
[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


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 2 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman