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

Requested to change to "Concentration" API to accomedate DarkMode

Hi all, I just started using the Concentration API for my games but the responses the script generates in the chat are difficult to ready when darkmode is on. Does anyone have a workaround or suggestion to solve this?
1652652948
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The difficulty here is that at this point in time, the API has no way of knowing if dark mode is on, and the css variables that dark mode uses do not respect any inline css set up in the API. The upshot of this is that you can either make it dark mode for everyone or not dark mode for everyone. It can't display on a per-user basis. In my own API's going forward, I'm going to try to hit a gray middle ground that will not be ideal, but won't be too jarring with either. Concentration is an old and discontinued script, I'd be loathe to touch it, lest I screw something up. Also, no matter what someone does to the display, some folks will hate it.
Thanks for the reply @keithcurtis! Is there a better script that is newer that does the same thing as concentration? Thanks again
1652662411
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here's what I use. It's super simple; I don't even remember where I got it or if I wrote it myself, but it is designed to work with the D&D 5th Edition by Roll20 Sheet. You will need to change line 2 to reflect the actual token marker you are using to denote the condition amd line 3 to a different bar number if you don't use bar 1. This does not actively apply the concentrating condition though. That part is manual. on('ready', () => { const TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390"; on("change:graphic:bar1_value", function(obj, prev) {     if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) {         log ("status marker is " + obj.get(TOKEN_CONCENTRATING_STATUS_MARKER));         //let playerPage = Campaign().get("playerpageid");         //let tokenPage = obj.get("_pageid");         if (prev["bar1_value"] > obj.get("bar1_value")) {             let final_conc_DC = 10;             let 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);             }                          let tokenName = obj.get("name");                          let theMessage = "/w gm &{template:npcaction} {{rname=Concentration Check "+tokenName+"}} {{name="+tokenName+"}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "
" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|!Concentrating)*}}"; sendChat("Concentration",theMessage );                 }     } }); }); If a token has the concentration token marker on it, and the bar1 value changes, it supplies a roll template with a button to roll a con save for the selected token. You can also take off the "w/gm " if you want players to be able to use it. To get the full token marker name is easiest with the token-mod script. The help document lists them all. There are probably better solutions, but this one works for me. It's biggest draw for you is that it uses the built-in roll template, so it should obey dark mode.
Thank you for the replay and I will give this a shot!
1653361939
Victor B.
Pro
Sheet Author
API Scripter
Unless it's been updated, the concentration API doesn't support new token sets.  Hasn't been updated in years.  Again, might be wrong here. 
If using your own new token sets it very important to use  "Concentrating::35390" configuration for example I use my own icon with this name Con::5292727  and it works absolutely fine. Love the Script Thanks!!
I'm using SmartAOE API and Autobutton API and when I use them it the concentration API doesn't appear, any advice on what I could change to fix it?
Yeah, I followed the steps in Nick Olivo's recent video and I can't seem to get this API to work.  Nothing happens.  I do use a custom token set, and use one that I named "Concentration".
1659414311
Victor B.
Pro
Sheet Author
API Scripter
Concentration has been a dead script for years.  Upgrade to Combat Master or another API that does similar