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 errors from Concentration script

I believe these are coming from the Concentration script (but I could be wrong) because the log shows them right after Concentration appears.  I wish the API gave better error tracking so that it would be easier to figure out what's causing the error though.  Hopefully someone can fix these.  Thanks. This first set of errors crashes the API: "Concentration Ready! Command: !concentration" TypeError: Cannot set property 'playing' of undefined TypeError: Cannot set property 'playing' of undefined     at changeHandler (apiscript.js:8688:38)     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:1055:14)     at updateLocalCache (/home/node/d20-api-server/api.js:1345:18)     at /home/node/d20-api-server/api.js:1557: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)     at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) This second set, doesn't crash the API: "Concentration Ready! Command: !concentration" "Error: No attribute or sheet field found for character_id -KnB-6RnIy9Rz7ZoV14X named character_sheet" "Error: No attribute or sheet field found for character_id -MBg2_UBk2RijObXEf8y named character_sheet" "Error: No attribute or sheet field found for character_id -M2PgPymcxPFtIKEicrY named character_sheet"
is the token attached to the character sheet? That may be the issue, it's seeing the token character on the map but can't read the sheet since it isnt attached I assume.
1598444171

Edited 1598444816
No, the token is attached to a character sheet.  This is happening with my PC characters.  It's fairly consistent.  That is to say, it's happened a couple of times during the last couple of weeks.  It's only been this week that I was able to track down and see where the error was coming from.   I know one of the spells that causes at least one of the issues: Hunter's Mark.  It's the only one that is used in almost every gaming session.  And I'm fairly sure that it's causing at least the second set of errors to pop up because one of the things that happens in-game is that the status symbol doesn't show up on the character token.  But concentration is still getting tracked because when that character takes damage, the concentration save is rolled. I'm not sure what other spells are causing the failure or if it's all spells.  I was planning to experiment over the next couple of days to see if I can track it any further. Another thing that I've noticed, and I'm not sure if it's related but... I have a "Tokens page" where I keep the characters tokens so when I create a new map, or move the players to another map, I can copy all of the player tokens from the token page and copy them to the new map.  This is convenient because if I copied them from the current map I'd have to do it one-by-one because they could be anywhere on the map but copying them from the "Token" page lets me do it in one go.  Anyway, one of the things that I've noticed happening is that one of the characters (a cleric) ALWAYS ends up with the concentration symbol on his token when I paste that token onto a new map, even though the symbol is not on the token either on the token page, or the current map.  I think the token may exist on a map somewhere with the symbol on it, I don't know.  I don't remove the tokens from old maps so I can go back and look at those maps and the situation there later, especially for post-session write-ups.  But, it's possible that the mechanism that Concentration uses to track things is looking at ALL maps rather than the CURRENT map and that's what's causing the problems.
1598454386

Edited 1598454921
I had to stop using the concentration script since, as you stated, afaik it doesn't do the getObj/Obj.set procedure from the currently active page but from all pages, which kinda spammed some other API I had (triggering a msg for every token =/= fun). I could take a look at it but since I'm no expert, don't count too much on me. I stopped using that script and instead started using CombatMaster which basically integrates that functionality in itself. In the meantime I just ran the procedure through Token-Mod API by replacing lines from 191 to 193 with sendChat("ConcentrationAPI","!token-mod --ids " +characterid+ " --current-page --set statusmarkers|+"+marker,null,{noarchive:true}); EDIT: I believe the fault is in another script, since CONCENTRATION doesn't use neither a 'playing' attribute nor a 'character_sheet' attribute.
I don't believe Concentration (or any script I am using) uses the "playing" attribute or the "character_sheet" attribute directly.  it looks like, from the stack trace, that they are used by the underlying libraries.  But, from the stack trace, it certainly looks like the error is being triggered by the Concentration script that calls one of the library routines that use those attributes.  But, which routine, or where the exact error is, I don't know.
1598463668

