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

[5e Shaped] Change Output_Type

1488638949

Edited 1488639038
Hi all, I just recently upgraded to Pro, and I'm starting to wade into the possibilities of scripts and such.  I was hoping to start with a very simple script, but my searching hasn't turned up anything obvious.  Basically I want to be able to have the players click a button that changes their sheet output from public to w/gm, or back to public from w/gm.  It would also be nice if the chat window provided them a message to indicate the change. I assume this would be fairly simple - can anyone point me in the correct direction? Edit :  Also, if these is some kind of "Dummies Guides to API Scripting" - a link would be appreciated. Thanks, -Adam
1488644261
Jakob
Sheet Author
API Scripter
You can use ChatSetAttr for this. The following command should work as an ability !setattr --charid @{character_id} --output_option|?{Change output to?|Public,''|Whisper,/w GM} If you instead want it to work for selected tokens, use "--sel" instead of "--charid @{character_id}".
Thanks Jakob.  This is great. Is there anyway to bypass the prompt?  I'd like the script to check the user's current setting.  If Public, change to /w GM.  If w/GM, change to Public.  I'm concerned that the prompt could get tiresome after a while. Thanks, -Adam
1488646708
Jakob
Sheet Author
API Scripter
Yes, there is... black magic. You'll have to turn on "players can use --evaluate" for your campaign. Then you can use. !setattr --charid @{character_id} --evaluate --output_option|('%output_option%' === '') ? '/w GM' : ''
1488652215

Edited 1488652274
Jakob
Sheet Author
API Scripter
Just a note of caution, you should trust your players if you activate that option. If they know what they are doing, they can delete everything in your campaign while it's active. It needs intent, cannot happen as an accident, still..
Jakob said: Just a note of caution, you should trust your players if you activate that option. If they know what they are doing, they can delete everything in your campaign while it's active. It needs intent, cannot happen as an accident, still.. Wow, that sounds like a pretty big risk.  I guess I'll stick with the first method. Thanks for your help. -Adam
1488672774
Jakob
Sheet Author
API Scripter
Adam Caramon said: Jakob said: Just a note of caution, you should trust your players if you activate that option. If they know what they are doing, they can delete everything in your campaign while it's active. It needs intent, cannot happen as an accident, still.. Wow, that sounds like a pretty big risk.  I guess I'll stick with the first method. Thanks for your help. -Adam Well, you can always roll back your campaign to a daily backup, and it requires a combination of malicious intent and some technical knowledge. I just wanted to make you aware of the security implications for your campaign (effectively, it allows any player to run arbitrary code in your API).