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

July 19 (5 years ago)

Edited July 19 (5 years ago)


Ravenknight said:

@Seph
Will the script remove all status icons when combat ends? Not just the conditions added from the script? I think I misunderstood something.


Yes, at least in my testing, using the Stop Combat command removes all status icons from all tokens on the current page.

I don't think it's possible to track which icons are added by the script and which are added manually. Or if it is, I imagine it would be way too much effort to have the script differentiate them.

July 19 (5 years ago)

So does the status info script still work with the new combat tracker?  Seeing as it was used to add conditions outside of combat as well? or does this combat tracker just remove the conditions no matter what?

July 19 (5 years ago)

Edited July 19 (5 years ago)


Kilter said:

So does the status info script still work with the new combat tracker?  Seeing as it was used to add conditions outside of combat as well? or does this combat tracker just remove the conditions no matter what?


The new combat tracker is a combination of status info and CT. Don't run the old scripts with the new one. With the current version of Victor's script, stopping combat removes all status icons from all tokens on the map.

July 19 (5 years ago)

Thank you Seph, that will save me some time. :)

Seph said:


Kilter said:

So does the status info script still work with the new combat tracker?  Seeing as it was used to add conditions outside of combat as well? or does this combat tracker just remove the conditions no matter what?


The new combat tracker is a combination of status info and CT. Don't run the old scripts with the new one. With the current version of Victor's script, stopping combat removes all status icons from all tokens on the map.




July 19 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Ok ok, I'll add something to control removal of status icons.  But @seph, you can do anything to code that you want.  It's open source

July 20 (5 years ago)

Edited July 20 (5 years ago)


Victor B. said:

Ok ok, I'll add something to control removal of status icons.  But @seph, you can do anything to code that you want.  It's open source


Oh I just meant could you point out what I need to adjust to not have icons removed? To save you the trouble of adding a new configuration. I thought it might be easier for you that way. Sorry I didn't make that clear enough before.

July 20 (5 years ago)

Edited July 20 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I've put in support for keeping icons on tokens.  The configuration is called Clear Conditions on Close and it will default to True.  Go to the Setup Menu/Status Setup and set that option to false and the icons will remain.  


Version 1.0.21 Beta is available here https://github.com/vicberg/Combattracker

July 20 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@kilter you can use CT to add conditions to tokens outside of combat

July 20 (5 years ago)

Okay, the issues was if they dropped at the end when stuff last longer than combat, if if the latest update fixes that then it will be helpful. As I have enough to do than go back in and add back things like poison that last for a hour.
Also I would like to join in and thank you for all your work. 

July 20 (5 years ago)

Edited July 20 (5 years ago)

Report from a full game last night (using 1.0.20):

We had multiple large scale combats with six players and up to a dozen bad guys. I had the Handle Graphics error appear twice. It seems to only appear on the second instance of combat on the same map? I used the same technique as before, drew a huge box around the tokens and started combat. In both cases I quickly restarted the API sandbox, refreshed the game and things worked correctly again. I thought it went pretty well from my end.

With so many tokens rolling initiative (my players want to see the rolls) it was a hassle for the person who was going first to scroll all the way through those rolls to click the Done check. In all of my tests has the checks for the first token appear on the chat before the initiative rolls appear. The others appear normally after the rolls.


The biggest problem I had...I have to remind them constantly to click the check mark!

July 20 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Heads up. I just installed this this morning to give it a spin. I get a sandbox crash when a token using the Aaron's "Bump" script is in the turn order. The API crashes when I advance the turn. I suspect it might have something to do with the marker ring?

July 20 (5 years ago)

Here is what I have had so far. 

Installed in one game got this error...


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: RangeError: Maximum call stack size exceeded

RangeError: Maximum call stack size exceeded

    at RegExp.exec (<anonymous>)

    at RegExp.test (native)

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

    at $b (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:36:239)

    at mc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:40:370)

    at $a.t.remove (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:26:44)

    at $a.t.remove (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:26:133)

    at $a.t.remove (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:26:133)

    at $a.t.remove (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:26:133)

    at $a.t.remove (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:26:133)



