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

SET ATTR text help

I'm trying to get setattr to put a value into a new attribute but I need it to be exact text (specifically @{selected|*****} ).  Is this possible?  I am struggling to figure it out.
1619104721
The Aaron
Roll20 Production Team
API Scripter
That's going to be hard to manage because it will get expanded by the chat system before being passed to the API.  You could try encoding the @ as @ and see if that will let it slip through, but you might get @ instead of @ in the attribute: @{selected|*****}
1619109703
timmaugh
Forum Champion
API Scripter
I'm reading the ChatSetAttr code and there is a "replacers" array that seems to be triggered by the argument "--replace". It looks like if you use that in your command line, the following replacements will be enacted on your value... replacers = [ [/</g, "["], [/\\lbrak/g, "["], [/>/g, "]"], [/\\rbrak/g, "]"], [/;/g, "?"], [/\\ques/g, "?"], [/`/g, "@"], [/\\at/g, "@"], [/~/g, "-"], [/\\n/g, "\n"], ] The two that could help you are the @ replacements... looks like either a tick or a \at construction will be recognized and changed: `{selected|...} => becomes => @{selected|...} \at{selected|...} => becomes => @{selected|...} Remember, that's only if you use the "--replace" arg in the line, too. Anyway, that's just a preliminary reading of the code, but give it a try. Maybe someone with more knowledge of the script can correct me if I'm wrong.
1619110398
The Aaron
Roll20 Production Team
API Scripter
Nice Tim!