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

GroupCheck - Apply Damage script not working with Custom Token Marker Sets

I'm using Jakob's excellent GroupCheck and Apply Damage script, and it all seems to work except for when using token marker sets other than the default token markers. I am unable to have the script apply the status of any other token marker sets. I use a set from Czepeku called 80 status effect icons which work fine without the script. But I cannot have them automate by the script. I have tried renaming the markers and adding them to the script. But they still dont appear as a menu option on the npc's apply damage menu. What am I missing? statusMarkers = [       "red", "blue", "green", "brown", "purple", "pink", "yellow", "Blind" , "dead", "skull", "sleepy", "half-heart",       "half-haze", "interdiction", "snail", "lightning-helix", "spanner", "chained-heart", "chemical-bolt",       "death-zone", "drink-me", "edge-crack", "ninja-mask", "stopwatch", "fishing-net", "overdrive", "strong",       "fist", "padlock", "three-leaves", "fluffy-wing", "pummeled", "tread", "arrowed", "aura", "back-pain",       "black-flag", "bleeding-eye", "bolt-shield", "broken-heart", "cobweb", "broken-shield", "flying-flag",       "radioactive", "trophy", "broken-skull", "frozen-orb", "rolling-bomb", "white-tower", "grab", "screaming",       "grenade", "sentry-gun", "all-for-one", "angel-outfit", "archery-target"     ],
1609198045
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Custom token markers typically require an id number to be used in scripts, such as Stunned::12345 You can find the complete name by installing Token-mod and opening the help handout. All token markers are listed in the help doc with their full names.
Thank you for the quick response Keithcurtis! I've just installed Token-mod and ran the help doc (will take me some time to read/understand it all) but it does show me the full name (or what I believed to be) of my installed status tokens. I've tried updating the script with the appropriate token names and what I think are the id's (in various formats) but they still do not appear in the status input menu when applying group damage.   However I just noticed that Token-mod is only showing me the token marker names and not their id's, do I need to do something else to see their id's? That said, the script doesn't seem to refer to the id's (although I'm probably wrong) I just don't see them it in the script itself.  
1609217237

Edited 1609217290
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Use the token-mod help handout . There's not enough room in chat for the IDs to display properly unless you make it very wide. The IDs are not used unless you are working with a custom set. For instance, in my own game, the Blinded condition marker would be: Blinded::30980 It's also a good idea to load the API libTokenMarkers , to help scripts that do a lot of work with Token Markers. 
1609268800