Edited 1598463802
This may sound odd Are you using the Concentration API directly from the drop down menu or did you copy/pasted the concentration code? If it's the one click install API - disable it and create a NEW SCRIPT and install this one var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "overdrive"; on("change:graphic:bar1_value", function(obj, prev) { if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { var playerPage = Campaign().get("playerpageid"); var tokenPage = obj.get("_pageid"); if (prev["bar1_value"] > obj.get("bar1_value")) { var final_conc_DC = 10; var calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; if (calc_conc_DC > final_conc_DC) { final_conc_DC = Math.floor(calc_conc_DC); } sendChat("TokenDamage", "Make a Concentration Check DC " + final_conc_DC + "."); } } }); hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so.
1598464479
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's the script I use. It's pretty darn foolproof. If you want to use a custom token marker rather than the Roll20 built in, here's how: 1. Install token-mod (this should be in everybody's API, IMHO) 2. Open the help handout for token-mod and scroll to the token marker section. If you have custom markers, they will display here. The markers in the list will have ID numbers after them. Copy the name and the number and use that where the script above says, "overdrive". For instance, mine says: var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390";
Nover C. said: This may sound odd Are you using the Concentration API directly from the drop down menu or did you copy/pasted the concentration code? If it's the one click install API - disable it and create a NEW SCRIPT and install this one var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "overdrive"; on("change:graphic:bar1_value", function(obj, prev) { if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { var playerPage = Campaign().get("playerpageid"); var tokenPage = obj.get("_pageid"); if (prev["bar1_value"] > obj.get("bar1_value")) { var final_conc_DC = 10; var calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; if (calc_conc_DC > final_conc_DC) { final_conc_DC = Math.floor(calc_conc_DC); } sendChat("TokenDamage", "Make a Concentration Check DC " + final_conc_DC + "."); } } }); hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so. Thanks Nover C. I used to use that script (or one a lot like it) but switched to the Concentration script from the API drop down menu.  The other script watches what spells are cast and automatically applies the status symbol and then automatically rolls the Concentration check (or should, any way) when necessary.  One of the things that I'm constantly forgetting is to put the status marker on the player's token.  Part of the problem is that I cannot remember which spells are concentration spells and I don't want to slow things down by asking, or looking the spells up all the time.  I decided to use the Concentration API script to do that for me.  Having it auto-roll the damage is icing on the cake.  Your script would remind me to ask for the roll but it doesn't watch the spells being cast looking for concentration spells which is more important to me since I do not have every spell memorized.   I can use your script for a time to see if the errors go away.  But, I'd really prefer the one in the API library.
keithcurtis said: That's the script I use. It's pretty darn foolproof. If you want to use a custom token marker rather than the Roll20 built in, here's how: 1. Install token-mod (this should be in everybody's API, IMHO) 2. Open the help handout for token-mod and scroll to the token marker section. If you have custom markers, they will display here. The markers in the list will have ID numbers after them. Copy the name and the number and use that where the script above says, "overdrive". For instance, mine says: var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390"; Just out of curiosity but why can't I just use the name of the symbol (if it has a name) such as "stopwatch"? I.e.: var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "stopwatch"; Is there something I'm missing or misunderstanding?
Stopwatch is a standard marker and therefore should work without the following syntax. You need that if you want to use a custom marker. tl;dr: go ahead.
1598561278
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, only custom token markers need that number (unless a script is written with that in mind). You can also look into CombatMaster, which has recently rolled in the Concentration abilities of Robin's script.
1598574126

Edited 1598574148
keithcurtis said: Yeah, only custom token markers need that number (unless a script is written with that in mind). You can also look into CombatMaster, which has recently rolled in the Concentration abilities of Robin's script. I've been looking at CombatMaster but, frankly, it's so bloated with features that I haven't yet figured it all out and I haven't had a whole lot of time to work with it to learn it while running my game.  The Concentration script did what I needed.  The fact that CM has so many features is not necessarily a bad thing - it just makes the learning curve more difficult as I test out and learn how to use each feature. But, the biggest problem is: if the author of CombatMaster just merged in the Concentration script without modifying it, and the Concentration script was generating errors, then CombatMaster will generate those same errors and it doesn't really solve my problem. I guess I'll have to find time to try and learn CM... if it works, great, if it doesn't I'm no worse off than I was. Thanks.
1598916229

