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

[Help][Script] How do I test 'one click' scripts?

September 24 (8 years ago)
Ryan J.
API Scripter
I just discovered this 'one click' feature (wish I'd seen this much earlier). I've written a couple of scripts (one has been merged into master).

Documentation for 'one-click' is sparse at best. It seems like the chicken and the egg problem to me:
I want to use the one-click feature but until my script is approved and merged to master I can't use or test the one-click feature particularly `globalconfig` until the script is approved and merged into master. 
September 24 (8 years ago)
The Aaron
Pro
API Scripter
What I do to test globalconfig is create a global variable with that name and the expected structure and then start the script. It works fairly well, but can still be a bit of a pain at times. 
September 25 (8 years ago)
Ryan J.
API Scripter
Thanks for the advice. I'm looking at other existing scripts to try and figure out how to best use this. I hope that this works when my script is approved. 
September 25 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I've just gone with storing settings like that in the state and using a chat interface to have the user set them.
September 25 (8 years ago)
Ryan J.
API Scripter
Thank you all for the advice. I found this snippet in statusFx.js that can be modified in my own scripts to maybe solve this chicken/egg issue in part:

```
   // 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};
```

Is there a wiki entry that describes in detail how to use globalconfig? Like I said in my original post -- documentation for this seems rather sparse, making following best practice difficult.
September 25 (8 years ago)
The Aaron
Pro
API Scripter
I'll try to write some in a few weeks. Example is probably the best info currently. The property for your script needs to be lower case and only numbers and letters. Usually it's the name of your script. 
November 07 (8 years ago)
Ryan J.
API Scripter
I created a stub for the globalconfig variable here.
November 07 (8 years ago)
The Aaron
Pro
API Scripter
Oh, grand!  Thanks for the reminder.. I'll try and add my thoughts there.