Difference between revisions of "Script:GM Code"
From Roll20 Wiki
(→Syntax) |
Andreas J. (Talk | contribs) (tagged as "discontinued API") |
||
(One intermediate revision by one user not shown) | |||
Line 51: | Line 51: | ||
}); | }); | ||
</pre> | </pre> | ||
+ | [[Category:Discontinued API Scripts]] |
Latest revision as of 15:24, 17 June 2020
This script has been deprecated due to changes currently on the Dev Server |
Version: 1.0
Last Modified: 2015-01-07
Code: GMCode
Dependencies: None
Conflicts: None
GMCode generates a unique code to authenticate the GM. The code may then be used to identify the GM for elevated privileges in other scripts.
[edit] Syntax
!gmcodehelp
!gencode [code]
!clearcode [code]
!custcode [code <new code>]Formally:
S
→ gmcodehelp
S
→ gencodeoptional code
S
→ clearcodeoptional code
S
→ custcodecode change
code change
→ ε
code change
→code
code
optional code
→ ε
optional code
→code
code
→ integer
Parameter | Values |
---|---|
code | Optional if no GM code exists, required otherwise. The value of the generated code, which can be seen in the API console log. |
new code | Value to change the GM code to. |
If no GM code exists, the code parameter is optional in all of the above commands, and the script will generate a new code if it is omitted (regardless of which command besides !gmcodehelp
is used).
!gencode
will regenerate the GM code, while !clearcode
will wipe the code out and !custcode
will set the code to a specified value.
[edit] Example
The GM code is useful for verifying that the user has GM permissions, as the only means to see the code is in the API console log, which is only accessible by a GM. The value of the GM code can be accessed with state.gmcode
, which you can then compare against user input to verify identity, similar to a PIN.
on('chat:message', function(msg) { var parameters = msg.content.splitArgs(), command = parameters.shift().substring(1).toLowerCase(); if (msg.type === 'api' && command === 'mycommand') { if (state.gmcode && parameters[0] === state.gmcode) { // GM authenticated } } });