Greetings All,
It's been a while since I have played around with my Hero framework and now I am trying to fulfill a request that I received many moons ago.
The basic project is to create a list of tokens, get the Initiative value of each token and then create a list of the tokens in order of Initiative value. I will then use the list of tokens to create a GM stat sheet.
I realize that the Initiative functions essentially do this, but the person requesting this doesn't use the built-in Initiative functions.
Right now, I have GM stat sheet that works in every way except for the initiative order.
I think that, instead of using String Property lists, a JSON array could accomplish this easier. The question I have is how to use JSON to pull a token property using the FOREACH command. JSON has always been a mystery to me and, not to gripe, the Wiki entries do me little good.
Any help would be greatly appreciated. It is one of those things that I know can happen, I just haven't figured out how yet.
-James
Using JSON to get token properties
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Using JSON to get token properties
something like this:
ofcourse this assumes the property 'initiative' on the tokens, if you use something else, use that.
Code: Select all
[initJson = "[]"]
[tokens = getTokenNames()]
[foreach(tok, tokens), CODE:{
[init = getProperty("initiative", tok)]
[jInit = json.set("{}", "character", tok, "initiative", init)]
[initJson = json.append(initJson, jInit)]
}]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Using JSON to get token properties
Thank you.
I presume that I will be able to do a json.sort to get the initiative in order from that list?
I presume that I will be able to do a json.sort to get the initiative in order from that list?
Re: Using JSON to get token properties
Yes, but You do need the fix lib if your using b90
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Using JSON to get token properties
I am not. I didn't even know there was a b90. I did not see anything new in the list of downloads.
Re: Using JSON to get token properties
Its linked in my Sig
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Using JSON to get token properties
Oh cool. You said something about a fix lib? I took your advice from that thread and took the b91 beta. Is that included in the version I downloaded?wolph42 wrote:Its linked in my Sig
EDIT: Ignore that last question. It was answered by opening the archive and reading the readme. Thanks.