Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "API:Gobalconfig"

From Roll20 Wiki

Jump to: navigation, search
m (api navbar)
m
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
{{apibox}}
+
{{revdate}}{{apibox}}
 
== API - globalconfig ==
 
== API - globalconfig ==
 
{{stub}}
 
{{stub}}
Line 9: Line 9:
 
Here's a code example from the `StatusFx` script:
 
Here's a code example from the `StatusFx` script:
  
```
+
<pre data-language="javascript" style="overflow:auto;">
 
  // Get the FX configurations from the useroptions.
 
  // Get the FX configurations from the useroptions.
 
   var useroptions = (globalconfig &&  
 
   var useroptions = (globalconfig &&  
 
       (globalconfig.StatusFX || globalconfig.statusfx)) ||
 
       (globalconfig.StatusFX || globalconfig.statusfx)) ||
 
       { 'red': 'splatter-blood [1,-1]', 'green': 'bubbling-acid', 'custom': 'sleep: glow-holy|stars: beam-fire [2,3]', 'interval': 500};
 
       { 'red': 'splatter-blood [1,-1]', 'green': 'bubbling-acid', 'custom': 'sleep: glow-holy|stars: beam-fire [2,3]', 'interval': 500};
```
+
</pre>
  
 
More info in the forums:
 
More info in the forums:
Line 21: Line 21:
 
* https://app.roll20.net/forum/post/4019465/slug%7D
 
* https://app.roll20.net/forum/post/4019465/slug%7D
  
[[Category:API]]
+
[[Category:API Development]]

Latest revision as of 10:09, 17 February 2022

[edit] API - globalconfig


The `globalconfig` variable is available for use in API scripts and it is related to the `state` variable. Unlike `state`, `globalconfig` does not persist and gets reset anytime the sandbox restarts.

`globalconfig` contains key/value properties of 1-click user options.

Here's a code example from the `StatusFx` script:

 
 // Get the FX configurations from the useroptions.
   var useroptions = (globalconfig && 
       (globalconfig.StatusFX || globalconfig.statusfx)) ||
       { 'red': 'splatter-blood [1,-1]', 'green': 'bubbling-acid', 'custom': 'sleep: glow-holy|stars: beam-fire [2,3]', 'interval': 500};

More info in the forums: