can someone please tell em why this code here:
[h:targetName = listGet(tokenList,Target)]
[h: items= getProperty("items", targetname)]
[h: json.append(getProperty("Items"), items))]
does not append the list but replaces it?..
it takes items from one token, and is suppose to add them to your items
append??!?
Moderators: dorpond, trevor, Azhrei, Gamerdude
Re: append??!?
couple of mistakes there.
1. you don't assign the result of the append action to anything so it is lost. e.g.
what do you expect to be the result??
Next I'm guessing that you are addressing properties directly in the macro and using the same property name in the code for other values. Big screw up! E.g. lets say you have the property 'items' on a token with the value 10. Then you do:
well actually you do
so im guessing this is what you want:
or faster:
1. you don't assign the result of the append action to anything so it is lost. e.g.
Code: Select all
[h:items = 5]
[h:1 + items]
Next I'm guessing that you are addressing properties directly in the macro and using the same property name in the code for other values. Big screw up! E.g. lets say you have the property 'items' on a token with the value 10. Then you do:
Code: Select all
[items = 5]
[items = items + items]
Code: Select all
[items = 5]
[items + items]
Code: Select all
[h:targetName = listGet(tokenList,Target)]
[h:tmpItems = getProperty("items", targetname)]
[h:items = json.append(getProperty("Items"), tmpItems))]
Code: Select all
[h:targetName = listGet(tokenList,Target)]
[h:items = json.append(getProperty("Items"), getProperty("items", targetname)))]
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
-
- Cave Troll
- Posts: 30
- Joined: Sat Jan 03, 2015 11:05 am
Re: append??!?
thanks for the tips! i figured it out though, it was still using the data from the selected token
and not the impersonated token, so i used switch token to get impersonated
and to be safe i changed the names so there was no conflicting names
and not the impersonated token, so i used switch token to get impersonated
and to be safe i changed the names so there was no conflicting names