Generally, I first create an object in the Init Script that will hold all my settings, like so:
Code: Select all
var settings = {
coolStuff: false,
moreCoolStuff: false,
// Keep adding more setting properties here, comma delimited like above.
};
Then, on your "settings" page, you'll add a "Choice" action, then add how ever many "Options" you'll need. I usually use two "Options" (buttons) for each setting option. One to enable to the setting, one to disable.
So for the two setting options in my example object above, coolStuff and moreCoolStuff, I would add four Options to my Choice action, with labels (without the quotes):
"Cool Stuff [OFF]"
"Cool Stuff [ON]"
"More Cool Stuff [OFF]"
"More Cool Stuff [ON]"
then add one last option:
"Back"
Then for each Choice [ON/OFF] option, we'll need to set the visibility. For example:
Click on "Cool Stuff [OFF]"
Flip "Always Visible" switch.
In the "Eval" box now showing under "Visible" enter:
(Note the leading "!". We need that for the "OFF" button.)
Click on "Cool Stuff [ON]"
Flip "Always Visible" switch.
In the "Eval" box now showing under "Visible" enter:
(Note the missing "!". We don't want that for the "ON" button.)
(Now do the same for "More Cool Stuff [OFF]" and "More Cool Stuff [ON]", but using the appropriate settings property name, moreCoolStuff.)
And now for a last pass-through on each settings choice option, you'll need to set the "Type of behavior". For example:
Click on "Cool Stuff [OFF]"
Under "Type of behavior", set it to "Custom Action"
Click "Add Action" and select "Eval"
Under the new eval enter:
Code: Select all
settings.coolStuff = true;
pages.goto(pages.getCurrentPageId());
(Note the "true". We need that to enable "coolStuff". pages.goto(pages.getCurrentPageId()) just re-loads your settings page to display the change)
Now click on "Cool Stuff [ON]"
Under "Type of behavior", set it to "Custom Action"
Click "Add Action" and select "Eval"
Under the new eval enter:
Code: Select all
settings.coolStuff = false;
pages.goto(pages.getCurrentPageId());
(Note the "false". We need that to disable "coolStuff". pages.goto(pages.getCurrentPageId()) just re-loads your settings page to display the change)
(Now do the same for "More Cool Stuff [OFF]" and "More Cool Stuff [ON]", but using the appropriate settings property name, moreCoolStuff.)
Finally, Click your "Back" option, and under "Type of behavior" set the page you want to go back to. (Maybe your "start" page, etc.)
For using these settings, it kinda depends on what you're after. But, for the most part, you'll use an "IF" action to make the decision.
For example, you could add an "if" action to whatever page you'll need to make the "Cool Stuff" decision on.
For the if's condition you would enter:
"game.coolStuff" (without the quotes).
Under the if's "then" you would add an appropriate action, like maybe a "goto" with a target page that has all the cool stuff.
Under the if's "else" you could add another action, like maybe a goto with a target page for all the stuff that's not very cool.
Note: You can replace the [OFF] and [ON] text in your option labels with alternate characters, like "

" for OFF and "

" for ON. See:
https://emojipedia.org/symbols/ for more ideas.