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

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

Hi all, first time poster. I'm trying to set up a macro to have all tokens on the current page with the same name ("Troll") regenerate 10 hp, up to hp_max. I tried the following macro, but it adds 10 to one token's hp and copies that value to all the other tokens named "Troll". What I want is to have 10 added to each individual troll's hp. !token-mod {{ --ids @{Troll|character_id} --set bar3_value|[[{@{selected|bar3|max},[[@{selected|bar3}+10]]}kl1]] --current-page }} Is there a way to do this with Token Mod?  I'm using the D&D 5E 2014 by Roll20 character sheet, if that matters, and bar3 as hp. Thanks!
1732836498
Andrew R.
Pro
Sheet Author
You’ll want to use the MetaScriptToolbox to get TokenMod to act on all the Troll tokens individually. 
Thanks for the suggestion, Andrew R. I actually found a simpler method: !token-mod --set bar3_value|+10! This adds 10 to all selected tokens properly, and the ! at the end constrains the result between 0 and hp_max.
1732918907
The Aaron
Roll20 Production Team
API Scripter
You should be able to apply that to your original command and get a command that heals all trolls on the page. !token-mod {{ --ids @{Troll|character_id} --set bar3_value|+10! --current-page }} You could combine this with OnMyTurn to have an "EndOfTurn" character with an ability that calls it whenever its turn comes up in the turn order.  If you do that, you should use: !token-mod {{ --ids @{Troll|character_id} --set bar3_value|+10! --active-pages }} --current-page will be the page of the player calling the command, but OnMyTurn is the API calling the command, so doesn't have a page, but --active-pages will be every page that has a player on it, which will generally be what you want.
Careful with OnMyTurn, because it will trigger at the start of every Troll’s turn, and the first time I used it, it applied the effect to every token of that character on every token’s turn, as opposed to just to that token on that token’s turn. ;-) 
Thanks for the help! The first script works perfectly, but I noticed that for the one using OnMyTurn only one troll on the page gets the additional hp. Any ideas? Thanks again!
1733081484

Edited 1733081713
Hello, For the first time, I'm having an issue with TokenMod. I have a small macro that's supposed to enable or disable the torches for my players' tokens, but at some point, it seems like everything crashes. The players end up with a black screen, even though vision is enabled and they are supposed to emit light. Here is my code : !token-mod {{ --on emits_bright_light emits_low_light --set bright_light_distance|6 low_light_distance|6 }} !token-mod {{ --off emits_bright_light emits_low_light --set bright_light_distance|0 low_light_distance|0 }} I’m playing with Jumpgate with the core D&D system (2014).