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

Trying to change advantage with ChatSetAttr

1532466297

Edited 1532466330
I'm sure I'm missing something simple here. I've read through the latest thread back a year though and didn't seem to find how to toggle advantage, disadvantage, etc. on the 5e OGL Character Sheet. For reference, I'm using the toggle option by default on all NPC sheets. That causes the rolls to reference an attribute called  advantagetoggle. So I have created 3 macros listed below. I am trying to mass-apply this to multiple selected NPCs silently. The only feedback I get is the name of the macro calling it like #Roll Advantage in chat,. Othertimes I get an error message in chat like so:  TypeError: Cannot read property 'substring' of undefined I've copied the macros into notepad and pasted them into the macros and saved them never to have them opened again, still doesn't work. I also have the option on the api script sheet set to update sheet workers. I've also done the macros with and without the apostrophes. Any ideas what I'm doing wrong here? Roll Advantage !setattr --sel --silent --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=[[@{d20}' Roll Disadvantage !setattr --sel --silent --advantagetoggle|'{{query=1}} {{disadvantage=1}} {{r2=[[@{d20}' Roll Normal !setattr --sel --silent --advantagetoggle|'{{query=1}} {{normal=1}} {{r2=[[0d20'
1532466635

Edited 1532466702
Jakob
Sheet Author
API Scripter
Try using --replace and replacing the "@" in your macro by "\at", and possibly the "[" with "\lbrak".
Thank you thank you thank you thank you! Works perfectly!
Quick question, to ensure to the rtype property is set correctly, should I use !setattr --sel --silent --replace --rtype|'\at{advantagetoggle}' !setattr --sel --silent --replace --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}' or !setattr --sel --silent --replace --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}'  --rtype|'\at{advantagetoggle}'
1532468332
The Aaron
Pro
API Scripter
This is likely failing because of the {{ }} parts. In the API, we steal the {{ }} syntax to allow us to have nice multi-line api commands.  We do this by substituting for them on the parsing side and then getting rid of them.  In all likelihood, your command gets interpreted as: !setattr --sel --silent --advantagetoggle|' query=1 advantage=1 {{r2=[[@{d20}' You might be able to get around this by HTML escaping some of them: !setattr --sel --silent --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=[[@{d20}' But I don't know if that will work with the character sheet side of things.
1532468409
The Aaron
Pro
API Scripter
Or that.  =D  That was gonna be my second guess. =D
1532468859
Jakob
Sheet Author
API Scripter
Jeremy said: Quick question, to ensure to the rtype property is set correctly, should I use !setattr --sel --silent --replace --rtype|'\at{advantagetoggle}' !setattr --sel --silent --replace --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}' or !setattr --sel --silent --replace --advantagetoggle|'{{query=1}} {{advantage=1}} {{r2=\lbrak\lbrak\at{d20}'  --rtype|'\at{advantagetoggle}' Either way works, I would use the second one, since it is probably going to be marginally faster.
worked great the second way, and less to keep track of. This is a fantastic mod, thanks so much!