Started combat got this error...

    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: state[combatState].conditions.forEach is not a function

TypeError: state[combatState].conditions.forEach is not a function

    at getAnnounceConditions (apiscript.js:9042:43)

    at announcePlayer (apiscript.js:9003:23)

    at doTurnorderChange (apiscript.js:8896:17)

    at handleTurnorderChange (apiscript.js:9914:13)

    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



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



Hit next got this error....

For reference, the error message generated was: TypeError: state[combatState].conditions.forEach is not a function

TypeError: state[combatState].conditions.forEach is not a function

    at getAnnounceConditions (apiscript.js:9042:43)

    at announcePlayer (apiscript.js:9003:23)

    at doTurnorderChange (apiscript.js:8896:17)

    at NextTurn (apiscript.js:9148:9)

    at handleInput (apiscript.js:8253:5)

    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)


Had to refresh the page got this error....



    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 'id' of undefined

TypeError: Cannot read property 'id' of undefined

    at handleGraphicMovement (apiscript.js:9927:33)

    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:1502:11

    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)

    at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)

    at Rd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)


There was a invisible token added at one point. But Ill keep testing.


    

July 20 (5 years ago)

Edited July 20 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@kilter, It's a problem when the conditions aren't imported.  If you overlay on the old status state, these problems continue.  I ran into something similar today in one of my campaigns.  The correct solution is to export from your old version and import into the new version.  I'll see if there's a way I can force this to happen or otherwise clean up session state if you overlay.  

July 20 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@professor,You can use the next turn in CT or the right arrow within the turnorder window to move onto next turn.  I never wait for the players to click done button.  

July 20 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@keith, what is the "bump" script?  What does it do?  

July 21 (5 years ago)

Edited July 21 (5 years ago)

Sure thing. 
The bump script puts token on GM layer while making the invisible on the token layer script.  (One of the many I use as well.)

July 21 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Victor B. said:

@keith, what is the "bump" script?  What does it do?  


It's a script in the dropdown, by the Aaron. Here's the blurb:

Bump provides a way to invisibly manipulate tokens on the GM Layer from the Objects Layer, and vice versa.
When a token is added to Bump a slave token is created that mimics everything about to master token. The slave token is only visible to the GM and has a color on it to show if the master token is on the GM Layer or the Objects layer. Moving the slave token will move the master token and vice versa. The slave token represents the same character as the master token and changes on the slave token will be reflected on the master token.

I suspect it has something to do with moving a "bumped" token. The copy on the token layer moves, but instead of moving the marker ring and the GM layer copy, the script crashes. It could be getting confused as to which is which?


July 21 (5 years ago)

Edited July 21 (5 years ago)

I added the script to my live game to test it out on there, and I'm getting two new errors that I'm not getting in my test game (the one you have access to, Victor). Same settings, TokenMod versions, and CombatTracker versions in both games.

The first error happens when using TokenMod to add a status icon to a token. TokenMod sends the following error to chat. I asked TheAaron to look into it first since TM is his script, and he said "something is going wrong with how [CombatTracker] accounts for conditions."

{"msg":{"content":"!token-mod --set statusmarkers#-cobweb#-three-leaves#-white-tower#-chained-heart#-black-flag#+flying-flag#-screaming !!!","playerid":"-L_R9MG8UraK3MQaIht-","selected":[{"_id":"-LjoGfrlXcwYR27T7UHs","_type":"graphic"}],"type":"api","who":"Seph (GM)"},"stack":"TypeError: state[combatState].conditions.forEach is not a function\n at removeCondition (apiscript.js:23943:43)\n at addCondition (apiscript.js:23869:13)\n at apiscript.js:25394:25\n at Array.forEach (native)\n at handleStatusMarkerChange (apiscript.js:25389:31)\n at apiscript.js:25475:17\n at apiscript.js:5079:13\n at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:186:9)\n at notifyObservers (apiscript.js:5078:11)\n at applyModListToToken (apiscript.js:6647:9)"}

