Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

[HELP]TokenMod

1583650344

Edited 1583650456
I am attempting to make a macro for players to quickly choose a character and have their token update to the chosen sheet with relevant info as this will happen multiple times per session. "callme" is setup to be the specific name that will be displayed on the token. The only issue I am running into is that "set name" isn't getting the info from the newest choice, but the previous choice. IE: The current character is Archer and I choose to switch to Brute. All the numbers and image get swapped correctly, but the name will be still be Archer. If I then choose Mage or Archer, the name will change to Brute. Is there something I am missing as I am still brand new to this? !token-mod {{ --set ?{Choose Character|BruteA,currentside#1 represents#@{BruteA|character_id} |ArcherA,currentside#2 represents#@{ArcherA|character_id} |MageA,currentside#3 represents#@{MageA|character_id} } set bar1_link#hp  set bar2_link#ac  set name|@{selected|callme} showname|yes }}
1583662244
GiGs
Pro
Sheet Author
API Scripter
You are likely running into an Order of Operations error. When you start a macro, roll20 extracts all the attribute references in the macro, and turns them into values, before doing any steps in the macro. So the instant you trigger that macro, it extracts the callme attribute from your currently selected character. Then the macro proceeds, and you change the represents, so that token now points at a new character. But that callme value has already been read, so it will refer to the old character. The way to solve this is to put the set name inside the query. Tokenmod lets you put multiple options together, as do queries, so something like !token-mod {{ --set  ?{Choose Character|BruteA,currentside#1 represents#@{BruteA|character_id} name|@{BruteA|callme} |ArcherA,currentside#2 represents#@{ArcherA|character_id} name|@{ArcherA|callme} |MageA,currentside#3 represents#@{MageA|character_id} name|@{MageA|callme} } bar1_link#hp  bar2_link#ac  --on showname }} I havent tested this, but something like this should work.
That worked! But only after I changed the "|" after name into a "#". I thought those were interchangeable in Tokenmod?
1583705849
GiGs
Pro
Sheet Author
API Scripter
They are interchangeable in TokenMod, but not in roll20 macros, generally. The reason TokenMod has the # character is to get around some restrictions in roll20 macros.