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

Concentration & DeathTracker APIs to use non-standard token markers

Good afternoon, all. I use CombatMaster (concentration reminder turned off), DeathTracker , and Concentration to make my life as a DM so much easier. CombatMaster has a setting that lets you choose which token marker set (if you've purchased any non-standard or have custom) you want to use for conditions. All DeathTracker and Concentration threads I've been able to find are all 2+ years old as is the last post by their creator, "Robin". I know just enough about coding to be dangerous... but is there a way to implement this customization into DeathTracker (for the "bloodied" icon) and Concentration (for the "concentration" icon) APIs that wouldn't totally screw them up? In my ignorance, I'd assume a copy/paste of the right code in the right place would work, but I would hate to single-handedly crash Roll20's API VMs by causing an infinite loop or something.... because I know my luck! Thank in advance, Agnati
find the part in the script and change the default to the icons you wish to use like the follow        setDefaults = (reset) => {             const defaults = {                 config: {                     command: 'dead',                     death_statusmarker: 'dead',                     half_statusmarker: 'Bloodied::243574',                     massive_damage: true,                     bar: 1,                     firsttime: (reset) ? false : true,                     pc_unconscious_statusmarker: 'Dying::243507',                     change_player_tint: false,                     change_npc_tint: false,                     fx: true,                     fx_type: 'splatter-blood',                     heal_fx: false,                     heal_fx_type: 'glow-holy'                 }             };
Kilter said: find the part in the script and change the default to the icons you wish to use like the follow        setDefaults = (reset) => {             const defaults = {                 config: {                     command: 'dead',                     death_statusmarker: 'dead',                     half_statusmarker: 'Bloodied::243574',                     massive_damage: true,                     bar: 1,                     firsttime: (reset) ? false : true,                     pc_unconscious_statusmarker: 'Dying::243507',                     change_player_tint: false,                     change_npc_tint: false,                     fx: true,                     fx_type: 'splatter-blood',                     heal_fx: false,                     heal_fx_type: 'glow-holy'                 }             }; Yep, that's exactly what I do for DeathTracker. Maybe you're even the one who pointed me in this direction a few months ago! :)
1604601333
Victor B.
Pro
Sheet Author
API Scripter
Concentration is already built into CombatMaster but shouldn't conflict with Concentration script
Victor B. said: Concentration is already built into CombatMaster but shouldn't conflict with Concentration script I actually hadn't even noticed that option (which is weird as long as I've been using CM) until a few days ago. I haven't tested  it, but it looked as though it only gave a reminder to manually roll a con save. Is that the case? Because I spent some hours  looking for any information about editing any of the three below APIs to use a non-standard token marker, I figured I'd post my finished work. So I solely use the " Easy to Read Token Marker " set, but this should work for any marker set. I added the following API manually to find the #:Name of each of the tokens. Run "!markernames" and it'll output them all into chat (publically if it matters to you). Also note that I had to copy the github code for each of the below API's I was trying to modify and manually add it as a new API. Normally I'd have to remember to check for version updates and redo these changes, but the creator hasn't been on Roll20 in 2 years, so I doubt there will be any. Also-also, after introducing the new code, I had to run the different API's config command in the Roll20 chat and click the "Reset" at the bottom, then my custom changes showed correctly. You will, however, have to restart the API sandbox after resetting them, then you're good to go!! Install the MarkerNames API into your game and run !markernames in the game's chat. Make note (copy/paste into notepad or whatever) the "243651:Concentrating" marker you want to use (note that in the API, it'll have to be rearranged to "Concentrating::243651" with two colons) Grab the github code for the desired API ( Here is the GitHub repository of RobinKuiper's APIs, all of the ones I wanted to customize came from them) Paste it into a new API script in your campaign With your cursor in the API code window, you can Ctrl+F to search for something specific from the appropriate code at the bottom of this post (just copy/paste) within it to easily find the sections mentioned below these steps, example:  setDefaults = (reset) => { const defaults = { config: { command: 'concentration',     6. Run the API's config command, usually with no  tokens selected ("!inspiration", "!concentration", & "!dead config" for the ones below)     7. Click the Reset option at the bottom of the config options     8. Restart the API Sandbox. MarkerNames on("ready", () => { const tokenMarkers = JSON.parse(Campaign().get("token_markers")); const getChatMessageFromTokenMarkers = markers => { let chatMessage = ''; _.each(markers, marker => { chatMessage += `<p><img src='${marker.url}'> ${marker.id}: ${marker.name}</p>`; }); return chatMessage; }; on("chat:message", msg => { if(msg.content.split(" ")[0].toLowerCase() === '!markernames') { let chatMessage = getChatMessageFromTokenMarkers(tokenMarkers); sendChat("Token Markers", chatMessage); } else if(msg.content.split(" ")[0].toLowerCase() === '!markerids') { const markerName = msg.content.split(" ")[1].toLowerCase(); let results = []; _.each(tokenMarkers, marker => { if(marker.name.toLowerCase() === markerName) results.push(marker); }); log(results); let chatMessage = getChatMessageFromTokenMarkers(results); chatMessage = chatMessage || 'Unable to find any matching token markers' sendChat("Token Markers", chatMessage); } 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(',')); } else if(msg.content.split(" ")[0].toLowerCase() === '!gettokenmarkers') { if (!msg.selected) return; if (msg.selected[0]._type !== "graphic") return; obj = getObj(msg.selected[0]._type, msg.selected[0]._id); currentMarkers = obj.get("statusmarkers"); sendChat("Token Markers", currentMarkers); } }); }); Concentration API setDefaults = (reset) => { const defaults = { config: { command: 'concentration', statusmarker: 'Concentrating::243651', bar: 1, send_reminder_to: 'everyone', // character,gm, auto_add_concentration_marker: true, auto_roll_save: true, advantage: false, bonus_attribute: 'constitution_save_bonus', show_roll_button: true }, advantages: {} }; InspirationTracker API setDefaults = (reset) => { const defaults = { config: { command: 'inspiration', statusmarker: 'BardicInspiration::243623', fx: true, fx_type: 'nova-holy' } }; DeathTracker API setDefaults = (reset) => { const defaults = { config: { command: 'dead', death_statusmarker: 'dead', half_statusmarker: 'Bloodied::243574', massive_damage: true, bar: 1, firsttime: (reset) ? false : true, pc_unconscious_statusmarker: 'Dying::243507', change_player_tint: false, change_npc_tint: false, fx: true, fx_type: 'splatter-blood', heal_fx: false, heal_fx_type: 'glow-holy' } }; I'm a 20-year IT tech but still sucking my thumb when it comes to coding, but if anyone reading this can't figure it out, please feel free to PM me. Hopefully  these instructions will keep someone else from spending hours searching 2-year-old posts and then still needing to take the time from the code geniuses like Kilter and Victor above, which I sincerely appreciate their help!! 
1604718959
Victor B.
Pro
Sheet Author
API Scripter
Yes CM doesn't roll the actual Con Save.  I stopped short of that, but it notifies.  It also doesn't remove concentration if they fail roll.  Again, I didn't feel like going there.  
Victor B. said: Yes CM doesn't roll the actual Con Save.  I stopped short of that, but it notifies.  It also doesn't remove concentration if they fail roll.  Again, I didn't feel like going there.   No worries. I appreciate the response nonetheless!
1604721252
Victor B.
Pro
Sheet Author
API Scripter
I didn't want to take agency from the players.  They want to roll 
combatmaster supports the use of libTokenMarkers, and thus supports custom Token Markers. No need to edit it. Only thing that made some Problems for me was having spaces in token names, I had to reupload the custom tokens I used, and rename them, so they worked nicely, but Victor is aware of that.
You're correct, Sven. CombatMaster allowing me to change the token set used is what gave me the itch to do it to the other APIs that auto-marked tokens. CM for the win!
Agnati said: You're correct, Sven. CombatMaster allowing me to change the token set used is what gave me the itch to do it to the other APIs that auto-marked tokens. CM for the win! Hmm, should wait till I'm fully awake before posting,next time ^^
1604760878
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Agnati, First, thanks for the plug ;) Second, thanks for the script. If all you need is token marker ids, there is another script that can help, and most people have it installed. The help documentation for Token-mod updates to list all of the token markers in the game, alongside their full ids.
Ah yes, keithcurtis, speaking of coding geniuses :) That would definitely have saved me a couple steps since I already have TokenMod running. Thanks for the tip!