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

Determining if a chat message came from the GM without knowing his ID?

Can this be done? I'm trying to make a !command that only a campaign GM can use.
So make a password in the api script the GM has to use, unless this is a macro the player is going to have acess too.
Aaron has an isGM script, which is linked in pretty much all of his scripts.
Thank you manveti, just what I was looking for.
1413438932
The Aaron
Roll20 Production Team
API Scripter
Let me know if you have any questions! :)
1413454319
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Use the roll20 user ID... Found on wiki. if(apiCommand == "!owner" && roll20id == "Xxxxxx") { startProjectKillTheAaron()}
1413455918
Gen Kitty
Forum Champion
Nooooo, do not kill TheAaron! No killing one of our API gods!
1413463910
The Aaron
Roll20 Production Team
API Scripter
Stephen S. said: Use the roll20 user ID... Found on wiki. if(apiCommand == "!owner" && roll20id == "Xxxxxx") { startProjectKillTheAaron()} OP said they didn't want to have to know the player ID.
Hard coding is a big no no. :)
1413467272
The Aaron
Roll20 Production Team
API Scripter
That's a big part of why originally wrote it. The systems that existed when I did were kind of unwieldy and required a lot of manual intervention by the user,
1413474109
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
The roll20 user id can't be tricked out.... Brian suggested this a long time ago. What would be nice is if the roll20 user id was an avilabe part of the campaign object (which it has to be.)
1413476972
The Aaron
Roll20 Production Team
API Scripter
Stephen S. said: The roll20 user id can't be tricked out.... Brian suggested this a long time ago. What would be nice is if the roll20 user id was an avilabe part of the campaign object (which it has to be.) I think you're implying that my isGM script can be tricked, but I'd challenge you to try. :). You can't just check for (GM) on the end of a name because players could just set their name to include that (which is what I believe you were thinking of when you wrote that). However, you can check for (GM) on a name AND make sure it isn't on the name of the player object, which assures you it was added by Roll20 and not the player. You also must check that they aren't speaking as something else as well. My script does all of those things and caches the result by player ID, allowing fast lookups. :)
I was hoping there'd be something built in, but the API is still young; you can't have everything. I did try checking for (GM) figuring Roll20 would have a built in security function to not allow that in names .. nope. Your script does exactly what I was looking for.
1413482330
The Aaron
Roll20 Production Team
API Scripter
Good! Let me know if you are missing anything else! =D