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

can we do IF statements?

i'm wanting to some how set up a macro called "consentration check" where it will automatically roll 1d20 + con (or 2d20k1 + con if warcaster) then see if it is above 10, then IF it is below 10 run a macro to remove the consentration status marker... i know it seems weird and i may not have described it properly but i hope someone understands and can answer
1599022062
GiGs
Pro
Sheet Author
API Scripter
This would have to be a custom API script. Normal macros cant do if statements, nor can they change anything about a character sheet or token. I believe there are a couple of status marker scripts already floating around - maybe one of them can handle this.
i use tokenmod, but wouldn't know the coding for that API and i wouldn't even know the first steps to making an API myself.
1599023453
GiGs
Pro
Sheet Author
API Scripter
If token mod sets the status marker with a o (to remove) and 1 (to set), you can add something like this to the token_mod command: [[{1d20+@{selected|con}}>10]] This will give a 1 on success, and 0 on fail, so can be used to set or remove the marker.
1599029337

Edited 1599029362
Oosh
Sheet Author
API Scripter
If this is 5e, the math you want for your macro is: [[ {?{Advantage?|Normal,1d20|Advantage,2d20k1|Disadvantage,2d20kl1}+@{selected|constitution_save_bonus}}>[[{floor(?{How much damage did you take, if over 21?|0}/2),10}k1]] ]] To include DC over 10 depending on damage, and Advantage. Leaving the damage at the default of 0 will result in a DC10 (as will entering any damage amount less than 22).
1599057332
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This is a very simple script that may help. It does one thing. It looks for a change on bar 1 of the selected token. If that change is a reduction, and the token has the indicated concentration marker, then it posts a message that a concentration check is required. It also gives a chat button for the check. That version also includes a button to toggle the concentration token marker, but for the button to function, requires token-mod to be installed as well. It does not inform you that a given token is concentrating, set the concentration marker to begin with or monitor spells cast and automatically apply concentration. It is a very short and simple script.