Advertisement Create a free account

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

1474750923
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. 
1474753709
The Aaron
Forum Champion
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. 
1474795840
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. 
1474809773
Scott C.
Forum Champion
Sheet Author
API Scripter
I've just gone with storing settings like that in the state and using a chat interface to have the user set them.
1474837270
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.
1474842801
The Aaron
Forum Champion
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. 
1478554259
Ryan J.
API Scripter
I created a stub for the globalconfig variable  here .
1478554779
The Aaron
Forum Champion
API Scripter
Oh, grand!  Thanks for the reminder.. I'll try and add my thoughts there.