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 .
×
Create a free account

Help! Shape Changing Token using chatmenu and token mod (adding to existing macro)

So Im trying to Set up a chat menu to work with a shape changing character who is using two different character sheets for each shape i have a macro for most of this but i need to add the function to make it so when he changes which side his multisided token is on that the name plate changes along with it this is what i have already how can i go about doing this with out it getting more complicated  the macros in the chat menu  !token-mod {{ --set ?{Choose Form|Form1,currentside#1 name#Form1 |Form2,currentside#2 name#Form2}}} !token-mod --set represents|@{The GentleMan|character_id} !token-mod --set represents|@{Findulir Oredigger|character_id} and the chat menu  /w Moron &{template:default} {{name=Shapeshift}} {{Shift= [The-Gentleman](!
#The-Gentleman) [Findulir](!
##Findulir) [Shift](!
#Shift)}}
You can use a chat menu, but for this I would suggest using a regular query as an Ability on the character sheets set as a Token Action: ! ?{Choose Form|The Gentleman,represents#@{The GentleMan|character_id} name#"The Gentleman" currentside#1 bar1_link#hp bar2_link#ac bar3_link#passive_wisdom|Findulir, represents#@{Findulir Oredigger|character_id} name#"Findulir" currentside#2 bar1_link#hp bar2_link#ac bar3_link#passive_wisdom} !token-mod --set ?{Choose Form} It looks like there's a quirk where you also have to ensure that all of the token bars get relinked after the 'represents' is switched, so I've included that as well. Bar 1 for hp, Bar2 for ac, Bar3 for passive_wisdom - change those to whatever you're using in your game.
You Are a god send this is amazing thank you so much 
1738810221
timmaugh
Forum Champion
API Scripter
Another approach, using conditionals from the Metascript Toolbox: !token-mod {{   --set     {&if "?{Choose Form|The Gentleman|Findulir}" = "Findulir"}        represents#@{Findulir Oredigger|character_id}       name#"Findulir"       currentside#2     {&else}        represents#@{The GentleMan|character_id}       name#"The Gentleman"       currentside#1     {&end}     bar1_link#hp     bar2_link#ac     bar3_link#passive_wisdom }}
what do you mean conditionals i am unfamiliar with this term 
1738858795

Edited 1738858951
Daina said: what do you mean conditionals i am unfamiliar with this term  Roll20 and most scripts don't have a good "If -> then" logic built in.  Metascripts (specifically APILogic ) allow you to add If -> then logic into script commands. Normally, TokenMod commands are built to do something, or to ask you a question and make a change based on your answer.  But with the command that Timmaugh gave you, it adds the Metascript commands {&if} {&else} {&end}. If {&if} checks if your query answer is 'Findulir'. If yes, then it'll change the character to be Findulir. If not, then it'll change the character to 'The GentleMan'. The same Metascript construction could be use to eliminate the query altogether and just become a toggle: using Fetch  to check if the token is currently linked to 'Findulir' then it'll switch to 'The GentleMan' and vice-versa. (Aircoded and untested - I think this is the correct syntax) !token-mod {{   --set     {&if  @(token.represents) = "The GentleMan"}       represents#@{Findulir Oredigger|character_id}       name#"Findulir"       currentside#2     {&else}       represents#@{The GentleMan|character_id}       name#"The Gentleman"       currentside#1     {&end}     bar1_link#hp     bar2_link#ac     bar3_link#passive_wisdom }}
1738859038
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I believe timmaugh means it as a "conditional statement". If this, then that. If the option you choose is "Findulir" <--Conditional statement Then do the token one way Else Do it another
1738860802
timmaugh
Forum Champion
API Scripter
"Conditionals" in the sense of logical If/Then constructions. The Metascript Toolbox offers a set of scripts that work like "add on" tools for other scripts (or just for you to get information out of the game). This video explains more about how the metascripts work with normal scripts, if you have time to give it a watch. One of those included metascripts is called APILogic , and it gives you the ability for in-line If/Then/Else constructions using syntax tokens like: {& if ... } {& elseif ... } {& else} {& end} You can see those in use in the above command line. Another metascript in the Toolbox is Fetch , which lets you get information from the game. Now that I look again at what you're doing, I see a way to use Fetch to remove even the need for you to answer a query. In a situation like this, where there are only two options for the token/character, you can just create a toggle by testing the "represents" property of the token before you even begin. You can retrieve the "represents" property like this: @(selected.represents) (you can reference the token in a number of ways, but since your TokenMod command appears to implicitly assume the token is selected, that's what I went with) So, if you use that in the IF syntax, you can basically create a single command that will toggle/flip the token assignment every time: !token-mod {{   --set     {&if  @(selected.represents) =  @{The GentleMan|character_id} }        represents#@{Findulir Oredigger|character_id}       name#"Findulir"       currentside#2     {&else}        represents#@{The GentleMan|character_id}       name#"The Gentleman"       currentside#1     {&end}     bar1_link#hp     bar2_link#ac     bar3_link#passive_wisdom }} So, in the IF line, we basically test to see if the token is CURRENTLY set to represent The GentleMan. If so, we point it to Findulir. If it is NOT (that is, if it is set as representing Findulir) we point it to The GentleMan.
1738860873

Edited 1738861319
timmaugh
Forum Champion
API Scripter
Ninja'd by Jarren AND Keith! *shakes fist at life for interfering* =D
This Has been Very educational Thank you so much