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

How to Randomize TokenMod statsmarkers from API Button?

This works fine from within my API button... !token-mod --set statusmarkers|yellow;8 However, I'm trying to do this... !token-mod --set statusmarkers|yellow;[[1d4+4]] And nothing happens. Is this the correct syntax?
1631672677
Andrew R.
Pro
Sheet Author
I tested it as a macro in my Macro Mule character in my Vault game, and it works fine: !token-mod {{ --set statusmarkers|yellow;[[1d4+4]] }}
1631675860
The Aaron
Roll20 Production Team
API Scripter
You need to prevent the inline roll from happening before you push the button.  Generally, you do that by HTML escaping part of it: [Push Me](!token-mod --set statusmarkers|yellow; [ [1d4+4]]) When you have problems with Buttons, push up in the chat after trying it to see what it sent to the API.  Without the escape, this is what I was seeing: !token-mod --set statusmarkers|yellow; Rolling 1d4+4 = (1)+4'>5
Escaping the bracket worked. Thanks!
1631725833
The Aaron
Roll20 Production Team
API Scripter
no problem!