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

Simple Counter Macro?

1620141302

Edited 1620141454
I already have my own way of keeping track of time so I was just wondering if there was macro or script to keep a memory in number and add +1 to the current number and then allow me to clear the current number? For further information I have a list of actions the players can do and each on takes 5 mins, 12 actions = 1 hour. So I would like the ability to track this number and clear it when it hits 12 (planning on a second one to track 24 hours if I feel like it) Basically a calculator that is tied to my game. Any advice?
1620141678
The Aaron
Roll20 Production Team
API Scripter
You can definitely do this with an API script.  You could do it with TokenMod and a token on the page that represents a Timer Character.
1620141847

Edited 1620144923
neat! I already have the TokenMod, just got to fiddle with it I guess? Got it to work when I am selecting the token, trying to get it to work without having to manually select the token with no luck atm since if I have to manually select the token its not much more effort to add +1 myself.
1620148015

Edited 1620148022
The Aaron
Roll20 Production Team
API Scripter
Something like: !token-mod {{ --set bar1_value|+1 --ids @{TimerCharacter|character_id} --current-page }}
For some reason I can never get  character_id's to work. That said  ChatSetAttr works incredibly well as well.
1620152056
The Aaron
Roll20 Production Team
API Scripter
You mean with TokenMod?  It's just a way of selecting tokens, so if there aren't any tokens that represent that character (or aren't any on the current page in this case) it won't do anything.
Even with the token I still get " No turn order item was found by the name character_id"
1620157138
The Aaron
Roll20 Production Team
API Scripter
What is the command you're running?
1620230607

Edited 1620230821
I have a sheet set up with custom attributes hours and minutes. I have a token on the field called Tracker linked to this sheet with 2 of the bars linked to these stats. when I run: !token-mod {{ --set bar1_value|+1 --ids @{Tracker|character_id} --current-page }} I get that error, if I select the token and run: ! token - mod - - set bar1_value | - 3 It works correctly. For now I'm using the ChatSetAttr API along with the command: !setattr --name Tracker --modb --Hours|1 --fb-header an hour passes --fb-from Time Keeper --fb-public  To set these stats.
1620231406
The Aaron
Roll20 Production Team
API Scripter
Ah.  Tracker is a special name.  Rename your character to something else.  You can use @{tracker|Bob the Slayer} to get the initiative value for the Bob the Slayer character out of the Turn Order.  So it's trying to find a character named "character_id" in the turn order and failing.
1620235574

Edited 1620237466
Andreas J.
Forum Champion
Sheet Author
Translator
WTF I've never notice this being a thing, even if it's mentioned in the documentation, twice: <a href="https://wiki.roll20.net/Macros#Rolling_For_Initiative" rel="nofollow">https://wiki.roll20.net/Macros#Rolling_For_Initiative</a> You can even reference these values the same way you would Attributes by using the syntax: @{tracker|Item Name}
1620244835

Edited 1620251765
Yell... damn lmao! Now I wonder if there is a way to have it ignore the selected token and only set the bar on the referenced token, since I'm also using the&nbsp;5E Resting in Style api it would be neat to be able to use the&nbsp;!long-rest script with it, problem is the long rest api needs a selected token and tokenmod will also increase the bar of the selected token as well as the time keeper. update: Found a way to do just that, it's a bit of&nbsp;speggetti code IMO but it works: !token-mod {{ &nbsp; --set &nbsp; &nbsp; bar1_value|+8 &nbsp; --ids &nbsp; &nbsp; @{Time Keeper|character_id} &nbsp; --current-page }} !long-rest !token-mod {{ --set bar1_value|-8 &nbsp; --ids &nbsp; &nbsp; @{selected|character_id} }} You would have to edit it to reflect which bar your using for HP but it works and it's generic enough that it should work with any game that's using your Tokenmod, 5E Resting in Style, and if your using&nbsp;ChatSetAttr you can set it to effect the Time Keeper sheet from chat using a macro as well. I use this to pass by hours/min/ w/e: !setattr --name Time Keeper --modb --Minutes|1 I'm pretty happy with this set up, it makes accurately tracking time in 5e pretty easy for those games where time actually matters. And with that said for people searching the forums in the future for a time tracker and DON'T want a token on the field to track time, use ChatSetAttr, you will be able to set custom attributes with it to keep track of time without a token as long as you make a character sheet for it.