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] How to quickly set token default using scripts/macros

August 03 (5 years ago)

So usually when I'm running mobs I use a script that number them, however, I have to have %%NUMBERED%% in the token name, then set player permissions to see the token name and click a couple of other buttons. 

Then I have to open the character sheet page to set it as the default token again, I'm wanting to find a quick way to just click a button to set a token I've selected as the default token used for the sheet, rather then click edit, remove, and confirm every time. 

Any ideas?

August 03 (5 years ago)

Edited August 03 (5 years ago)

I have a macro that does something along these lines, using the token-mod api:

!token-mod --set bar3_link| bar2_link| bar1_link| showname|yes bar3|@{selected|bar3} bar2_value|@{selected|ac} bar1_value|@{selected|speed} name|"@{selected|character_name} %%NUMBERED%%" token_name|"@{selected|character_name} %%NUMBERED%%" bar1_max| bar2_max| light_losangle#360 --on light_hassight --set defaulttoken


First it unsets the barlinks (to account for monster duplicates and their hp's not affecting eachother). I set bar3 as HP, 2 as AC and 1 as speed. It shows the name (only for GM) and adds the character name followed by %%NUMBERED%%. Adds LOS and Sight and then sets it as the default token.
Note that I'm using bar3|@{selected|bar3} because I'm using the shaped5e which auto adds the rolled HP to the chosen bar. You can change that to @{selected|hp}|@{selected|hp} (since all dragged tokens have their HP maxed on mobs).

August 03 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

To answer the second paragraph question, this will set the selected token as the default for the associated character:

!token-mod --set defaulttoken

The API does not yet have access to a few token settings like bar placement though, so if that's an issue, manual is still the only way to go. :(

August 03 (5 years ago)

I just created a Suggestion post for the Bar Position and Bar Styles to be accessible by the API: https://app.roll20.net/forum/post/9033645/update-api-to-allow-script-setting-of-bar-position-and-bar-styles/?pageforid=9033645#post-9033645.  If you agree, please go and vote it up!

August 03 (5 years ago)

Thank you to the 3 of you that responded, is going to save a lot of time setting stuff up!