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

Detect You're in a Beacon Sheet

1751900532
GiGs
Pro
Sheet Author
API Scripter
There are somethings that have to be done differently in Beacon sheets, so what is the easiest way for a script to recognise it is in a beacon sheet?
1751940645
timmaugh
Forum Champion
API Scripter
(Sorry, I wrote a script for this and thought I'd released it already, but some searching showed I had not.  I've remedied that, now.) I have a very basic script I based on some test code Aaron shared for Beacon functionality. The script is very simple... it's named isBeacon, and it exposes a single function of that exact name. With this script installed, you can call isBeacon() from your code, and pass in a character name, character ID, the ID of a token which represents a character, or the name of a sheet: if(isBeacon('Bob the Hirsute')) {   // ... true/Beacon case } else {   // ... false/legacy case } It's in the pipeline for the one-click, but you can find it in my repo if you want it more immediately.
1751944017
GiGs
Pro
Sheet Author
API Scripter
Thanks Tim, that sounds great.