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

ChatSetAttr: Set wtype to @{whispertoggle}

1586202016

Edited 1586202140
Cee
Plus
Using the 5e OGL sheet, browser Firefox. I have like... a lot of monster sheets that when put into the game, they don't have the default settings I want. Specifically, I'm trying to set them up with the following things: rtype to @{advantagetoggle} wtype to @{whispertoggle} whispertoggle to "/w gm " dtype to full init_tiebreaker to @{dexterity}/100 Or in simpler terms... advantage toggle on (default Normal), whisper rolls to GM on (default To GM), auto roll damage on, and add Dexterity tiebreaker to initiative. Only problem is that I can't figure out how to make roll20 stop producing "TypeError: c is undefined" when I try to use ChatSetAttr to set wtype to @{whispertoggle}. I know why, it's because I don't have a name or anything to the @{whispertoggle}. But I don't know how to make it stop asking for that, or set something that'll work. I imagine setting rtype and init_tiebreaker won't work as well. The code I was using specifically was: !setattr --allgm --wtype|'@{whispertoggle}' So, anyone know how I could do this? Or if there's a different script than ChatSetAttr that would work? I am aware that I could just set wtype to "/w gm " but it bothers me immensely on a sheet appearance level also I prefer the toggle to be on in case I need to set something to public real fast. Plus it doesn't resolve init_tiebreaker and rtype.
1586234960
Dumbhuman
Pro
Marketplace Creator
You're going to need to use the replace function so that Roll20 doesn't try to evaluate the @ instead of writing it to the ability. Try: !setattr --allgm --replace --wtype|\at{whispertoggle}
I'll try that, but can I ask: what does the "\at" mean? How is that different from just using @?
1586238388
Dumbhuman
Pro
Marketplace Creator
Also note that I added the --replace option.  From the ChatSetAttr help text: --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 ?. Normally when you enter something like @{selected|so-and-so} into chat, Roll20 immediately tries to convert it to whatever value it's referencing.  By using the --replace function in ChatSetAttr, you can remove that @ syntax from the chat window by using \at instead.  Roll20 then just sees text without some immediate operation it needs to execute, but ChatSetAttr knows to replace \at with @ in the attribute that it writes. Hopefully that makes sense or someone else has a better way of explaining it.
Ah, no that makes sense! That actually would solve my issues. Thank you so much! :)