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] SetAbility - a hack of ChatSetAttr to set abilities via chat commands

1501613964

Edited 1526029516
Jakob
Sheet Author
API Scripter
I was wondering if I could quickly hack ChatSetAttr in order to set character abilities, not attributes. Turns out I could! Rough documentation (it generally works similarly to the way ChatSetAttr does): The main commands are !setability for creating/setting and !delability for deleting abilities. The targeting options --sel, --all, --allgm, --allplayers, --charid, --name are the same as in ChatSetAttr. Other supported command line options shared with ChatSetAttr are --nocreate, --evaluate, --silent, --mute. The --replace option is available, but works differently from the way it functions in ChatSetAttr. (see explanation later) You can insert character attributes by wrapping it in double percentages, e.g. %%character_id%% will insert the character's id into the specified point in the ability. The only new option is --token, which will set the selected abilities to be token abilities. You can specify a pair of ability name and ability text by --abilityname#abilitytext . Omitting '#' will create an empty ability if none exists, and will otherwise leave the ability text unchanged (this is useful for just making actions token actions via --token). Just for !delability: --deleteall will delete all abilities for the specified characters. Code is here . Disclaimer: This is not well-tested at all, so there are probably lots of bugs! Replacers for --replace:  This has been changed from the way it works in ChatSetAttr to make it both more useful and less confusing. A table of replaced characters follows: Input Replacement \[ [[ \] ]] ~ - \q ? \at @ \p % \amp & \h # Example: The command !setability --all --token --Initiative#\p{%%character_id%%|initiative} will give all characters a token action ability called Initiative, with text %{CHARID|initiative}, where CHARID is the character's id.
Thank you Jakob- in the roll 20 multiverse are you and Aaron both heroes? Is one of you a supervillain? And if so which one? :)
1501616177
The Aaron
Pro
API Scripter
Well, one of us does have an evil twin...
woah!
1501765220
Jakob
Sheet Author
API Scripter
I've modified the script a bit to make a bit more sense, elevating it from "dirty hack" to "possibly useful". OP updated with some documentation.
The definition of useful is did it do something that helped somebody. Check that off. It helped me. So it was useful! The updates will just polish it. 
1501841129
Jakob
Sheet Author
API Scripter
Gary W. said: The definition of useful is did it do something that helped somebody. Check that off. It helped me. So it was useful! The updates will just polish it.  Awesome! Maybe what I wanted to express that with this update it can at least do things like my initiative macro example above without great hassle - I'm happy it worked for your special case, but the replacement options were a bit lacking :).