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

How do I make a countdown macro that counts down a number when I click the macro.

August 08 (4 years ago)

So I have a player who is making a magical item and we want to keep track of the days it takes to complete the project. right now I have made another character sheet named "Magical item" and have made an attack called "magical item" and turned on ammo tracking. I set the resource used as "casts left" (cuz he's casting a spell into the item everyday), and then set the character sheet as a NPC so I can whisper the roll to myself when I click the attack macro I dragged and dropped from the character sheet, and then I relay the number to my character via a personal whisper. my question is: is there a countdown macro that I can get that makes a counter that ticks down when I click the macro that whispers the remaining number to both me and my player? 

August 08 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

You could set this up with either the ChatSetAttr script or the Ammo script.

They can easily be programmed to drop a value by one each time, and you can include normal whisper commands in the macro.

One complication: macros get the value of a stat at the time the macro was called, so you would need to do something like

!script call to reduce the attribute by 1
/w GM [[@{attribute}-1]]
/w player [[@{attribute}-1]]

You need to grab the attribute, and reduce by 1 when reporting it, because when the macro is triggered, the attribute hasn't yet been reduced by 1.


I recommend having two macros: one to reduce the attribute and report the result (as above), and one to just display the current values - because you'll sometimes want to check its value without actually reducing it.