Edited 1609269797
Can the API scripts on this page provide the same information (token marker string IDs) without the need for the token-mod API? By the way Ian L., I think that one source of your problem is that the status markers are referenced both by the ApplyDamage API and by whatever macro you are using to marry GroupCheck with ApplyDamage and output the status to the token (I'm guessing that it looks something like this one ).  So even if you successfully add a new token marker (status) to the ApplyDamage API script, you will need to modify your macro in order to make it an option to select.  Getting the correct output from that selection is the part that's giving me trouble at the moment.
1609269286
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I haven't tried them. If they work for you, post your results here. I'm curious.
1609270077

Edited 1609270233
Seems to - this is a portion of the output (capturing some custom token markers along with the default) I got after installing the scripts and using the !markernames command.  If I could figure out how to use those commands with the ApplyDamage script and the macro I'm using to tie it to GroupCheck I'd be stoked, but I'm still learning this API scripting stuff.
1609277916
The Aaron
Roll20 Production Team
API Scripter
There are some formatting issues in the help with long Token Marker Names.  I need to fix that.  Try pulling your chat window larger to see the tag names, they should appear in a better format. Or install libTokenMarkers and this script and run: !list-sm Code: /* global libTokenMarkers */ on('ready', ()=>{ // Make sure libTokenMarkers exists, and has the functions that are expected if('undefined' === typeof libTokenMarkers || (['getStatus','getStatuses','getOrderedList'].find(k=> !libTokenMarkers.hasOwnProperty(k) || 'function' !== typeof libTokenMarkers[k] )) ) { // notify of the missing library sendChat('',`/w gm <div style="color:red;font-weight:bold;border:2px solid red;background-color:black;border-radius:1em;padding:1em;">Missing dependency: libTokenMarkers</div>`); } else { const c = (()=>{ let last = '#eeeeff'; return () => { last = ('#eeeeff' === last ? '#eeffee' : '#eeeeff'); return last; }; })(); const fmtMarker = (m)=>`<div style="background-color: ${c()}; border: 1px solid #aaa; padding: .1em;">${m.getHTML(3,"float:left;")}<div style="float:left"><b>${m.getName()}</b><br><code>${m.getTag()}</code></div><div style="clear:both;"></div></div>`; // Watch for chat messages on('chat:message',(msg) => { // when `!set-sm` occurs, do something if('api'===msg.type && /^!list-sm(\b\s|$)/i.test(msg.content)){ let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname'); // get all the markers that match the first argument let markers = libTokenMarkers .getOrderedList() .map(fmtMarker) .join(''); sendChat('All TokenMarkers',`/w "${who}" <div style="background-color:#ccc;">${markers}</div>`); } }); } }); It will whisper them all to you in a nicely formatted manner: The part in red is the tag.
Thank you for the help everyone! I am now able to obtain the full and complete status token name and ID. Kurtis D. I believe you are also on the right track, as I've updated the GroupCheck macro with the status token ID's and now see them in the status input menu when applying group damage. Unfortunately, when choosing one of the added custom status' the 'ApplyDamage' link in the chat no longer works or links to anything (thus not rolling the damage or setting the status token). I think we are close to getting this, any other suggestions? Here are my GroupCheck and ApplyDamage macros:
Ian L., unfortunately you're probably not as close as you'd like.  It sounds like you're getting the same results I've gotten, and I've come to the conclusion that the macros and ApplyDamage API need more extensive modifications to incorporate either the recent Roll20 custom token marker functions and commands documented on this page , or installing and using TokenMod commands.  The former option seems simpler to me, so that is the one I'm currently pursuing, although I need to learn a bit more about JavaScript first. 
Update for Ian L. and anyone else following this topic (setting custom status markers on tokens using GroupCheck and ApplyDamage): It looks like Roll20 added support for custom status/token markers by adding both a new token_markers array (where all game/campaign markers are stored) and object property (where markers can be assigned) while still keeping the old statusmarker property (where only legacy markers can be assigned).  It seems that while the new token_markers property stores both legacy and custom markers, the statusmarker property remains exclusive to legacy markers so any script that tries to place a custom marker object into the statusmarker property will fail.  The documentation and code (snippet below) on this  page details the new token_marker array and related functions indicates that it's possible to rewrite scripts to account for the new token_markers property, but I'm still too early in the JavaScript/Roll20 API learning curve to sort out the details of how best to do that.  I also don't know if using The Aaron's libTokenMarkers library would make things easier or not.   } else if(msg.content.split(" ")[0].toLowerCase() === '!settokenmarker') {             const markerName = msg.content.split(" ")[1].toLowerCase();             if (!msg.selected && msg.selected[0]._type == "graphic") return;             obj = getObj(msg.selected[0]._type, msg.selected[0]._id);             currentMarkers = obj.get("statusmarkers").split(',');             currentMarkers.push(markerName);             obj.set("statusmarkers", currentMarkers.join(','));
Has anyone manged to get custom tokens working with the fabled Group Check - Apply Damage combo macro.  I believe the issue lies in that the  GroupCheck script has to escape characters in order to create a Buttom Command for Roll20.  It uses it's own HTMLReplace function to do this but didn't have ":" in it's list of characters to escape.  Referencing custom token ids like "Prone::2281396" will break the code to make the ApplyDamage button.  I've tried editing the script to add the escape, but either my lack of JS knowledge or something else is thwarting me.  htmlReplace = (str, weak) => { const entities = { "<": "lt", ">": "gt", "'": "#39", "@": "#64", "{": "#123", "|": "#124", "}": "#125", "[": "#91", "\"": "quot", "]": "#93", "*": "#42", "&": "amp", ":":"#58", }; const regExp = weak ? /['"@{|}[*&:\]]/g : /[<>'"@{|}[*&:\]]/g; return str.replace(regExp, c => ("&" + entities[c] + ";")); },
So the change above, escapes the ":" correctly, and I was able to log the ouput to the sendChat command.&nbsp; Here are the two examples:&nbsp; One where we reference the stauts of Blue which is default token marker and the other a custom status with "::" called prone.&nbsp; Blue works find and renders the button correctly, while Prone doesn't.&nbsp; I've bolded the only differences at the end of each code section.&nbsp; Not sure why this isn't rendering this correctly in the Chat.&nbsp;&nbsp; Anyone familiar with using Sendchat() in API that can spot the reason? Working using "Blue" "&lt;div style=\"border: 1px solid #888;background:#fff;border-radius:15px;padding:3px 3px 1px;margin-left:-42px\"&gt;&lt;h4 style=\"text-align:center\"&gt;Strength Saving Throw&lt;/h4&gt;&lt;h5 style=\"text-align:center\"&gt;vs DC 42&lt;/h5&gt;&lt;table style=\"width:100%\"&gt;&lt;tr style=\"border-bottom: 1px solid #ddd\"&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371160/rvYiHJdlVcu1wTIXVXfHvw/thumb.png?1504822444" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371160/rvYiHJdlVcu1wTIXVXfHvw/thumb.png?1504822444</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 10&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (4&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll'&gt;4&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (4&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help\"&gt;8&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=\"border-bottom: 1px solid #ddd\"&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371159/H2WSET1LJkYmG9rUKs9UdA/thumb.png?1504822440" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371159/H2WSET1LJkYmG9rUKs9UdA/thumb.png?1504822440</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 9&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (4&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll'&gt;10&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (4&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help\"&gt;14&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371161/7OGrxedGY8OaFhvcZimIJg/thumb.png?1504822448" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371161/7OGrxedGY8OaFhvcZimIJg/thumb.png?1504822448</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 6&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (4&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll'&gt;4&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (4&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help\"&gt;8&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div style=\"text-align:center;margin-bottom:4px\"&gt;&lt;a href=\"!apply-damage --dmg &amp;#91;&amp;#91;0&amp;#93;&amp;#93; --type half --DC 42 --saves 8,14,8 --ids -KpvJ4GuZQ9vhskvetA8,-KpvJ3gpa-86EamROzvQ,-KpvJ4p9UCfUpNNtnV4j --status blue\ " style=\"font-weight:bold;color:#000;background:#fff;border:none;padding:0\"&gt;ApplyDamage&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;" Failing Using "Prone::2281396" "&lt;div style=\"border: 1px solid #888;background:#fff;border-radius:15px;padding:3px 3px 1px;margin-left:-42px\"&gt;&lt;h4 style=\"text-align:center\"&gt;Wisdom Saving Throw&lt;/h4&gt;&lt;h5 style=\"text-align:center\"&gt;vs DC 23&lt;/h5&gt;&lt;table style=\"width:100%\"&gt;&lt;tr style=\"border-bottom: 1px solid #ddd\"&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371160/rvYiHJdlVcu1wTIXVXfHvw/thumb.png?1504822444" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371160/rvYiHJdlVcu1wTIXVXfHvw/thumb.png?1504822444</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 10&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (-1&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll critfail'&gt;1&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (- 1&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help;border:2px solid #B31515\"&gt;0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=\"border-bottom: 1px solid #ddd\"&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371159/H2WSET1LJkYmG9rUKs9UdA/thumb.png?1504822440" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371159/H2WSET1LJkYmG9rUKs9UdA/thumb.png?1504822440</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 9&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (-1&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll'&gt;6&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (- 1&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help\"&gt;5&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=\"padding:3px;height:30px;width:85%\"&gt;&lt;div style=\"display:inline-block;height:30px;width:30px;vertical-align:middle;margin-right:4px;background:url('<a href="https://s3.amazonaws.com/files.d20.io/marketplace/371161/7OGrxedGY8OaFhvcZimIJg/thumb.png?1504822448" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/371161/7OGrxedGY8OaFhvcZimIJg/thumb.png?1504822448</a>') 0/contain no-repeat\"&gt;&lt;/div&gt;&lt;span style=\"vertical-align:middle;font-weight:bolder\"&gt;Minotaur Skeleton 6&lt;/span&gt;&lt;/td&gt;&lt;td style=\"text-align:center\"&gt;&lt;div class=\"showtip tipsy\" title=\"Rolling d20 + (0&amp;#42;(1-1)) &amp;#91;PC&amp;#93; + (-1&amp;#42;1) &amp;#91;NPC&amp;#93; = (&lt;span class='basicdiceroll'&gt;14&lt;/span&gt;) + (0&amp;ast;(1- 1)) + (- 1&amp;ast;1) \" style=\"display:inline-block;min-width:1em;font-size:1.2em;font-weight:bold;padding:0 3px;vertical-align:middle;cursor:help\"&gt;13&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div style=\"text-align:center;margin-bottom:4px\"&gt;&lt;a href=\"!apply-damage --dmg &amp;#91;&amp;#91;0&amp;#93;&amp;#93; --type half --DC 23 --saves 0,5,13 --ids -KpvJ4GuZQ9vhskvetA8,-KpvJ3gpa-86EamROzvQ,-KpvJ4p9UCfUpNNtnV4j --status Prone&amp;#58;&amp;#58;2281396\ " style=\"font-weight:bold;color:#000;background:#fff;border:none;padding:0\"&gt;ApplyDamage&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;"