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

How to add affected character name to Script output

I'm using the simple concentration script called out by Keith Curtis here: <a href="https://github.com/keithcurtis1/Concentration" rel="nofollow">https://github.com/keithcurtis1/Concentration</a> and I would like to add the name of the affected character to the top of the message which is ouputted. Because no token is selected, I don't know how to do this. I'm sure it's fairly straightforward if you know what you're doing in Javascript - I'm ok working within macros, but APIs are clearly a step too far for me atm! Thanks for your help :-)
1598973465
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Quick question: how is it that no token is selected? The script looks for the existence of a concentration marker on&nbsp; a token that has just had its HP reduced. If no token is selected, it should not be able to trigger.
If using the GroupCheck with ApplyDamage for example? Or perhaps my naivety means I don’t understand the sequencing in how those macros work!&nbsp;
1598973726
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah. I hadn't thought of that case. I'd have to run some tests, since I'm not sure how they interact.
1598974557
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, it looks like the way that Apply Damage alters the HP total is not recognized by that Concentration script. It doesn't work with the TempHP script that puts a bloodied or dead marker on a token either. I'm actually not sure what would need to be done. I'll reach out.
Thanks for the help. Is there a simple line for the majority case where it is applied with a token selected?
1598979941

Edited 1598980348
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oh, sure. Change the Sendchat line to sendChat("TokenDamage", "/w gm &amp;{template:npcaction} {{rname=Concentration Check}} {{name=@{selected|character_name}}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "&amp;#10;" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|!Concentrating)*}}");&nbsp; &nbsp; &nbsp; &nbsp; } EDIT. That didn't work. I'll have to look into it later when I have time.