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

A button that only works for the GM

Hi there, Is it possible to create on a character sheet a button (<button></button>) that does something only if it is the GM that presses it ? I want to create a sheet for my player and one for my NPC. Since I can upload only one HTML file, I plan to add a button that allows switching from one format (for the players) to the other (for the NPC). It would be great if only the GM could do this switch. Best regards.
1645700153
Andrew R.
Pro
Sheet Author
That’s a question for the Character Sheet forum. It’s not a good idea to use the API with Character Sheets because it restricts them to Pro subscribers.  The quick answer is that many Character Sheets support PC mode and NPC mode and other modes as well. 
1645705086

Edited 1645705289
GiGs
Pro
Sheet Author
API Scripter
As Andrew hints, you can only do this with the API. The character sheet doesnt have any knowledge of players in the game, so can't identify who is a GM.To do that you need to use an API script. Even with a pure API script, I don't think there's any way to create such a function that players couldnt also trigger: you could die it to a hidden attribute, maybe, and use a script like chatSetAttr to alter that attribute value, then you'd have a sheet whose format could be changed only with an APi script. I'm not sure that's a good idea. Bear in mind if you create a sheet with two tabs, one for player and one for GM, they will still be separate sheets. The play has the player one, and can switch to GM to see what a blank sheet looks like, but they wont know what values the actual GM places on their sheet.
1645727608
vÍnce
Pro
Sheet Author
This would probably only work for a custom game, no API required; but you probably could "hide" a button/checkbox within the sheet's html that only you would know where it's located. An Easter egg if you will... Once clicked, it would reveal additional sections, options, etc.
1645857550
Oosh
Sheet Author
API Scripter
That's a tricky one - none of the useful global attributes (like "Controlled By") are accessible via CSS selectors, or from the character sheet sandbox (AFAIK). But since all character sheets are born as "Gm only", your best bet might be to put in a button which locks the sheet for player use via a hidden attribute. To unlock it again, you can either use an Easter Egg approach as Vince suggested, or manually reset the attribute value. API is cleanest, but it's also possible with devTools if the Roll20 subscription lapsed. If you wanted to make the sheet public, it can't rely on the API, and you would have to document whatever method is used to unlock sheets. A cleverer solution might exist that would tick all the boxes. I did have a quick look to see if any id's or classes on the base page have a GM flag to hook with a CSS selector, but couldn't see anything. I'm also unsure if using a selector on body even passes the character sheet verification step.