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

Using a macro to make TokenMod conditionally apply status markers to tokens

I need to know how to (properly) write something like this: IF bar1_current = 0 THEN !token-mod --ids @{selected|token_id} --set statusmarkers|Dead I want tokenmod to apply a token marker when the bar values equals zero (or less) I imagine that this won't be too difficult, I just don't know the proper syntax... Please put me out of my misery! TIA
1601933263
The Aaron
Roll20 Production Team
API Scripter
hmm.  There isn't a direct way to do that from a macro.  There are probably some scripts that would let you code something like that, but I can't recall any off the top of my head.  That makes me think I should add something that can evaluate simple equations to selectively perform operations, something like --set-if or similar. You might be able to do this with PowerCards. There are certainly other scripts that can put a dead marker on things for you automatically.
1601936134

Edited 1601936466
Oosh
Sheet Author
API Scripter
I don't have API to try this, but does math work in this argument? Would something like this work, or can you not do inline rolls here? --set statusmarkers|?Dead:[[abs(ceil(@{selected|hp}/1000)-1)]] Basically a conditional returning 0 for hp from 1-1000, and 1 for hp 0.
1601937273
The Aaron
Roll20 Production Team
API Scripter
That would work, except a setting of 0 still results in showing the Dead marker (and since Dead can't display numbers, the number part gets ignored anyway).
I'll give it a try, thank you both. I need an idiots guide! Last time I did programming I was at school and it was Pascal! That was much less complicated than this and I sucked at that too! :)
So, I may not have undestood this at all, but would this version apply the statusmarker Ammo when bar1_current is equal to or less than 0? !token-mod --set statusmarkers|?Ammo:[abs(ceil(@{selected|bar1_current}/1000)-1)]] (doesn't work so far) I am trying to use this for a Macro, the first line of which is: !token-mod --set bar1_current|-1 (this part works) So when you trigger it as a token action it counts down an "ammo" increment, set as bar1. What I want it to do is apply an out of ammo token marker. I initially wrote "Dead" becuase when you say you are counting ammo, people on Fans of Roll20 on facebook people immediately 1) Assume you are playing 5e and 2) Suggest you use the Ammo API.