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

The new D&D 2024 sheet is now available!

Create a free account

TurnTracker1 - Spell Durations and Effects

How can you put a spell or effect in the turn tracker with a countdown using TurnTracker1? Say I have an NPC that disengages from melee and runs, setting fire to each square behind them by lighting and pouring oil. This results in 5 grid squares on fire. How can I add - using a macro button or something - to add the fire - ONLY ONE ENTRY - to the turn tracker so I know when to delete the fire graphic objects because they are done burning their fuel?
1526002949
The Aaron
Pro
API Scripter
I have this little script. !act [FORMULA] [STARTING VALUE] --[DESCRIPTION] For example: !act -1 10 --Bless Will make an entry named Bless that starts at 10 and reduces by 1 each time it gets a turn. code: on('ready',function(){     "use strict";     const checkFormulaOnTurn = () => {         let to=JSON.parse(Campaign().get('turnorder')||'[]');         if(to.length && to[0].id==='-1'){             sendChat('',`[[${to[0].pr}+(${to[0].formula||0})]]`,(r)=>{                 to[0].pr=r[0].inlinerolls[0].results.total;                 Campaign().set('turnorder',JSON.stringify(to));             });         }     };     on('chat:message',function(msg){         var args,cmds,who,initial,change,entry;         if('api' === msg.type) {             if(msg.content.match(/^!act\b/) ){                 who=(getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');                 if(_.has(msg,'inlinerolls')){                     msg.content = _.chain(msg.inlinerolls)                         .reduce(function(m,v,k){                             var ti=_.reduce(v.results.rolls,function(m2,v2){                                 if(_.has(v2,'table')){                                     m2.push(_.reduce(v2.results,function(m3,v3){                                         m3.push(v3.tableItem.name);                                         return m3;                                     },[]).join(', '));                                 }                                 return m2;                             },[]).join(', ');                             m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0;                             return m;                         },{})                         .reduce(function(m,v,k){                             return m.replace(k,v);                         },msg.content)                         .value();                 }                 args = msg.content                     .replace(/<br\/>\n/g, ' ')                     .replace(/(\{\{(.*?)\}\})/g," $2 ")                     .split(/\s+--/);                 cmds=args.shift().split(/\s+/);                 change=parseFloat(cmds[1])||'+1';                 change=`${/^[+-]\d/.test(change)?'':'+'}${change}`;                 initial=parseFloat(cmds[2])||0;                 entry=args.join(' ');                 if(entry.length){                     let to=JSON.parse(Campaign().get('turnorder')||'[]');                     to.unshift({                         id: "-1",                         pr: initial,                         custom: entry,                         formula: change                     });                     Campaign().set('turnorder',JSON.stringify(to));                     if(!playerIsGM(msg.playerid)){                         sendChat('ACT',`/w gm <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;"><b>${who}</b> added entry for <b>${entry}</b> starting at <b>${initial}</b> and changing by <b>${change}</b>.</div></div>`);                     }                 } else {                     sendChat('ACT',`/w "${who}" <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;">Use <b><pre>!act [formula] [starting value] --[description]</pre></b></div></div>`);                 }             } else if(msg.content.match(/^!eot/i)){                 _.defer(checkFormulaOnTurn);             }         }     }); });
Does that only work with TurnTracker1, or is it it's own separate thing?
1526026818

Edited 1526026971
MyRoll20Stuffs
API Scripter
@The Aaron: Surprisingly enough I somehow already have added that script to my API I must have seen in it another thread and thought it would be useful. I'm probably going to have to make a macro with a dropdown to apply these timers though because I can't put it in the "set fire" or "smoke bomb" macro themselves as it would create multiple entries because it covers multiple tiles as they move and set the fire or drop the smokesticks etc etc Anyways thanks for showing an example of how to use this and reminding me of it. Quick Question: Is there any way to add an image along with the !act command to the Turn Tracker like how it shows PC/NPC tokens? EDIT: I'm having some issues with this. When I run this macro: !act -1 ?{Rounds:|1|2|3|4|5|6|7|8|9|10} --?{Effect:|Bless} It doesn't count down each round for some reason. EDIT 2: I had an old version of "!act" - when I replaced it with the code you provided the counting down started working properly. Still curious about the token image thing though so let me know when you get a chance.
1526040699
The Aaron
Pro
API Scripter
Gozer the Gozerian said: Does that only work with TurnTracker1, or is it it's own separate thing? It's completely separate and stand-alone. Kastion said: Quick Question: Is there any way to add an image along with the !act command to the Turn Tracker like how it shows PC/NPC tokens? To have an image, you have to have a token with a turn added. Kastion said: EDIT 2: I had an old version of "!act" - when I replaced it with the code you provided the counting down started working properly.  I recently added support for "!eot" allowing it to change.  There's actually a bug that causes this to count down ever time you hit "!eot" while on it.. I need to fix that...
To have an image, you have to have a token with a turn added. I'm not sure I understand this. You mean only tokens that have rolled initiative can have images and tokens added with !act cannot?
1526052262
The Aaron
Pro
API Scripter
Only token images show up in the Turn Order.  Custom Turns can't have token images.  You'd have to have a token with a turn to have the image.  I'm not sure if you can get automated formulas on tokens, but I'll look into it.