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 .
×

[Script] Track Duration — Keep track of timed effects in the turn tracker and on individual tokens

1787855234

Edited 1787855409
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Track Duration — Keep track of timed effects in the turn tracker and on individual tokens Available in One-Click Install | [ Demo Video ] Track Duration is a Roll20 API script that automatically tracks round-based timed effects on tokens in the turn order — spells, conditions, abilities, anything with a duration measured in rounds. Attach an effect to a token with a color marker, a name, and a round count. The count appears directly in the token's name on the board, visible to everyone. As combat advances, it counts down on its own. When it hits zero, the effect is removed and a notice is whispered to the GM and the player. What it looks like When a character is under a timed effect, their token name reflects it directly on the board: As turns advance, the number ticks down. When it hits zero, the effect is removed and a whisper goes out to the GM and the player. Type !duration at any time to open the effects report card — a styled panel showing all active effects across all tracked tokens, with token images, round counts, and edit buttons. Adding an effect Make sure the character's token is at the top of the turn order, then click + Add Effect to Active Character at the bottom of the !duration card. You'll be prompted for: A color/shape marker (chosen from a dropdown) A duration in rounds (defaults to 10) A name for the effect (spaces allowed — Mage Armor, Concentration, Stunned, etc.) You can stack any number of effects on a single token. Editing on the fly Every effect line in the report card has an edit button. Click it and you get a prompt pre-filled with the current round count. Change the number, or enter 0 to remove the effect entirely. You can also change the marker and the description. Forward and backward Track Duration responds to Roll20's turn order buttons: Forward — when a token's turn ends and it cycles to the bottom, its durations tick down. Backward — when you rewind a turn and a token comes back to the top, its durations tick back up. Map changes Moving to a new map? Clearing the turn order triggers a restore panel sent to all players, listing every active effect with a Restore button. After setting up the new turn order, clicking Restore re-attaches that character's effects to their new token automatically. Installation Available via One-Click Install in the Roll20 API Library, or paste Duration.js manually into your campaign's API console. No configuration required. Commands Command What it does !duration Open the effects report card !duration --help Show the in-chat help card !duration --clear    Clear all effects and send the restore panel The --add and --edit commands are normally accessed through buttons in the card rather than typed by hand. If a player wants a standalone macro—for example, a character who casts Shadow Blade every combat—the command structure is: !duration --add <marker> <duration> <Effect Name> !duration --edit <marker> <duration> <Effect Name> Or hardcoded for a specific effect: !duration --add  10 Shadow Blade The token at the top of the turn order receives the effect, so the macro works correctly as long as it's used on that character's turn. Questions, bugs, or suggestions welcome below. This script was released earlier on my Patreon
I'll have to check this out. Currently, I use AddCustomTurn for this type of tracking, along with being able to add a Round counter, (or a down counter for a condition, or a static placement like a lair action on Initiative 20) with one-button. I use Tokenmod to place status markers on a token to indicate whether they are concentrating or under some condition. But this script keeps condition down counters both on the token and the tracker which is neat. I like the symbols used but would it be possible to draw from my token status markers so I can easily distinguish between the caster concentrating on a spell vs the target affected by said spell?
1788127236
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Doug! Unfortunately not. You can use any character or emoji, but neither the turn tracker nor the token nameplate can display a graphic. You can use a different list of emojis if you create a custom macro. Just populate with your own choices: Original Macro (Note that the forum software swallows many Emojis, so the emoji list may not appear complete when posted.: !duration --add ?{Color|🔹,🔹|🔸,🔸|💠,💠|♦,♦|▫,▫|◽,◽|▪,▪|◾,◾|🔻,🔻|🔺,🔺|⭐,⭐|✨,✨} ?{Duration (rounds)|10} ?{Effect Name} You can also make custom macros for specific players or monsters that use them over and over. Here is an example: !duration --add ◾ 10 Shadowblade Just make sure they are at the top of the turn order when it gets triggered.
Thank you. Will test this out in next game. 
1788157136
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Let me know how it works out. I've used it in a couple of games so far without issue, but more testers are good!
i've been loking for a tracker for outside of combat / turn order. is there s way I can keep track of debuffs, curses, diseases on players and when I do start combat, it also appears there?
1788543913
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Unfortunately, I designed this to be used in coordination with the turn tracker, since Roll20 has no mechanism to track elapsed time outside of combat. It's wibbly-wobbly-timey-wimey. You can pre-set a duration by placing the character on the tracker and setting it. You will receive a response with a button to restore the duration in the chat. Hitting that restore button and pressing up arrow in chat will give you the text of the macro, that you can then save somewhere and use the next time you start combat.