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

Using ChatSetAttr to set an attribute with a pipe

1664796327

Edited 1664797042
Tara
Pro
So I'm currently working on macros to use with the chatsetattr API to toggle between the various whisper modes on the roll20 sheet, and for query whisper, I have this code: !setattr --sel --silent --replace --wtype|'\ques{Whisper\ques|Public Roll,|Whisper Roll,/w gm }' The problem is that the API is interpreting the second pipe in the macro as the pipe to move on to the attribute's max value, even though it's in quotes. The documentation does have a number of replacement options for problematic characters: --replace  will replace the characters < , > , ~ , ; , and ` by the characters [,],-,?, and @ in attribute values. This is useful when you do not want roll20 to evaluate your expression in chat before it is parsed by the script. Alternatively, you can use \lbrak, \rbrak, \n, \at, and \ques to create [, ], a newline, @, and ?. but none of them are for the pipe. I tried the html entity | and that didn't work either. I was going to try something like !setattr --sel --silent --replace --wtype|'\ques{Whisper\ques' !setattr --sel --silent --replace --wtype|@{selected|wtype}'|Public Roll,|Whisper Roll,/w gm }' //etc... but then realized I would still need to include the pipe character for that to work, so it doesn't actually solve the problem as such. I also tried setting the value '|' to the character these macros are being loaded onto and using !setattr --sel --silent --replace --wtype|'\ques{Whisper\ques@{Toggles|pipe}Public Roll,@{Toggles|pipe}Whisper Roll,/w gm }' but that didn't work either as it also interpreted the pipe in @{Toggles|pipe} as a signal to move on to the max value for the attribute.
1664797258
Tara
Pro
Nevermind, I found the solution: lower down in the documentation it says you can use | and # by escaping them with a backslash