The second error happens when starting combat or adding a condition to a token via CT. The API crashes and shows the following:

All of this works just fine in the test game. Let me know if you need more info.

EDIT: Also getting this error when trying to add a new condition in setup

July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@seph, same issue as Kilter and same issue as myself.  Happens when you overlay your current game with new CT.  The session state is not in sync and the api dies trying to start it.  

There's no way (at least if you aren't an API programmer) to clear out session state.  So I'm going to have to put something in to look at session state and clean it up.  

July 21 (5 years ago)

Edited July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter


keithcurtis said:


Victor B. said:

@keith, what is the "bump" script?  What does it do?  


It's a script in the dropdown, by the Aaron. Here's the blurb:

Bump provides a way to invisibly manipulate tokens on the GM Layer from the Objects Layer, and vice versa.
When a token is added to Bump a slave token is created that mimics everything about to master token. The slave token is only visible to the GM and has a color on it to show if the master token is on the GM Layer or the Objects layer. Moving the slave token will move the master token and vice versa. The slave token represents the same character as the master token and changes on the slave token will be reflected on the master token.

I suspect it has something to do with moving a "bumped" token. The copy on the token layer moves, but instead of moving the marker ring and the GM layer copy, the script crashes. It could be getting confused as to which is which?


Yep, you are probably right.  When it's moving the main token it's crashing on the "slave" token.  I'm going to bet it has something to do with, your friend and mine, handleGraphicMovment again.  That's an event listener on Roll20 and kicks in anytime a graphic is moved in order to move the current marker.  So it's picking up the slave from Roll20 and has no idea what to do with it.  


July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

What is the error Keith? Please post.    

July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I fixed the error surrounding announceConditions when you overlay an older version of CT with newest version.  It now cleans up session state. 

New version found here, 1.0.23 Beta https://github.com/vicberg/Combattracker


Thanks for the update Victor!

Testing 1.0.23 in my live game, still getting this error when trying to start combat

and this one when trying to apply a condition to a token through CT

July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Seph, I posted the wrong version.  Please download again and your problem should go away.  Did I say how much I hate github?

Everything seems to be working smoothly now. Thanks again, Victor!

July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

And a new moving to 1.1.0 Beta here https://github.com/vicberg/Combattracker

- Put in more robust checking in handleGraphicMovement.  Please check if this fixes !jump

- Put in movement for next image (green circle that goes around next player up), so image will move when token it's on moves


July 21 (5 years ago)

Edited July 21 (5 years ago)

I'm trying out a new macro using the commands to add conditions, specifically multiple conditions at once. Example:

!ct paralyzed helpless ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}

This worked in the standalone CombatTracker (minus the duration and direction). Running a separate command for each condition in the macro doesn't seem to work either. Example:

!ct paralyzed ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}
!ct helpless ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}

Is there a way I can do this in one macro, or will I need to use separate macros for each condition?

Also what was the !jump issue exactly? So I know what to look out for

July 21 (5 years ago)

Edited July 21 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Victor B. said:

What is the error Keith? Please post.    


I'd like to, but I can't reproduce it this morning. I suspect it had to do with the marker rings. After reactivating the script, I could not get them to reappear. If I could get them to show, I might be able to reproduce the error. Here are the settings, am I missing something?




July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Do you have the player ribbon on the page you are looking at.  Marker images only work on the player page

July 21 (5 years ago)

Edited July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter


Seph said:

I'm trying out a new macro using the commands to add conditions, specifically multiple conditions at once. Example:

!ct paralyzed helpless ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}

This worked in the standalone CombatTracker (minus the duration and direction). Running a separate command for each condition in the macro doesn't seem to work either. Example:

