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

[Script] CombatTracker

September 21 (6 years ago)
The Aaron
Pro
API Scripter
Hmm.. I don't see how that could have fixed it.  prev is used for nothing in that function.  Also, you have an extra ) after prev, not sure if that is changing things for you.
September 21 (6 years ago)

Edited September 21 (6 years ago)

Is it possible to add the same status to two different tokens and have it countdown separately? Currently every token with a status shares the duration when it links to StatusInfo and has an icon. It works fine when it's not referencing the other script. Thanks!


September 21 (6 years ago)

Edited September 21 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@The Aaron, I know.  I saw the same thing.  Don't know why prev has to be there as it isn't being referenced.  However, I received the same ID not found error.  I traced it back to the on change events for handleGraphicMovement,  I commented out handleGraphicMovement onChange.  It worked.  I then commented back in those on change events, restored original code for that function and it worked.  

Now it could be FIRST time in, it fails,  By commenting out those on change events, everything got set properly and the code change really isn't needed. Not entirely sure.    

And since I did reset that function (handleGraphicMovement) back to original code (with prev), I haven't been able to recreate the ID error.  

I can't get the marker from who's turn is it on the token, the red painted circle from page 1. Tried resetting it to no avail, is there a command I didn't see ?

October 03 (6 years ago)

Edited October 03 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

First, did you grab TheAarons fixes to this script posted earlier?  You can't miss that post.  It's quite large.  I've noticed that if you are running it as DM (only) the token doesn't move.  Once the actual players are online, it moves. I haven't gone into depth in the code, but it may using player information within the campaign objects, so the player has to be online I believe.  But it does move.  

Also note at top of script, there's a command to integrate with statusinfo.  You need to manually set that to true and it will import all of the statusinfo conditions into combattracker.  Then when you assign a condition, from within combattracker you type in the condition name (Blessed for example) then put in the duration, which is 10 rounds I believe, and you'll see that it will track that condition and shut if off at the end of 10 rounds.    

Found it! I just wasn't on the player page, then the tracking circle was there and moving, no need for players.

October 04 (6 years ago)
Midgardia
Pro
Marketplace Creator
Sheet Author

Hello! Been using this script for a bit but recently, I get an error that breaks the API and I have to restart the sandbox. I haven't been able to pinpoint exactly what the problem IS or what I do consistently but I've had this same error break the script multiple times in one battle.


I get this error showing on the API output:

Error: toFront() must be given an object either from an event or getObj() or similar. undefined

October 09 (6 years ago)
Robin
API Scripter

Oke, I think i'm really back now. I know I have said this before, but I plan on staying.

I have read through all my messages and topics, and plan on updating/improving my scripts.

I have made an update to CombatTracker in my Repo, the update only contains TheAron's fixes (Thanks for them!) so far, but a bigger update is coming.

Let me know all the ideas/bugs!

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

October 09 (6 years ago)
Robin
API Scripter

Update 0.2.2

Small update where it is optionally to automatic skip custom items in the turntracker.
Made some change to the !ct show menu. With also a button to show custom condition messages and/or StatusInfo descriptions.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

October 09 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

A menu option to integrate statusinfo with combattracker would be great.   Right now you need to change the code to do that.  Then I create statuses in statusinfo and they become available in combattracker.  A nice to have would be a graphic ability to set the condition rather than having to type the name of the condition from within combattracker.  

October 09 (6 years ago)
Robin
API Scripter


Victor B. said:

A menu option to integrate statusinfo with combattracker would be great.   Right now you need to change the code to do that.  Then I create statuses in statusinfo and they become available in combattracker.  A nice to have would be a graphic ability to set the condition rather than having to type the name of the condition from within combattracker.  


You mean a list with statuses from StatusInfo in CombatTracker to easily add them during combat?

October 09 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Yep.  

October 10 (6 years ago)

Edited October 10 (6 years ago)
Robin
API Scripter


Victor B. said:

Yep.  


Isn't that what !ct conditions shows?



Or is that not what you meant?

October 10 (6 years ago)
Robin
API Scripter