Edited 1598929644
Nover C. said: This may sound odd Are you using the Concentration API directly from the drop down menu or did you copy/pasted the concentration code? If it's the one click install API - disable it and create a NEW SCRIPT and install this one var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "overdrive"; on("change:graphic:bar1_value", function(obj, prev) { if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { var playerPage = Campaign().get("playerpageid"); var tokenPage = obj.get("_pageid"); if (prev["bar1_value"] > obj.get("bar1_value")) { var final_conc_DC = 10; var calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; if (calc_conc_DC > final_conc_DC) { final_conc_DC = Math.floor(calc_conc_DC); } sendChat("TokenDamage", "Make a Concentration Check DC " + final_conc_DC + "."); } } }); hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so. I used this API and it loads just fine, but all I get is  as a result. no roll involved noStatus marked. I just copied and pasted the API you posted and used the !concentration command while I ahd the token highlighted. Am I missing something?
Saul J. said: keithcurtis said: Yeah, only custom token markers need that number (unless a script is written with that in mind). You can also look into CombatMaster, which has recently rolled in the Concentration abilities of Robin's script. I've been looking at CombatMaster but, frankly, it's so bloated with features that I haven't yet figured it all out and I haven't had a whole lot of time to work with it to learn it while running my game.  The Concentration script did what I needed.  The fact that CM has so many features is not necessarily a bad thing - it just makes the learning curve more difficult as I test out and learn how to use each feature. But, the biggest problem is: if the author of CombatMaster just merged in the Concentration script without modifying it, and the Concentration script was generating errors, then CombatMaster will generate those same errors and it doesn't really solve my problem. I guess I'll have to find time to try and learn CM... if it works, great, if it doesn't I'm no worse off than I was. Thanks. I downloaded the latest version of CombatMaster from Github and installed it.  As it turns out, the Concentration piece doesn't seem to do anything - after configuring it, it didn't put the status marker on a token when a concentration spell was cast, and after putting the status marker on the token, CM did not roll the concentration save when the character took damage nor did it even post an alert saying that a concentration save needed to be rolled.   Plus I found a few other bugs/problems with CombatMaster in general (for example, crashing when sorting the turn order).  So, it looks like I'm back to square one.
Vayne said: Nover C. said: This may sound odd Are you using the Concentration API directly from the drop down menu or did you copy/pasted the concentration code? If it's the one click install API - disable it and create a NEW SCRIPT and install this one var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "overdrive"; on("change:graphic:bar1_value", function(obj, prev) { if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { var playerPage = Campaign().get("playerpageid"); var tokenPage = obj.get("_pageid"); if (prev["bar1_value"] > obj.get("bar1_value")) { var final_conc_DC = 10; var calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; if (calc_conc_DC > final_conc_DC) { final_conc_DC = Math.floor(calc_conc_DC); } sendChat("TokenDamage", "Make a Concentration Check DC " + final_conc_DC + "."); } } }); hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so. I used this API and it loads just fine, but all I get is  as a result. no roll involved noStatus marked. I just copied and pasted the API you posted and used the !concentration command while I ahd the token highlighted. Am I missing something? Any updates to this issue? I would love a simple way to handle concentration. 
1599057016

Edited 1599057124
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Vayne said: Vayne said: Nover C. said: If it's the one click install API - disable it and create a NEW SCRIPT and install this one ———Code snipped for space——— hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so. I used this API and it loads just fine, but all I get is  as a result. no roll involved noStatus marked. I just copied and pasted the API you posted and used the !concentration command while I ahd the token highlighted. Am I missing something? Any updates to this issue? I would love a simple way to handle concentration.  The short concentration script I snipped above does not use any commands. The "Goblin 8 is now concentrating" message is coming from a different script. (note that that message text is nowhere in the code.) I have highlighted the instruction that implied this script may give unexpected results if used with other scripts that do similar things. The small script on this page does one thing. It looks for a change on bar 1 of the selected token. If that change is a reduction, and the token has the indicated concentration marker, then it posts a message that a concentration check is required. I have a more advanced copy here that actually gives a chat button for the check. That version also includes a button to toggle the concentration token marker, but for the button to function, requires token-mod to be installed as well. It does not inform you that a given token is concentrating, set the concentration marker to begin with or monitor spells cast and automatically apply concentration. It is a very short and simple script.
I've done some more investigating with the Concentration script that is in the script library.  It turns out that the script works correctly if the spell output is set to "SPELLCARD" but not if the output is set to "ATTACK".  I think the reason is this line in the Concentration script: handleInput = (msg) => { if(state[state_name].config.auto_add_concentration_marker && msg && msg.rolltemplate && msg.rolltemplate === 'spell' && (msg.content.includes("{{concentration=1}}"))){  And I think the problem is that the rolltemplate is not "spell" when the output is set to "ATTACK" but I don't know what the rolltemplate is... and I can't find any documentation about the rolltemplates associated with the 5E OGL sheet nor how to view them.  If someone can point me to the information, I might be able to figure out how to fix the Concentration script. I don't need CombatMaster and all that it does - I just need this simple Concentration script.  As I said, I think I've figured out the problem but I don't know how to fix it. 
1599075718