!ct paralyzed ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}
!ct helpless ?{Rounds|1} ?{Indefinite?|yes,0|no,-1}

Is there a way I can do this in one macro, or will I need to use separate macros for each condition?

Your commands are wrong.  Duration|? Direction|? 

Set direction to 0 if you want it to continue indefinitely

CT isn't setup to parse multiple commands within a single call.  Maybe a future version but I'm not going to do that now.  So it would have to be separate calls to CT.  I built the menu in chat specifically because I didn't want to have tons of macros rolling around. 

I have a macro always calling !ct so I can quickly bring up the menu and assign conditions.  



July 21 (5 years ago)

Edited July 21 (5 years ago)

I use a separate macro because I originally had it set up to use both TokenMod and ChatSetAttr, so I could have a token selected, click Paralyzed in my chatmenu, and TokenMod would apply the icon while ChatSetAttr would activate the condition in the character sheet. I decided to replace the TokenMod commands with the !ct commands so I can apply duration/direction.

So to be clear, having two !ct commands in one macro like the second example I gave is expected not to work and each command should have a separate macro, correct? Or is there a way I could format it so both commands go through with the one macro?

EDIT: I think I got it working, at least for this one macro so far! I added !!! to the end of the first line, 'cuz I remembered seeing somewhere that that helps the API to recognize the end of a command or something :)

Only issue I'm having now:

I set the duration as 2 and direciton as -1, both icons are added to the token with the number 2 on each icon. I let one round go by, and the turn announcement says 1 round remains for each condition.

I let one more round go by, but only Paralyzed is removed from the token. The icon for helpless is still there with the number 1 on it.

This happens any time more than one condition is added with the same duration, even if both are added directly through the CT menu.

And still getting this error when trying to add a new condition

My conditions are all imported from the test game, not sure if that has anything to do with it.

July 21 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Victor B. said:

Do you have the player ribbon on the page you are looking at.  Marker images only work on the player page


Derp. That's a rookie error. Yeah, that was that problem. I cannot replicate the crash, still. The ring does not follow the bumped token, but the API stays up. Sorry for any alarms.

July 21 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Ok, i may need to install !bump and figure out what that script is doing.  The bumped token is in the turnorder, yes?  If not, then it won't follow.  

July 22 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

@seph, I see the issues with create/delete/edit conditions.  I'm working on a fix now

July 24 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I haven't forgotten about you @seph.  This error has highlighted that the entire command structure is all over the map, so I'm having to make significant changes to the commands for consistency


Victor B. said:

I haven't forgotten about you @seph.  This error has highlighted that the entire command structure is all over the map, so I'm having to make significant changes to the commands for consistency


No worries, thanks for the update! Is this just the create/edit/delete conditions issue, or is this also causing the issue with the script not removing more than one condition at a time?

July 24 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

New version available, 1.1.1 Beta here https://github.com/vicberg/Combattracker

Fixed the Add/Delete Condition issue

Revamped the command structure for consistency

Testing 1.1.1

Adding/deleting a condition works, but trying to open a condition's menu to edit it results in this error:

And the following issue is still present:

I set the duration as 2 and direciton as -1, both icons are added to the token with the number 2 on each icon. I let one round go by, and the turn announcement says 1 round remains for each condition.

I let one more round go by, but only Paralyzed is removed from the token. The icon for Helpless is still there with the number 1 on it.

Helpless is removed only the following round. This happens any time more than one condition is added with the same duration, even if both are added directly through the CT menu.

July 26 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

New Version 1.1.2 Beta here https://github.com/vicberg/Combattracker

Fixed editCondition error


@Seph, I just ran through a test of announcing the player with multiple conditions and it worked fine for me.  Please see if you still have the issue