Tom said:

Is it possible to add the same status to two different tokens and have it countdown separately? Currently every token with a status shares the duration when it links to StatusInfo and has an icon. It works fine when it's not referencing the other script. Thanks!


Will be fixed in the next update.


October 10 (6 years ago)
Robin
API Scripter

Update 0.2.3

  • Optionally whisper turns only to the GM.
  • Fixed a bug where StatusInfo conditions couldn't have different durations.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

October 11 (6 years ago)
Robin
API Scripter

Update 0.2.4

  • Changed config menu, turnorder settings are now in a seperate menu.
  • Optionally run a character macro (ability) on the characters turn.
  • Optionally turn off auto sorting the turnorder.
  • Optionally reroll initiative on every new round.
  • FX will now not show when a token is on the gmlayer.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

October 12 (6 years ago)
Ravenknight
KS Backer


Robin said:

  • Optionally reroll initiative on every new round.

I freaking love this! Thanks Robin!


October 12 (6 years ago)

Edited October 12 (6 years ago)


Robin said:

Update 0.2.2

Small update where it is optionally to automatic skip custom items in the turntracker.


I'm so happy with the this update, Thank You Robin and welcome back!


I have two other suggestions :

1. When I open the Turnorder and roll initiative for all tokens via character sheet or other means and , and then use the !ct start command the CombatTracker Marker does not auto move to the token at the top of the Turnorder. I can get around this by adding !ct next and !ct prev to my start combat macro. 

2. Combat Timer: Add option in CombatTracker Timer Config for autoskip turn when timer runs out. For example I want my players to state what they wish to do within 10 seconds then we usually use minutes to resolve that players turn and then the player presses macro with !ct next.


Cheers  

October 12 (6 years ago)
Robin
API Scripter

Thanks for the replies guys!


Dethelm said:

1. When I open the Turnorder and roll initiative for all tokens via character sheet or other means and , and then use the !ct start command the CombatTracker Marker does not auto move to the token at the top of the Turnorder. I can get around this by adding !ct next and !ct prev to my start combat macro. 

2. Combat Timer: Add option in CombatTracker Timer Config for autoskip turn when timer runs out. For example I want my players to state what they wish to do within 10 seconds then we usually use minutes to resolve that players turn and then the player presses macro with !ct next.

Both of these will be added/changed in the next update!

October 12 (6 years ago)

I don't know if you are trying to add this but what about rolling initiative at advantage?

October 12 (6 years ago)
Robin
API Scripter

You mean autorolling the initiative with advantage?

October 12 (6 years ago)

Edited October 12 (6 years ago)

Yes, because I select everything and roll the initiative. It's just quicker I think. Also, thoughts on tie breaking?

Rolling with advantage is also something I would like to have in the Concentration API. So many casters have War Caster it only makes sense.

October 12 (6 years ago)
Robin
API Scripter


Jerry F. said:

Yes, because I select everything and roll the initiative. It's just quicker I think. Also, thoughts on tie breaking?

Rolling with advantage is also something I would like to have in the Concentration API. So many casters have War Caster it only makes sense.


Latest update of concentration has this. https://github.com/RobinKuiper/Roll20APIScripts/tree/master/Concentration

I will look into the rest for CombatTracker.


October 14 (6 years ago)

Edited October 14 (6 years ago)

Hi, I love using Combat Tracker and it's one of my favorite scripts, but there's a couple things I'd like to know about.

First, is there a way to make the initiative rolls visible to everybody in chat?

Second, the API console throws an error whenever a player in the GM's campaign tries to use !ct next before any tokens are added to the turn order (so basically when the turn order is empty). Here is the error I get:

Is there already a fix for this? Or is it a special case on my end?


Thanks!


Edit: I noticed the !ct next error happens specifically when there are no tokens added onto the turn order. This means it's fine as long as there is at least one token (which doesn't have to be their token) on the turn order.

October 14 (6 years ago)
Robin
API Scripter


Mark said:

Hi, I love using Combat Tracker and it's one of my favorite scripts, but there's a couple things I'd like to know about.

