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

[Help] Chatsetattr

I am not sure if this is the right API to be trying this on, but I am looking to setup abilities like a monk's stunning strike or a sorcerer's quicken spell to be a macro in the "Attacks and Spellcasting" section of the Roll20 OGL Character Sheet so that when a player uses "Stunning Strike" it will show the spell save DC, as well as deduct 1 Ki point (easily done with ammunition) or more difficultly deduct 2 points for a "Quickened Spell" for a sorcerer. !setattr --charid @{CHAR_NAME|character_id} --mod --class_resource|-2 --silent works as a regular macro, but I can't figure out a way to get it to work as part of the attack roll, if I put that text chain into an attack's description it doesn't work. Adding a button with [Spend Sorcery Points](!setattr --charid @{character_id} --mod --class_resource|-2) is my current workaround, but I am looking for a way to automatically spend the points if possible.  Thanks!
1591019854
GiGs
Pro
Sheet Author
API Scripter
The ammo script is better for chatSettAttr for things like this, is spending resources is exactly what it was designed for. They dont actually have to be ammo. You might not be able to add API script commands to rolltemplates like those used by the attacks and spellcasting section. Though try ammo, it might work. If not, you'll have to copy the attack and put it in an ability on the Attributes and Abilities tab. You can get the attack  by rolling it so it outputs into chat, then position your cursor in the chat box and pressing the UP arrow. Copy whatever is there now to a new Ability, and then paste the api script to the bottom of the ability text, on a new line. You can set this ability as a Token Action so its always available to the player when they have their token selected. It's a bit tedious if you have to do this with multiple abilities though.
Is there a way to use the ammo script to deduct 2 points (or a customer number) at a time instead of always being 1? I couldnt figure out how to do that if so
1591020187

Edited 1591020299
GiGs
Pro
Sheet Author
API Scripter
Yes, there is! !ammo <character_id> <attribute name> <amount> [resource name] character_id  -- Usually gotten with @{character_id} while in the character sheet, or could be hard coded, or used with @{selected} attribute name  -- This is the name of the attribute, no @{ }. amount  -- usually -1, for using one charge.  Can use inline rolls or roll queries to determine it. resource name  -- Anything else on the command line is used as the name of the resource.  Omitting it will use "ammo" instead. Your example above would be !ammo @{CHAR_NAME|character_id} class_resource -2 You can add a name for the resource at the end there, like !ammo @{CHAR_NAME|character_id} class_resource -2 Ki I'm not familair with the sheet - if there's a field for the class_resource, you can put that there instead !ammo @{CHAR_NAME|character_id} class_resource -2 @{CHAR_NAME|RESOURCE_NAME} I think the cost can be an attribute reference too.