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 with TokenMod and a macro to change size.

July 18 (2 years ago)

Edited July 18 (2 years ago)

I'm trying to get a macro going to change a token's size for one of my players now that the party is starting to use enlarging magic more often.

I wanted to do a set up like

?{What Size?|Medium,1|Large,2|Huge,3 }
!token-mod  {{
--set scale|?{What Size?}g
}}


Which works, but always puts the number used to change the token size into chat. I switched it to


!token-mod  {{
--set scale|?{What Size?|Medium,1|Large,2|Huge,3 }g
}}

Which just completely breaks. It doesn't do anything.


!token-mod  {{
--set scale|?{What Size?}g
}}

Then I also have this code, which works and doesn't put anything into the chat, but is a little sloppy on the user experience for me, asking them to put in 1, 2, or 3 instead of selecting an actual size.

I was hoping to get a way to do this macro without "spamming" the chat with random numbers. Also I think I may have missed it, but is there a way to make a macro that just always changes a single token's size, rather than the selected token? It is mainly one party member that is changing size.

July 18 (2 years ago)


Brandon S. said:

I'm trying to get a macro going to change a token's size for one of my players now that the party is starting to use enlarging magic more often.

I wanted to do a set up like

?{What Size?|Medium,1|Large,2|Huge,3 }
!token-mod  {{
--set scale|?{What Size?}g
}}

Which works, but always puts the number used to change the token size into chat. I switched it to

This is putting the number used to change the token into chat because your first line is just printing the output from the query. I think you intended to create a false API call with an exclamation point:
!?{What Size?|Medium,1|Large,2|Huge,3 }
!token-mod  {{
--set scale|?{What Size?}g
}}


!token-mod  {{
--set scale|?{What Size?|Medium,1|Large,2|Huge,3 }g
}}

Which just completely breaks. It doesn't do anything.

This is working for me. TokenMod strips out the extra space (between the '3' and 'g') if you select 'Huge', but I would still remove the space after the 3 as a best practice for other queries.


I was hoping to get a way to do this macro without "spamming" the chat with random numbers. Also I think I may have missed it, but is there a way to make a macro that just always changes a single token's size, rather than the selected token? It is mainly one party member that is changing size.

You'll want to get the token_id or character_id:

/w gm {{{ Token ID: @{selected|token_id}
Character ID: @{selected|character_id} }}}


If you use the Token ID, then it will only change that specific token, not any copies of the token. If you use the Character ID, then it'll change all tokens that are linked to that character sheet. Your code will then look like this (plug in the Token or Character ID that you get instead of ' -N_W-ssh6aNGztxWXN-7':

!?{What Size?|Medium,1|Large,2|Huge,3}
!token-mod --set scale|?{What Size?}g  --ignore-selected --ids -N_W-ssh6aNGztxWXN-7 

I didn't realize that space ruined everything. I thought I tried it with it removed and it didn't work so I put it back.

You have been amazingly helpful and so quick with the answers. Thank you so much.

July 19 (2 years ago)

Edited July 19 (2 years ago)
The Aaron
Roll20 Production Team
API Scripter

If you want to make it specific to a character and only affect the character's token on the current page, try this out:

!token-mod {{
  --set
    scale|?{What Size?|Medium,1|Large,2|Huge,3}g
  --ignore-selected
  --current-page
  --ids @{Some Character|character_id}
}}
You could also use --active-pages if your players are split and you might not be on their page when you run it.