In my campaign, I have a token-property named "listOfObjects", which is supposed to contain one or more json-objects.
Example of the value of listOfObjects:
id=Dark Knight; x=1;y=2
The idea is to have a token's name and x/y-positions of that token.
My macro (for one single json object):
Code: Select all
[h: string = getProperty("ListOfObjects", "tokenWithListOfObjects" ) ]
[h: myJson = json.fromStrProp(string)]
[r:json.get(myJson, "id")]<br>
[r:json.get(myJson, "x")]<br>
[r:json.get(myJson, "y")]<br>
Dark Knight
1
2
That's fine: I can read the token's name and his x- and y-positions.
My Problem
Now I want to expand this to have more than one json-object in my listOfObjects.
But I do not get the syntax right. I tried several variations with brackets [ ], {}, with and without quotation marks, with id:Dark Knight and id=Dark Knight, with "," instead of ";" asf. Nothing worked so far - and the wiki has confused me more on this subject than it helped.
So, how does a list of json objects of the type [id=<String/Tokenname>, x=<number>, y=<number>] look like? Is it possible to read a list of json objects from a token-property-string?
My goal is to work on this list with a foreach-loop and send every token on this list to the given x- and y-position.
Greetings, Mastyrial