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

Need a Round Counter API script but dont know what to use

Hello everyone, I am in need of adding a round counter on my turn tracker, I have read the forums but some of them are outdated or not support it anymore. I wonder if you guys know one that works atm, I am not looking for something fancy but just will add the round I am and will show which round we are on game. Thx foor all help
1521505446
vÍnce
Pro
Sheet Author
I believe Aaron's TurnMarker script is still viable <a href="https://app.roll20.net/forum/permalink/931415/" rel="nofollow">https://app.roll20.net/forum/permalink/931415/</a>
1521505751

Edited 1586880641
The Aaron
Pro
API Scripter
Yup.&nbsp; It's got more than you probably need, but would work. You could also use this AddCustomTurn Snippet: on('ready',() =&gt; { const checkFormulaOnTurn = () =&gt; { let to=JSON.parse(Campaign().get('turnorder')||'[]'); if(to.length &amp;&amp; to[0].id==='-1'){ sendChat('',`[[${to[0].pr}+(${to[0].formula||0})]]`,(r)=&gt;{ to[0].pr=r[0].inlinerolls[0].results.total; Campaign().set('turnorder',JSON.stringify(to)); }); } }; on('chat:message',(msg) =&gt; { if('api' === msg.type) { if(msg.content.match(/^!act\b/) ){ let who=(getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); if(_.has(msg,'inlinerolls')){ msg.content = _.chain(msg.inlinerolls) .reduce((m,v,k) =&gt; { let ti=_.reduce(v.results.rolls,(m2,v2) =&gt; { if(_.has(v2,'table')){ m2.push(_.reduce(v2.results,(m3,v3) =&gt; { m3.push(v3.tableItem.name); return m3; },[]).join(', ')); } return m2; },[]).join(', '); m['$[['+k+']]']= (ti.length &amp;&amp; ti) || v.results.total || 0; return m; },{}) .reduce((m,v,k) =&gt; { return m.replace(k,v); },msg.content) .value(); } let args = msg.content .replace(/&lt;br\/&gt;\n/g, ' ') .replace(/(\{\{(.*?)\}\})/g," $2 ") .split(/\s+--/); let cmds=args.shift().split(/\s+/); let change=parseFloat(cmds[1]); change = Number.isNaN(change) ? '+1' : change; change = `${/^[+-]\d/.test(change)?'':'+'}${change}`; let initial = parseFloat(cmds[2])||0; let 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 &lt;div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"&gt;&lt;div style="background-color: #ffeeee;"&gt;&lt;b&gt;${who}&lt;/b&gt; added entry for &lt;b&gt;${entry}&lt;/b&gt; starting at &lt;b&gt;${initial}&lt;/b&gt; and changing by &lt;b&gt;${change}&lt;/b&gt;.&lt;/div&gt;&lt;/div&gt;`); } } else { sendChat('ACT',`/w "${who}" &lt;div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"&gt;&lt;div style="background-color: #ffeeee;"&gt;Use &lt;b&gt;&lt;pre&gt;!act [formula] [starting value] --[description]&lt;/pre&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;`); } } else if(msg.content.match(/^!eot/i)){ _.defer(checkFormulaOnTurn); } } }); }); This will add a Custom Turn named "Round" with a value that will increase whenever it gets a turn: !act --Round You'll have to skip past it, but other than that, should be very serviceable. This snippet is designed for adding counters to the Turn Order.&nbsp; We commonly use it for spells like: !act -1 10 --Marcus: Bless You can run: !act to get a terse help output.
thanks :)
1525314393
GiGs
Pro
Sheet Author
API Scripter
Aaron, in the Bless snippet above, what does the -1 10 do? !act -1 10 --Marcus: Bless
1525315300
The Aaron
Pro
API Scripter
the -1 sets the formula to apply each time the custom turn comes up, the 10 sets the starting value.&nbsp; So that will count down as it gets a turn.
1525315883
GiGs
Pro
Sheet Author
API Scripter
So if it was -3, it would drop by 3 each turn? and if it was 2, it would increase by one? Does it accept inline rolls?
1525316508
The Aaron
Pro
API Scripter
If it was 2, it would increase by 2 each turn. And yeah, it supports inline rolls. =D