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

Struggling using the ChatSetAttr API | Temporary HPs

Hi all. Not sure what I'm doing wrong. I'm trying to script a macro that adds temporary HP when a player uses Fiendish Vigor in 5e.  Currently using the D&D 5E by Roll20 sheet for character sheets and the latest version of the ChatSetAttr script by Jakob. I get a "no target characters" error when I attempt to use either variants of the script shown below.  The script rolls the appropriate dice and shows the appropriate verbiage in the chat message.  It even adds a hp_temp attribute to the character selected, but does not change the temporary value on the main character sheet nor the attribute field. I tried this on HP as well and it gives the same error.  I'm running the script as a GM and I have the player token selected when running the script. Version 1 &{template:default} {{name=Fiendish Vigor}} !modattr --sel --hp_temp|[[1d4+4]]!!! {{Temporary HP=$[[0]]}} Version 2 &{template:default} {{name=Fiendish Vigor}} !modattr --sel --hp_temp|{{[[1d4+4]]=Temporary HP added to @{selected|token_name}!}}!!! I'm sure I'm just missing something simple :) -Pak
1608042467
Kraynic
Pro
Sheet Author
Do you have a token selected and does the selected toke "Represent" a character sheet in the token settings?
Hi Kraynic. Yes, a token is selected when running the script.  And just double checked that the token is indeed tied to a character sheet in the token settings.  It will even add a hp_temp attribute to the character sheet in question if it's (a) not on the sheet prior to running the macro or (b) the attribute was removed by me as a test to see if it would get added again.
1608088490

Edited 1608088509
Oosh
Sheet Author
API Scripter
The --sel targeting option doesn't seem to work too well with the CSA's !inline !!! commands. Try this instead: &{template:default} {{name=Fiendish Vigor}} !modattr --charid @{selected|character_id} --hp_temp|{{[[1d4+4]]=Temporary HP added to @{selected|token_name}!}}!!!
Hi Oosh.  Thanks so much for the suggestion! Version 2 of the script I was trying to run was actually a manipulated version of an older post that you recommended to another player :) At any rate, I used your suggestion posted above and got a new error: "Attribute hp_temp is not number-valued for character Lara Firahel. Attribute left unchanged" But I took the Version 1 script and applied your --charid trick and it WORKED!!! The final line I ended up using that worked for me is shown below: &{template:default} {{name=Fiendish Vigor}} !modattr --charid @{selected|character_id} --hp_temp|[[1d4+4]]!!! {{Temporary HP=$[[0]]}} I'm not sure why the Version 2 line interpreted "hp_temp" as a non-number value...? Nonetheless.  I TRULY appreciate the assistance as well as the original inspiration you provided with your older post. Cheers! -Pak