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

[Script Problem] ChatSetAttr

1649111697

Edited 1649111788
I'm having an issue with ChatSetAttr not working since the last update.  When I try to update stats in the Roll205e sheet, something odd is happening.  Here is my script: !setattr {{ --sel  --replace --strength|?{STR} --replace --dexterity|?{DEX} --replace --constitution|?{CON} --replace --intelligence|?{INT} --replace --wisdom|?{WIS} --replace --charisma|?{CHR} --replace --hp|?{HP}|?{HP} --replace --ac|?{AC} --replace --passive_wisdom|?{Passive Perception}         --replace --npc|0 }} Here are the stats before I run this After I run the script and set new attributes, when I hover over the stats, they "flip" back to 10???  When I set it by hand it works fine Also AC and HP values never change when I try to set them.  This all used to work wonderfully
1649130373
Oosh
Sheet Author
API Scripter
There's definitely something screwy going on with the sheetworkers triggering. But you probably also want to look at all the stats involved: @{strength_base} + @{strength_bonus} = @{strength} @{strength_base} is the one you should probably be setting (and the one visible on mouseover), though that's not triggering the sheetworker when set via CSA - not sure why. So you'll need to manually set @{strength} as well. If this is a fresh character, @{strength_bonus} should be 0, which makes it easy enough: !setattr {{ --sel --strength|?{STR} --strength_base|?{STR} }} Just set the total and base to the same amount. By the way, you don't need the --replace flag unless you're replacing certain control characters. I'm not sure what the issue with ac/hp is, as they work for me. However, passive perception and AC are both derived stats, you wouldn't normally set them manually on this sheet. Are you using homebrew rules for those? Make sure you turn off AC tracking if you are. As for passive perception, that's handled by a sheetworker and doesn't have a switch as far as I know. If a player's wisdom changes, their PP will change automatically.
Ok- I thought I was going crazy. I'm setting repeating_npctrait and opening/closing the sheet is causing the descriptions of them to vanish.
1649288231
Oosh
Sheet Author
API Scripter
That sounds like a corrupt rep row. Can you get a report of the attribute names it's creating?
Here are the two vaules attr_show_desc   value="@{description}"   value=" "
1649304019

Edited 1649304178
For me, I'm actually writing a script to create and populate character sheets (D&D 5E by Roll20) for NPCs. After the sheet exists repeating attributes are created by using a sendChat with the gathered data to create them. Here is the output in chat and that section of the sheet the first time opening it: Here is the sendChat (with the variables still that have the actual data):  sendChat('','!setattr-mod --charid ' + characterId + ' --repeating_npctrait_-CREATE_name|' + namee + ' --repeating_npctrait_-CREATE_description|' + tDescr); Closing and opening, or using the Edit button and either saving or cancelling will cause one after the other to vanish. Sometimes the first time I open a sheet it is fine.
So, for me it seems to be an issue with not opening a sheet before adding Traits (or reactions which are the same format). So long as I create me sheet, open it, then add Traits then I don't have this issue. Hope it helps anyone else with the issue.
Most of the time refreshing the game, by refreshing the browser, restarting the API or logging out then back into the game fixes it. 
Kilter said: Most of the time refreshing the game, by refreshing the browser, restarting the API or logging out then back into the game fixes it.  Interestingly enough, I specifically tested all three of these and it wouldn't fix it. You need to have the sheet load.
1649484576
Oosh
Sheet Author
API Scripter
That's probably another one for the Lazy Loading bug list.