First, is there a way to make the initiative rolls visible to everybody in chat?

Second, the API console throws an error whenever a player in the GM's campaign tries to use !ct next before any tokens are added to the turn order (so basically when the turn order is empty). Here is the error I get:

Is there already a fix for this? Or is it a special case on my end?


Thanks!


Edit: I noticed the !ct next error happens specifically when there are no tokens added onto the turn order. This means it's fine as long as there is at least one token (which doesn't have to be their token) on the turn order.


Thanks for your reply! The bug will be fixed in the next update. I will look into the initiative rolls before the next update.

October 15 (6 years ago)

Edited October 15 (6 years ago)
Robin
API Scripter

Update v0.2.5

  • Toggle auto skip turn when timer runs out.
  • Optionally show auto initiative rolls in chat.
  • !ct next bugfix.
  • Other bugfixes.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

** Soon in the one click installer**

October 18 (6 years ago)


Robin said:

Update v0.2.5

  • Toggle auto skip turn when timer runs out.
  • Optionally show auto initiative rolls in chat.
  • !ct next bugfix.
  • Other bugfixes.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

** Soon in the one click installer**


Soo freeking awesome Robin...

However i am getting this error sometimes when I have rolled init and type !ct start.


API Output Console

Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info...

For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at selected.forEach.s (apiscript.js:10081:33) at Array.forEach (native) at rollInitiative (apiscript.js:10077:18) at startCombat (apiscript.js:10066:13) at handleInput (apiscript.js:9707:17) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1634:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 

at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) 

Cheers

October 18 (6 years ago)


Robin said:

Update 0.2.2

Small update where it is optionally to automatic skip custom items in the turntracker.

Hi Robin.

I just tested some more and when having a Custom Item with a direction of for excample -1 and you have set the CombatTracker to skip custom, the custom item won't "tick" down every round. Any chance you can make that work?




October 19 (6 years ago)
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter

Suggestions:


I would recommend a menu option to set the dice or die for the initiative roll, to include the option for zero sided dice rolls.

Menu option to easily configure attribute used for initiative. (not sure if this is addressed already)

Also the ability to add an arbitrary bonus to a roll including rolls with zero sides for a flat bonus

Group rolls (select a group then roll, similar to Group-Init).

October 20 (6 years ago)

Robin said:

Update 0.2.3

  • Optionally whisper turns only to the GM.
  • Fixed a bug where StatusInfo conditions couldn't have different durations.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

Awesome. Really appreciate it!

October 21 (6 years ago)


Scott S. said:

Suggestions:


I would recommend a menu option to set the dice or die for the initiative roll, to include the option for zero sided dice rolls.

Menu option to easily configure attribute used for initiative. (not sure if this is addressed already)

Also the ability to add an arbitrary bonus to a roll including rolls with zero sides for a flat bonus

Group rolls (select a group then roll, similar to Group-Init).


Good suggestions, also I would ask:

  • Ability to sort initiative (eg. if you add someone after the initial rolls) -- maybe this is already baked in?

October 22 (6 years ago)

I could see how a !ct sort would be a good idea. I add things to the Turn order all the time after combat has started.

October 22 (6 years ago)

Great scrip, and thanks.

One thing I'd like to see is an "up next" marker (toggleable). Use a green "circle" just like your red active player image, but marking the token who is up next in initiative. Could also add this to the announcement in chat...basically to "push" players into thinking about their next actions.