Two questions for experienced CombatTracker users (I'm thinking about using it).

  1. What are the main draws to use CombatTracker over the default Roll20? What features do you find the most useful? I am definitely looking for something that offers good tracking of round-based effects, including spell/condition duration, encounter-specific timed events (5 rounds until big bad summoned, party must win before then, etc.). Does CombatTracker offer these features?
  2. Is there a way to change the replace the default status icons associated with conditions with custom markers or images? I hate the built-in Roll20 status markers with a white-hot passion, and have been using the Custom Status Marker script so far, but it would be really nice to have conditions expire when they're supposed to (paralyzed, frightened, etc.) instead of constantly clicking icons on or off.
July 26 (5 years ago)

Edited July 26 (5 years ago)

Victor B. said:


@Seph, I just ran through a test of announcing the player with multiple conditions and it worked fine for me.  Please see if you still have the issue


I had a hard time figuring out how to test this again with 1.1.2 because of a new issue with applying conditions. It's defaulting to Duration -1 and Direction 0 for some reason. When using the CT menu to apply a condition to a token, choosing 3 for Duration and -1 for Direction (plus the command it generates):

When manually entering a command:


I realized that the values are simply off by a space, so when I add anything between the condition name and the Duration value, it seems to work correctly:


As for the multiple conditions with the same number of rounds...

...it's still counting down the rounds correctly while only removing 1 condition at a time. Round after the above screenshot:

And then the following round:

July 26 (5 years ago)

Edited July 26 (5 years ago)

Jay R. said:

What are the main draws to use CombatTracker over the default Roll20? What features do you find the most useful? I am definitely looking for something that offers good tracking of round-based effects, including spell/condition duration, encounter-specific timed events (5 rounds until big bad summoned, party must win before then, etc.). Does CombatTracker offer these features?


I like having the added visual representation for turn order and conditions (chat announcement, a graphic that highlights the token at top of turn order and optionally one that highlights the token that's up next, condition description in chat when a condition is applied to a token, etc.). I also think the fact that you can select multiple tokens and start combat using CombatTracker to automatically roll initiative and sort them in descending order is extremely useful. As for the timed events, I suppose you could create a custom condition called "countdown" or whatever to apply to said big bad in that encounter.


Jay R. said:

Is there a way to change the replace the default status icons associated with conditions with custom markers or images? I hate the built-in Roll20 status markers with a white-hot passion, and have been using the Custom Status Marker script so far, but it would be really nice to have conditions expire when they're supposed to (paralyzed, frightened, etc.) instead of constantly clicking icons on or off.


Unfortunately, I don't think CombatTracker is currently compatible with Custom Status Marker.

July 26 (5 years ago)

Edited July 26 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Those are defaults.  You override those on setup.  So set duration and direction to whatever you want.  

Let's recreate this in the game you have me invited to?  

While you are working on conditions, there is a clearer way to indicate "direction"? Duration seems clear but direction for a unit of time threw me for a loop.



July 26 (5 years ago)

Edited July 26 (5 years ago)


Victor B. said:

Those are defaults.  You override those on setup.  So set duration and direction to whatever you want.  

Let's recreate this in the game you have me invited to?  

I won't be home for another few hours, so I can't launch the game right now.

I'm using override. What's happening is the Duration is being ignored, and the Direction is being treated as the Duration, so the command...

!ct add stunned 3 -1

...is ignoring '3', treating '-1' as Duration, and Direction is defaulting to null since nothing is after '-1'. This should be treating '3' as Duration and '-1' as Direction, right?

But if I put anything (character, number, whatever) between 'stunned' and '3', like this...

!ct add stunned _ 3 -1

...it ignores whatever's between Condition and Duration, recognizes '3' as Duration, and recognizes '-1' as Direction.

So since the default command generated by the script is...

!ct add <condition> ?{Duration|1} ?{Direction|0}

...any value entered for Duration is ignored and whatever value entered for Direction is treated as Duration (and actual Direction is null).

July 27 (5 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Version 1.1.3 Beta is up here https://github.com/vicberg/Combattracker

Fixed the duration/direction issue.  I'm going to run it through it's paces today.