Edited 1599075994
Saul J. said: I've done some more investigating with the Concentration script that is in the script library.  It turns out that the script works correctly if the spell output is set to "SPELLCARD" but not if the output is set to "ATTACK".  I think the reason is this line in the Concentration script: handleInput = (msg) => { if(state[state_name].config.auto_add_concentration_marker && msg && msg.rolltemplate && msg.rolltemplate === 'spell' && (msg.content.includes("{{concentration=1}}"))){  And I think the problem is that the rolltemplate is not "spell" when the output is set to "ATTACK" but I don't know what the rolltemplate is... and I can't find any documentation about the rolltemplates associated with the 5E OGL sheet nor how to view them.  If someone can point me to the information, I might be able to figure out how to fix the Concentration script. I don't need CombatMaster and all that it does - I just need this simple Concentration script.  As I said, I think I've figured out the problem but I don't know how to fix it.  Delete this part && msg.rolltemplate === 'spell' You might have some false-positives here and there. I don't know since I've never used OGL. Might not be a big of a deal unless the attack template does not include the {{concentration=1}} syntax. Otherwise it should work fine. handleInput = (msg) => { if(state[state_name].config.auto_add_concentration_marker && msg && msg.rolltemplate && (msg.content.includes("{{concentration=1}}"))){ Also, if you run a sheet command from a character sheet, you can see the entire template in your chat. Just use it (the spell, for instance) and go in the chat box and press the '↑' up arrow in your keyboard to show past entries. It should 'hopefully' be there and you can guesstimate the overall syntax of spells and concentration spells. Post an example here if you can.
Here's what I see in the chat after casting a spell set as "ATTACK": %{-M2PgPymcxPFtIKEicrY|repeating_attack_-MGFYVo1SogW6maP4z9C_attack} No template shown.  I thought about removing the fragment that you suggest as that seemed like the obvious solution but that could mean unforeseen consequences based on the actual template used.  And I think there must be a template used - it's just hidden - because of the formatting of the output.  And I need to see what properties the full template has that may or may not be used when the spell is cast so I can distinguish a spell from a weapon attack, for instance.
Saul J. said: Here's what I see in the chat after casting a spell set as "ATTACK": %{-M2PgPymcxPFtIKEicrY|repeating_attack_-MGFYVo1SogW6maP4z9C_attack} No template shown.  I thought about removing the fragment that you suggest as that seemed like the obvious solution but that could mean unforeseen consequences based on the actual template used.  And I think there must be a template used - it's just hidden - because of the formatting of the output.  And I need to see what properties the full template has that may or may not be used when the spell is cast so I can distinguish a spell from a weapon attack, for instance. Are you casting it from a token macro or by clicking it on the character sheet? (Most likely the former)
Juan C. said: Saul J. said: Here's what I see in the chat after casting a spell set as "ATTACK": %{-M2PgPymcxPFtIKEicrY|repeating_attack_-MGFYVo1SogW6maP4z9C_attack} No template shown.  I thought about removing the fragment that you suggest as that seemed like the obvious solution but that could mean unforeseen consequences based on the actual template used.  And I think there must be a template used - it's just hidden - because of the formatting of the output.  And I need to see what properties the full template has that may or may not be used when the spell is cast so I can distinguish a spell from a weapon attack, for instance. Are you casting it from a token macro or by clicking it on the character sheet? (Most likely the former)   Clicking it from the spells list on the character sheet
Saul J. said: Juan C. said: Saul J. said: Here's what I see in the chat after casting a spell set as "ATTACK": %{-M2PgPymcxPFtIKEicrY|repeating_attack_-MGFYVo1SogW6maP4z9C_attack} No template shown.  I thought about removing the fragment that you suggest as that seemed like the obvious solution but that could mean unforeseen consequences based on the actual template used.  And I think there must be a template used - it's just hidden - because of the formatting of the output.  And I need to see what properties the full template has that may or may not be used when the spell is cast so I can distinguish a spell from a weapon attack, for instance. Are you casting it from a token macro or by clicking it on the character sheet? (Most likely the former)   Clicking it from the spells list on the character sheet You could try adding a line after handleInput = (msg) => { if(state[state_name].config.auto_add_concentration_marker && msg && msg.rolltemplate && (msg.content.includes("{{concentration=1}}"))){ Like this: handleInput = (msg) => {         log(msg.content); if(state[state_name].config.auto_add_concentration_marker && msg && msg.rolltemplate && (msg.content.includes("{{concentration=1}}"))){ Then first thing try running a spell attack. The template should show up in the API Debug Log. as a single log line (hopefully).
Ok, well, it's good to know that I can print out the msg.content... but it doesn't help me.  Here's the output from Hunter's Mark (ATTACK) and Spirit Guardians (SPELLCARD): " {{rname=Hunter's Mark}} 0 {{range=90 feet}} {{damage=1}} {{dmg1flag=1}} {{dmg1=$[[0]]}} {{dmg1type=}} 0 {{dmg2=$[[1]]}} {{dmg2type=}} 0 {{desc=}}   {{spelllevel=1}} {{innate=}} {{globaldamage=$[[2]]}} {{globaldamagetype=Hunter's Mark}} ammo= {{charname=Lester}}" "<div class='sheet-rolltemplate-simple' style='margin-top:-7px;'><div class='sheet-container'><div class='sheet-label' style='margin-top:5px;'><span style='display:block;'>SPELL SLOT LEVEL 1</span><span style='display:block;'>1 OF 3 REMAINING</span></div></div></div>" " {{level=abjuration 3}} {{name=Spirit Guardians}} {{castingtime=1 action}} {{range=Self (15-foot radius)}} {{target=Self (15-foot radius)}} {{v=1}} {{s=1}} {{m=1}} {{material=A holy symbol}} {{duration=Up to 10 minutes}} {{description=You call forth spirits to protect you. They flit around you to a distance of 15 feet for the duration. If you are good or neutral, their spectral form appears angelic or fey (your choice). If you are evil, they appear fiendish. When you cast this spell, you can designate any number of creatures you can see to be unaffected by it. An affected creature’s speed is halved in the area, and when the creature enters the area for the first time on a turn or starts its turn there, it must make a Wisdom saving throw. On a failed save, the creature takes 3d8 radiant damage (if you are good or neutral) or 3d8 necrotic damage (if you are evil). On a successful save, the creature takes half as much damage.}} {{athigherlevels=When you cast this spell using a spell slot of 4th level or higher, the damage increases by 1d8 for each slot level above 3rd.}} 0 {{innate=}} {{concentration=1}} {{charname=Lester}}" "<div class='sheet-rolltemplate-simple' style='margin-top:-7px;'><div class='sheet-container'><div class='sheet-label' style='margin-top:5px;'><span style='display:block;'>SPELL SLOT LEVEL 3</span><span style='display:block; color:red;'>ALL SLOTS EXPENDED</span></div></div></div>" "<div style=\"background-color: #fff; border: 1px solid #000; padding: 5px; border-radius: 5px;overflow: hidden;\"><b>Lester</b> is now concentrating on <b>Spirit Guardians</b>.</div>" I don't get it.  I didn't change the other line so it still says "msg.rolltemplate==='spell'.  Neither of those lines should match.  And removing that code fragment doesn't make any difference.
1599136764

Edited 1599136874
The only thing I can think of is trying to change the hunter's mark behavior to that of a normal spell, since it seems like it's something particular to hunters mark and perhaps some other spells that I do not know of (damn OGL). The thing is, any workaround would not allow any spells using the attack roll template to know whether it's a concentration spell or not. So it's either using concentration || spell level as a spell identifier, to address both spell templates and attack templates (and in the latter case, it would trigger a concentration check without knowing whether or not it's a concentration spell). Or leaving it as it is, so it only works on spellcards as these should work just fine. BTW the log was just to understand OGLs syntax, it wasn't meant to fix the issue.
I understand the log was just to understand the syntax.  I'm a former programmer so I know such things - I just didn't know you could do that (my javascript is very rusty).  I just didn't see anything there that was useful.  And, as I said, removing that code fragment didn't resolve the issue so the problem is somewhere else.  I just can't see where or what will fix it. By default, Hunter's Mark in the compendium is set to "SPELLCARD" even though it's sort of an attack, and Spirit Guardians (another spell my party uses) is by default set to "ATTACK" even though it's not.  So, I can't really rely on roll20 setting things correctly.  I'm just going to make sure everyone in my party knows that concentration spells should all be "SPELLCARD" and we can deal with any other issues that arise individually until the script is fixed by someone who knows more than I do (like maybe The Aaron who was the last person to work on it from what I can tell on github).  
1599463513

Edited 1599463576
keithcurtis said: Vayne said: Vayne said: Nover C. said: If it's the one click install API - disable it and create a NEW SCRIPT and install this one ———Code snipped for space——— hopefully that one works for you. It uses the Overdrive status Marker. You can change it to another one but you have to adjust the script. Ctrl-F overdrive and put the other named status marker you'd like if so. I used this API and it loads just fine, but all I get is  as a result. no roll involved noStatus marked. I just copied and pasted the API you posted and used the !concentration command while I ahd the token highlighted. Am I missing something? Any updates to this issue? I would love a simple way to handle concentration.  The short concentration script I snipped above does not use any commands. The "Goblin 8 is now concentrating" message is coming from a different script. (note that that message text is nowhere in the code.) I have highlighted the instruction that implied this script may give unexpected results if used with other scripts that do similar things. The small script on this page does one thing. It looks for a change on bar 1 of the selected token. If that change is a reduction, and the token has the indicated concentration marker, then it posts a message that a concentration check is required. I have a more advanced copy here that actually gives a chat button for the check. That version also includes a button to toggle the concentration token marker, but for the button to function, requires token-mod to be installed as well. It does not inform you that a given token is concentrating, set the concentration marker to begin with or monitor spells cast and automatically apply concentration. It is a very short and simple script. Thank you for replying. I disabled another script so maybe its coming form another API mod. When I installed the script you posted I got an error. I removed everything and reinstalled this API Script and it loaded. Next stupid question, Im totally lost with trying to set up the token mod stuff you suggested. What do I need to do to use the Script in game? 
1599491464
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Vayne said: The short concentration script I snipped above does not use any commands. The "Goblin 8 is now concentrating" message is coming from a different script. (note that that message text is nowhere in the code.) I have highlighted the instruction that implied this script may give unexpected results if used with other scripts that do similar things. The small script on this page does one thing. It looks for a change on bar 1 of the selected token. If that change is a reduction, and the token has the indicated concentration marker, then it posts a message that a concentration check is required. I have a more advanced copy here that actually gives a chat button for the check. That version also includes a button to toggle the concentration token marker, but for the button to function, requires token-mod to be installed as well. It does not inform you that a given token is concentrating, set the concentration marker to begin with or monitor spells cast and automatically apply concentration. It is a very short and simple script. Thank you for replying. I disabled another script so maybe its coming form another API mod. When I installed the script you posted I got an error. I removed everything and reinstalled this API Script and it loaded. Next stupid question, Im totally lost with trying to set up the token mod stuff you suggested. What do I need to do to use the Script in game?  First off, I use a variation of the script, Nover was the one who posted it in its entirety. Here is my version in its entirety: var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390" ; on("change:graphic:bar1_value", function(obj, prev) {     if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) {         var playerPage = Campaign().get("playerpageid");         var tokenPage = obj.get("_pageid");         if (prev["bar1_value"] > obj.get("bar1_value")) {             var final_conc_DC = 10;             var calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2;             if (calc_conc_DC > final_conc_DC) {                 final_conc_DC = Math.floor(calc_conc_DC);             } sendChat("TokenDamage", "/w gm &{template:npcaction} {{rname=Concentration Check @{selected|character_name}}} {{name=@{selected|character_name}}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "
" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|! Concentrating )*}}");        }     } }); To use this requires installing a couple of other scripts, since it makes calls to them. Install: Token-mod libTokenMarkers They are both available in the One Click. (not sure if the second is needed in this case, but once you have everything working, try toggling it off to see if it is). Two lines need changing to adapt it to your campaign. I have bolded the parts above, but will reference them below. If using regular token markers, you should use the Roll20 choices made by the original script writer: var TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + " overdrive "; sendChat("TokenDamage", "/w gm &{template:npcaction} {{rname=Concentration Check @{selected|character_name}}} {{name=@{selected|character_name}}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "
" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|! overdrive )*}}");        } If you are using custom token markers, you will need to get their names and ID. This is where token-mod first comes in. In your game open the token mod help handout (the script creates one). Scroll until you find the visual list of token markers in your game, with their names and ids. for the first line of the script, you will need both name and id. It's a simple snippet, and doesn't reference the libTokenMarker library, so it needs both, in the format of "name:######" For the second reference, you will only need the name. That's just constructing a button to call token-mod to toggle the marker, and token-mod is a much, much smarter program. TL;DR: Tokenmod is needed to find the name and id of the marker you want to use, and to toggle the value in line 12.