Maybe skip tokens (don't show the next "circle" on the token) that are not on the object layer or that are invisible (so as to not give away location).


I actually do this in my face-to-face games and works like a charm...speeds up combat quite a bit. Of course, I generally have a party who tend to sometimes get sidetracked by outside influences or are so focused on what the current player is doing so are not thinking about their characters.

October 22 (6 years ago)

One question I have for Robin (or anyone I guess): are players supposed to use !ct start to roll for their tokens, or do they just roll initiative from their sheets after I (GM) runs !ct start? I had them use !ct start last night and it didn't seem to work.

October 22 (6 years ago)


Evan said:

One question I have for Robin (or anyone I guess): are players supposed to use !ct start to roll for their tokens, or do they just roll initiative from their sheets after I (GM) runs !ct start? I had them use !ct start last night and it didn't seem to work.


Evan they can roll from the sheet it will add to the turn order and when you !ct start it will add who ever you have selected and go to the first PC or NPC in the order.



October 22 (6 years ago)


Jerry F. said:


Evan said:

One question I have for Robin (or anyone I guess): are players supposed to use !ct start to roll for their tokens, or do they just roll initiative from their sheets after I (GM) runs !ct start? I had them use !ct start last night and it didn't seem to work.


Evan they can roll from the sheet it will add to the turn order and when you !ct start it will add who ever you have selected and go to the first PC or NPC in the order.



So to clarify the best process is:

1. Open turn tracker

2. Have PCs roll initiative

3. Select NPCs and run !ct start

Is that correct? 


I would definitely love a sort function then because stuff often happens all at once and then the turn tracker is out of order :(


October 22 (6 years ago)

You don't need to have the turn order open, the rolls of your PCs will be stored.

October 22 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Tip: remember to clear the turn order after a combat. I can't count the number of times I've asked players to roll initiative, only to discover the Turn Tracker is littered with turns from the previous combat.

October 23 (6 years ago)

!ct stop does it automatically.

October 23 (6 years ago)
Robin
API Scripter


Dethelm said:


Robin said:

Update v0.2.5

  • Toggle auto skip turn when timer runs out.
  • Optionally show auto initiative rolls in chat.
  • !ct next bugfix.
  • Other bugfixes.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

** Soon in the one click installer**


Soo freeking awesome Robin...

However i am getting this error sometimes when I have rolled init and type !ct start.


API Output Console

Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info...

For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at selected.forEach.s (apiscript.js:10081:33) at Array.forEach (native) at rollInitiative (apiscript.js:10077:18) at startCombat (apiscript.js:10066:13) at handleInput (apiscript.js:9707:17) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1634:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 

at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) 

Cheers


Is your auto roll ini. config option enabled or disabled?



Dethelm said:


Robin said:

Update 0.2.2

Small update where it is optionally to automatic skip custom items in the turntracker.

Hi Robin.

I just tested some more and when having a Custom Item with a direction of for excample -1 and you have set the CombatTracker to skip custom, the custom item won't "tick" down every round. Any chance you can make that work?





Will take a look into that.



---


I will also take a look into the other suggestions.

October 24 (6 years ago)

Edited October 24 (6 years ago)


Robin said:


Soo freeking awesome Robin...

However i am getting this error sometimes when I have rolled init and type !ct start.


API Output Console

Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info...

For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at selected.forEach.s (apiscript.js:10081:33) at Array.forEach (native) at rollInitiative (apiscript.js:10077:18) at startCombat (apiscript.js:10066:13) at handleInput (apiscript.js:9707:17) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1634:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 

at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) 

Cheers


Is your auto roll ini. config option enabled or disabled?

Hi Robin


Just tried to do some investigation, here is what I did:

  1. Set Auto roll ini to false.
  2. Open clean turnorder window
  3. Select a token (in this case a player character) and roll init via character sheet. (Repeat with 3 different tokens)
  4. type !ct start

Then I got this error, and I get it every time i do the above:

SyntaxError: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at handleTurnOrderChange (apiscript.js:9364:14) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1020:14) at updateLocalCache (/home/node/d20-api-server/api.js:1318:18) at /home/node/d20-api-server/api.js:1608:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)

If i restart the API sandbox and type !ct start then it will work.


If i changed auto roll init to true and repeat the steps above i get the same error.


Hope this helps

October 26 (6 years ago)
Robin
API Scripter

Update v0.2.6

  • Custom items will now count down/up correctly when applied.
  • Set initiative die in the config.
  • Sort turnorder with !ct sort.
  • Bugfixes.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker

October 26 (6 years ago)

Edited October 26 (6 years ago)


Robin said:

