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

I got Combat Tracker to work only the first time I loaded it...since then I get the same error message that Wolfie posted.  I`m using the latest version as well.  Only other script I'm using is It's a trap with the OGL character sheet extension.  I enjoyed it when it worked...   TypeError: type.indexOf is not a function TypeError: type.indexOf is not a function at spawnFx (/home/node/d20-api-server/api.js:2848:11) at spawnFxBetweenPoints (/home/node/d20-api-server/api.js:2987:3) at doFX (apiscript.js:7429:9) at doTurnorderChange (apiscript.js:7422:9) at handleTurnorderChange (apiscript.js:7222:13) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1024:14) at updateLocalCache (/home/node/d20-api-server/api.js:1322:18) at /home/node/d20-api-server/api.js:1612:7
1578966637

Edited 1579058203
Victor B.
Pro
Sheet Author
API Scripter
What FX are you using?  I'm using the default Nova one and it works like a champ.  
1579058418
Victor B.
Pro
Sheet Author
API Scripter
Folks, CombatTrackerV2 is close to being done.  All of the commands have been converted, unneeded commands removed, messages added, a much more elegant way of allow users to add their own statuses has been implemented.  Stubs have been added for Roll20AM, FX, TokenMod, TokenCondition and libTokenMarker.  TheAaron has provided sample code for libTokenMarker (custom status markers) so I'll be testing that out tomorrow.      
Victor B. said: Folks, CombatTrackerV2 is close to being done.  All of the commands have been converted, unneeded commands removed, messages added, a much more elegant way of allow users to add their own statuses has been implemented.  Stubs have been added for Roll20AM, FX, TokenMod, TokenCondition and libTokenMarker.  TheAaron has provided sample code for libTokenMarker (custom status markers) so I'll be testing that out tomorrow.       Excited to seeit. Plan to start a campaign in two weeks or so and really hope to let players use the !ct add on the tokens, because I can add the condition with a duration (which i use as a condition level in Pathfinder 2e).
Victor B. said: Folks, CombatTrackerV2 is close to being done.   Squeal! Can't wait to see it!
Mad hype for V2, thanks for all the hard work, Victor!
Victor B. said: What FX are you using?  I'm using the default Nova one and it works like a champ.   Haven't even messed with the settings.  I enable the API, launch the game, select tokens, roll initiative, and.....nothing.  Exit game to check API and there is the error message.  Really wish I could figure this out as it makes combat infinitely easier. 
1579182987

Edited 1579231808
Victor B.
Pro
Sheet Author
API Scripter
Are you using OGL sheet for your game?  If not you'll need to set the initiative attribute(s).  The default of the OGL sheet is initiative_attribute, which is the default for CT.  Your sheet might be using something else for initiative.  What game are you playing?  
1579231747

Edited 1579232745
Victor B.
Pro
Sheet Author
API Scripter
Custom graphic integration is in and working.  I have TokenCondition, FX/ Roll20AM left to do plus some general clean up and I'll be posting to my github for beta testing.  I'll also be working on updating the CT Wiki (adding a new section at the top) and I'll be publishing this as CombatTrackerV2.  Original Combat Tracker/Status Info will remain for those using it.   I'll need a lot of beta test help.  This a huge expansion.  It encompasses many of TheAaron's scripts so you'll need to go to his github to pull down until they are published to Roll20 as well.  You do NOT want to throw this into your current campaign and pray it won't bomb out.  Lots and lots of changes.  
1579231899
Victor B.
Pro
Sheet Author
API Scripter
Shane, PM me a link to your game.  After I join game then promote me to GM so I can figure out why it's not working for you.  
1579237932

Edited 1579237989
I'd be happy to beta test. I'm curious, the way you're integrating all these other scripts, is it that setting a condition will activate a command for one of the other scripts? Would it be possible (without having to change a lot about your work on the script) to have a way to link a condition to a macro, so that setting the condition will also send that macro to chat? I use ChatSetAttr to toggle the conditions on my player's sheets, and being able to turn on the condition in a sheet and apply the marker to the token with one click—then turn both off with another click—would be immensely handy.
I will help with the beta as well.
1579281202

Edited 1579281277
Victor B.
Pro
Sheet Author
API Scripter
Here's the meat of the changes: You'll see a custom icon for blinded that I uploaded.  You can add a default message or override that message when assigning a condition to the token.  The message will display when the player's turn and you are announcing the players.  There's 4 options when adding a condition to an icon, any or all of these may be called.  You'll enter a tokenmod or roll20am command or fx or macro.  The same 4 options will get invoked when removing a command.  All of these are optional.  If using Token Condition, I'll create a drop down of all char sheets that are configured for Token Condition.   You'll choose one (such as Mount), and then you can assign a mount(s) to a token(s) by selecting the tokens and adding the condition (which will be Mount) in CT.    
1579283196
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's a really robust feature! I might abandon my long-standing Conditions macro for this...
1579285598
Victor B.
Pro
Sheet Author
API Scripter
You can still use it.  You'll need to modify the commands but it will still work and as long as the condition is configured, everything else will kick off
1579285759
Victor B.
Pro
Sheet Author
API Scripter
Here's the new initiative feature.  The CT version is recognizable.  The new one is for Group-Init
I have been having trouble with this API. Works for one combat, and then stops entirely. Sometimes does not work the first time at launch. Any help?
1579333298

Edited 1579378643
Ravenknight
KS Backer
Scott A. said: I have been having trouble with this API. Works for one combat, and then stops entirely. Sometimes does not work the first time at launch. Any help? Since both StatusInfo and CombatTracker are installed I think the first question is what version you are using? Victor combined Robin's scripts.
So, every link to the code I find in this thread now says 404 Page Not Found. Has it been moved? I can't even find it from Victor B.s main GitHub page.
His github is there but its not showing any forks for the combattracker other than one for the 5thed combattrackercustom. With all the anticipation and work he's doing I suspect a new fork will appear soon hopefully. I think he did mention something about beta testing something soon. 
Mark (GM) said: His github is there but its not showing any forks for the combattracker other than one for the 5thed combattrackercustom. With all the anticipation and work he's doing I suspect a new fork will appear soon hopefully. I think he did mention something about beta testing something soon.  He did, but I would like to at least have access to the last usable version. It has all just disappeared. :(
1579381165

Edited 1579381215
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Victor when you do post the new code, it might be a good idea to start a brand new thread to prevent confusion and to make the current code easier to find. If I might make a further suggestion, have you considered re-branding it in order to reduce confusion even further? Combat Handler, maybe, or Combat Controller? This really feels like it will be a whole new beast. At the very least, "Combat Tracker Plus". Some kind of break would also be helpful for folks searching the forums for solutions and finding old macros and workflows that no longer work with the new code. Finally, a new script would have its own identity in the Roll20 repository and One-Click, and I think it's criminal you don't have an API Scripter tag next to your name.
1579391068
Victor B.
Pro
Sheet Author
API Scripter
Yep, I'm going to post to Roll20 and want to preserve existing code already there for CT and SI.   I'm not sure what I'll rename this to.  I was thinking CombatTrackerV2.  But that may be a bit too close to original.  I don't do this for badges.  
1579391560
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I like putting "Plus" at the end. It keeps the original name, but makes it clearer that there is a break between the two (three if you include the Status script)  versions. But I'm sure whatever you decided will be fine. Looking forward to giving it a try.
1579393671

Edited 1579393712
I would suggest naming it Combat Integration API. Something along that line. Or what Keith suggested. 
Yes I am looking forward to the combined version as well. Currently still using robins version as 3 games I use it are in live and do not wish to switch just yet....Drool!
I will gently disagree about putting Plus next to CombatTracker. That makes it sound like you've just tinkered a bit with Robin's script and added one or two things, when you have put in a load of time and energy to take CT to the next level. Not that I have a vote, but my vote is for Combat Manager (integration refers to a process, not an end product -- great for devs, not for the public). 
I like the sound of Combat Manager or Combat Conditions Manager
Jay R. said:  (integration refers to a process, not an end product -- great for devs, not for the public).  But yet, this new API integrates with others. lol Whatever the name, I am looking forward to this upgrade. 
1579475200
Victor B.
Pro
Sheet Author
API Scripter
Ok, so I'm going with CombatMaster.  I've changed session state from combattracker to combatmaster.  This will remove contention with anyone running Status Info, which has been a persistent problem in the past.   For current CT users, when you export/import, it will detect it's CT and only import the conditions.  The remaining CM configurations will have to be redone as the majority of them have changed.   If importing CM it will now import the entire session state (it was only doing conditions) so you can quickly copy all of your configurations from one game to another.   I'm putting in observers so if you launch initiative via group init directly (in chat or via macro), CM will detect and launch up.  I'm adding similar observers for TokenCondition so if you drag/drop a Token Condition onto a token, CT will get involved and ask for direction/duration, etc.  It's almost done then I need to bang on it for a while and I'll post to my github during beta before pushing to Roll20.  I'll also start up a new thread for CombatMaster.  
1579475848
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
"CombatMaster". I like it.
1579531028
Victor B.
Pro
Sheet Author
API Scripter
Alright I'm going to need some help with executing macro/abilities.  What is currently happening is that it's using the token to find the character "ability" and macro name.  I went to Roll20 Wiki and all of this makes little sense to me. Abilities are setup on the char sheets.  Abilities are like macros but not clear on the difference.  Nor is it clear how to define an ability.  I'm going to assume right now that you can't run a "global" macro against a specific token/character unless the macro has the Token ID hard coded into the macro.  There is a macro object in Roll20 so I'm guessing it is possible to pull a global macro out and run it, but without the linking directly to the token/character I'm not sure if that would even make sense to run.  
1579537051
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Coming late to this discussion, are you talking about running an ability/macro from the API or manually by a user initiating it? And, what sort of ability/macro are you looking at running? As for the difference between abilities and macros, there really isn't one from an API perspective other than where they are stored. Macros are stored in the campaign similarly to handouts and characters. Abilities are just macros that are stored on a specific character. And then to confuse it even more, you have sheet roll buttons which are abilities that the API doesn't have access to.
1579539191

Edited 1579539206
Victor B.
Pro
Sheet Author
API Scripter
Alright, yes, Macro launch is already built into Combat Tracker and I'm carrying it forward into the new Combat Master script.  It's currently launching an ability assigned to the char sheet and that's it.  Nothing else, which is fine.  I need to know if there's benefit in launching a global macro (not assigned to a char sheet) or as you talked about, Ability Roll Buttons?  First I've heard of those as well.  I did see a couple of mentions on the Roll20 wiki.   So is there benefit to launching a global macro?  Nothing I can do about Roll Buttons, so that will have to be outside of CM and I'll continue launching Ability Macros.  
1579546967

Edited 1579546994
The macro feature currently in the script just activates a character ability with a specific name at the start of that characters turn. I mentioned including macros with conditions before. I have global macros for ChatSetAttr commands to toggle (one macro to apply, one to remove, for each feature) a condition or apply things like rage bonus stats on the sheet linked to a selected token. Being able to link one macro to applying a condition and one to the removal of that condition would be useful for toggling both marker and sheet adjustments this way.
1579547538
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Well, it depends on what you mean by activate. If you mean just send to chat, then the script can activate whatever it wants by just doing something like: sendChat('combatManager','%{John Smith|repeating_attack_-648JHL980kj_roll}') There are a few strings attached here though. If the ability, sheet roll, or macro has roll queries in it, then the ability won't be activated as the API has no way to respond to those. Similarly, if the ability, sheet roll, or macro requires a selected token or a targeted token, sending it from the API won't result in anything because the API can't select or target specific tokens for the purposes of the selected and target keywords. On the other hand, if you want the script to parse the ability and process it after that, you could set it up to replace selected, target, and even certain roll queries with appropriate values, but it wouldn't be able to do this with sheet rolls.
1579548494

Edited 1579556213
Yeah I was thinking along the lines of, for example, let's say I have a condition called Sickened in CombatMaster, and two macros: #SickenedOn and #SickenedOff, which contain a ChatSetAttr command to apply the Sickened penalties to the selected token's linked sheet and one to remove those penalties, respectively. Then the Sickened condition in CM could be set up in it's config menu to send #SickenedOn to chat when it's added to a token, and send #SickenedOff to chat when the condition is removed from the token.
Being able to send a macro this way could be useful sending other script commands or macros that a user wants sent to chat when a condition is applied or removed, making it pretty flexible for a variety of functions.
1579549457

Edited 1579549575
The Macro launch feature that is currently built in is still useful, but it's for launching an ability called CT_TURN (or whatever you specify in the script config) from a specific character at the start of that character's turn.
1579562676
Victor B.
Pro
Sheet Author
API Scripter
Persephone, can you provide a sample macro you launch for this?  
For the feature already in CT you mean? Or a macro I would use in conjunction with a condition?
1579570625
Victor B.
Pro
Sheet Author
API Scripter
Your macro
1579577023

Edited 1579582373
I'll give an example of both just in case I'm misunderstanding. (Global) Macro on Condition Add/Remove Personally my main use for this would be to run a command for ChatSetAttr, but I could see it being useful for running macros with rollable tables or other script commands or something like a saving throw for the affected character. Here's the macro (called 'sickened-add') I currently use to apply the sickened condition to a character: !ct add sickened ?{Rounds|1} ?{Indefinite?|yes,0|no,-1} ! !setattr --sel --condition_sickened#1 ! Sometimes only one of the API commands goes through. With the function I'm suggesting, the macro would only contain !setattr --sel --condition_sickened#1 and in CombatMaster, I would configure the condition Sickened to send #sickened-add to chat when it's added to a token. There would be another macro called 'sickened-rem' that the script would send to chat when the condition is removed. I assumed that's what the Macro setting in this screenshot was for, but if it isn't for this I'm curious what it is for? It's totally possible I misunderstood you from the beginning and this is exactly the intended function, so I apologize for that. Macro on Turn Start This is the feature that already exists and is configured from this menu Also personally only use it for ChatSetAttr commands, namely for effects that only last one turn. For example, a player would activate a macro on their turn that turns on a buff that lasts until the start of their next turn. Their character has an ability called 'CT_TURN' that contains this !setattr --mute --name Athena --repeating_buff_-LX3zR7MtHEBcyknMPC5_toggle|0 and if the buff is on at the start of their turn, CT turns it off.
1579578381
The Aaron
Roll20 Production Team
API Scripter
Scott C. said: [...] On the other hand, if you want the script to parse the ability and process it after that, you could set it up to replace selected, target, and even certain roll queries with appropriate values, but it wouldn't be able to do this with sheet rolls. You can look at my script OnMyTurn for some code that does just this.
1579611268

Edited 1579612442
Victor B.
Pro
Sheet Author
API Scripter
I'm trying to figure out what I need to do with the macro.  The current macro process is for abilities tied to character sheets only.  If I continue doing macros that way then you'll have to assign abilities to all character sheets for that to work.  Not very user friendly and not very robust if you have 200 NPCs.   I'd like to get away from that.  The question is, do I need to add a target to the macro call like Scott suggested and using The Aarons example or can I simply make the call?   For CharSetAttr, I'm assuming the -sel represents selected tokens.  All I'd need to do in this case is do a simple sendchat for the macro.     
1579616050

Edited 1579620571
Victor B.
Pro
Sheet Author
API Scripter
I came up with a solution driving the kid to the bus stop.  There will be three "parameters" you can place into a macro. {CMCharacterName} and {CMCharacterAll} and {CMSelected}. CM will detect if these are in the macro and replace with either the current character target or all Characters on the map  or issue against selected tokens.  If none of these exist, then it will execute the macro as is.  This means that you won't be able to test your macro via Roll20 but will need to test out of CM. This should get us away from ability macros and be flexible enough to handle anything.   So in Persephone's ability macro example, it would change to this: !setattr --mute --name {CMCharacterName} --repeating_buff_-LX3zR7MtHEBcyknMPC5_toggle|0 What is the  repeating_buff?  Is that a token id, character id?  Why is that even there?   ANOTHER QUESTION to those watching this thread 1) Do you use any end of round macros or api calls (prior to going to round 2, round 3 etc)? 2) Do you run anything at start of combat or end of combat? 
1579620833
Kraynic
Pro
Sheet Author
End/beginning of round stuff is pretty situational for me.  There are some combats in pathfinder where I am using a rollable table at the top of each round for weather affects that hinder various aspects of combat, or water behavior affecting movement in water affected by ocean wave action.  It would be cool to have something like that trigger automatically, but not too terribly important to me.  In my palladium games, the recommended way to run combat is to redo initiative every round, making turn order variable throughout a battle.  I have been way too lazy to run the game this way, but if I was able to have initiative rerolled automatically at the top of the round, I would do so.
1579621964
Victor B.
Pro
Sheet Author
API Scripter
Rolling Initiative each round is already in CM and was in CT.   If you want to put the RollTable into a macro, which is doable, I'm going to add more API calls at the top of each round
1579624857
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Victor, I'd probably just use the normal attribute syntax. Then users can just use a single macro for manual and automated use. It should be just as easy to look for @{...}  as {CM...} . You can even have it discriminate based on what keywords are used, so you'd have the following logic: @{selected|attribute_name}:  The selected gets replaced with the name of the character currently being processed. Alternatively, replace the whole attribute call with the attribute's value on that character. @{attribute_name}: Shouldn't come up in anything except character abilities, but this would be processed as for the selected case above since it's assumed to be for the character that owns the ability this is written in. @{character name|attribute_name}:  This gets left alone as it is a hard coded reference to some character's attribute (or ability) @{target|attribute_name}:  This probably gets removed as the API has no way to deal with a target Doing it this way also means you don't need to code in handling for a specific set of attributes. This will make the code more generally useful and allow users to do a wider variety of tasks with it. You will have to have handling for the 3 (really 5) different attribute call syntaxes: @{attribute_name} @{keyword|attribute_name}  and @{target|targetName|attribute_name} @{keyword|attribute_name|max}  and   @{target|targetName|attribute_name|max} Recognizing these via regex should be as simple as something like: /@{(?:(target\|.+?\||target|[^}]+?)\|)?([^}]+?)(?:\|(max))?}/ If the first capture group === 'target', then throw out the result. If it's anything else process as needed. You can also use regex to process roll queries and replace them with their first option, making the first option the default option. Whether or not you want to support roll queries is another question. I'd probably say not to, but it could be workable. Victor B. said: !setattr --mute --name {CMCharacterName} --repeating_buff_-LX3zR7MtHEBcyknMPC5_toggle|0 What is the  repeating_buff?  Is that a token id, character id?  Why is that even there?    That repeating_buff... is the name of the attribute that chatSetAttr is being told to modify in that API command. It's an attribute in a repeating section, so it has the format of repeating_sectionName_rowID_attribute_name . Note that row index can be substituted for rowID.