Update v0.2.6

  • Custom items will now count down/up correctly when applied.
  • Set initiative die in the config.
  • Sort turnorder with !ct sort.
  • Bugfixes.

https://github.com/RobinKuiper/Roll20APIScripts/tree/master/CombatTracker


Hi Robin. I really appreciate the improvements, however:

  • Im still getting the error when i described in my previous post. (dunno if my issue was part of the bug fixes?)
  • !ct sort also gives me an error and crashes the API.
  • Skip Custom Item ticks 2 down when set to direction -1. Tested it with different directions: ticks 4 down when set to -2 and finally ticks 3 down when set to -3...

I'm wondering if I'm the only one getting thes errors?

Cheers

October 27 (6 years ago)

I just tried the new version of CT, and !ct sort is working great for me with no errors; sandbox is still up and running after. I did not try "skip custom items" though

October 27 (6 years ago)

I found the culprit to the API crashes im getting. The API called MARK by The Aaron is the one that is crashing the API when typing !ct start or !ct sort.

Mark can be installed from the Roll20 API script Library.

Can you fix this Robin since I would really like to use both :)

October 27 (6 years ago)

Another thing i mentioned earlier that I would like to see in CombatTracker is:

  1. Make the Marker go to the GM layer before moving on to the next token. This is so the players cannot see which direction a monster they cannot see is.
  2. Also I tested a bit, and when a monster is one the GM layer and the Auto Skip is set to false it still announces that that monsters time is up. So lets say I have an Invisible Stalker that the players don't know about (on the GM layer) and it is in the turn order, when the Invisible Stalker's time is up it states that to all players, making the players aware of the Invisible Stalker.

Hope this can be implemented, and thank you again Robin your great work.

October 27 (6 years ago)
Robin
API Scripter


Dethelm said:

I found the culprit to the API crashes im getting. The API called MARK by The Aaron is the one that is crashing the API when typing !ct start or !ct sort.

Mark can be installed from the Roll20 API script Library.

Can you fix this Robin since I would really like to use both :)


I will run some tests with both scripts asap.


Dethelm said:

Another thing i mentioned earlier that I would like to see in CombatTracker is:

  1. Make the Marker go to the GM layer before moving on to the next token. This is so the players cannot see which direction a monster they cannot see is.
  2. Also I tested a bit, and when a monster is one the GM layer and the Auto Skip is set to false it still announces that that monsters time is up. So lets say I have an Invisible Stalker that the players don't know about (on the GM layer) and it is in the turn order, when the Invisible Stalker's time is up it states that to all players, making the players aware of the Invisible Stalker.

Hope this can be implemented, and thank you again Robin your great work.


Ah, offcourse, will look into them.


October 27 (6 years ago)
Robin
API Scripter


Dethelm said:

I found the culprit to the API crashes im getting. The API called MARK by The Aaron is the one that is crashing the API when typing !ct start or !ct sort.

Mark can be installed from the Roll20 API script Library.

Can you fix this Robin since I would really like to use both :)


Dethelm, I think the following should fix it. Mind testing it? I don't have the time to do the testing today.

https://gist.githubusercontent.com/RobinKuiper/d0afa8d99ecf2424dec359e43f0679d6/raw/05e874d10b834c263d54a55554fc882ff023df20/CombatTracker-Mark%2520fix%253F

October 27 (6 years ago)

Edited October 27 (6 years ago)

Still getting error, this is what i get:

SyntaxError: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at handleTurnOrderChange (apiscript.js:1773:14) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1020:14) at updateLocalCache (/home/node/d20-api-server/api.js:1318:18) at /home/node/d20-api-server/api.js:1608:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)

October 27 (6 years ago)

That error  (i think) is originating with the Mark script, not combat tracker.

Looking at the script of both CT and Mark, both have a call of handleturnorderchange...but each capitalize it differently.

CT's is handleTurnorderChange

Mark's is handleTurnOrderChange


Based on the error list you provided, due to the capitalization (the 4th error line), it is Mark that is throwing up the error.

But I'm not the author of either script, so could be wrong.