EOS question
-
- Explorer
- Posts: 21
- Joined: Wed Jul 18, 2018 6:21 am
- Gender: Male
- Sexual Orientation: Straight
EOS question
Hey, just a couple things:
1. How do you create a tease with a "settings" choice? For example selecting different options to enable or disable. And how do you get them to show up? Is it by using multiple pages and using the choice function?
2. I can't seem to find anything but is there a guide on most used scripts or beginners scripting for eos here?
I'm self learning thanks in advance!
1. How do you create a tease with a "settings" choice? For example selecting different options to enable or disable. And how do you get them to show up? Is it by using multiple pages and using the choice function?
2. I can't seem to find anything but is there a guide on most used scripts or beginners scripting for eos here?
I'm self learning thanks in advance!
Stay safe!
My Teases
My Teases
- MisterFlames
- Explorer At Heart
- Posts: 145
- Joined: Sun Apr 29, 2018 2:44 pm
- Gender: Male
- Sexual Orientation: Straight
- I am a: Switch
Re: EOS question
Hey
I would do it like this:
to enable an option, create an 'eval':
x = 1
(sets variable x to 1)
to disable it:
x = 0
(sets variable x to 0)
Now you can use an 'if' action:
x > 0
(is variable x greater than 0?)
If the option is enabled (x=1), everything in the 'Then' section will run. If not, it will go on with the 'Else' section of the 'if'.
Of course, x is just an example. Use variables with names that make sense to you.
You can also add conditions to Choices. So you are able to toggle that option easily without using multiple pages or too many 'if' actions.
There are a few basics in the "Help" section on EOS, by the way.
I would do it like this:
to enable an option, create an 'eval':
x = 1
(sets variable x to 1)
to disable it:
x = 0
(sets variable x to 0)
Now you can use an 'if' action:
x > 0
(is variable x greater than 0?)
If the option is enabled (x=1), everything in the 'Then' section will run. If not, it will go on with the 'Else' section of the 'if'.
Of course, x is just an example. Use variables with names that make sense to you.
You can also add conditions to Choices. So you are able to toggle that option easily without using multiple pages or too many 'if' actions.
There are a few basics in the "Help" section on EOS, by the way.
- Drool
- Experimentor
- Posts: 1474
- Joined: Sat Nov 28, 2015 2:24 pm
- Gender: Male
- Sexual Orientation: Open to new ideas!
- I am a: Switch
Re: EOS question
You can find a tutorial here: viewtopic.php?f=2&t=22570
Re: EOS question
Generally, I first create an object in the Init Script that will hold all my settings, like so:
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:
(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:
(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.
Code: Select all
var settings = {
coolStuff: false,
moreCoolStuff: false,
// Keep adding more setting properties here, comma delimited like above.
};
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:
Code: Select all
!settings.coolStuff
Click on "Cool Stuff [ON]"
Flip "Always Visible" switch.
In the "Eval" box now showing under "Visible" enter:
Code: Select all
settings.coolStuff
(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());
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());
(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.
-
- Curious Newbie
- Posts: 2
- Joined: Sat May 16, 2020 5:36 pm
- Gender: Male
- Sexual Orientation: Straight
Re: EOS question
Hey there,MisterFlames wrote: ↑Tue Oct 13, 2020 2:32 am
You can also add conditions to Choices. So you are able to toggle that option easily without using multiple pages or too many 'if' actions.
maybe you can help me with that: how exactly does the code for the condition have to look like?
I know that I have to toggle the "always visible" option, and then I can enter the condition. But I can't make it work, due to my lack of programming knowledge :D
Small example: I want to create a choice with three options.
Option 1, Option 2 and Option 3.
Now, Option 1 shall be always visible (which is easy).
Options 2 and 3 shall only be visible if the player has fullfilled a certain task.
After fullfilling the tasks I can simply set a boolean variable to "true" (e.g. option2=true;)
Now: Option 2 shall only be visible, if "option2==true". But how does the correct code in the choice-script have to look like?
I hope you understand what I want to do and that you can help me :)
I am happy about every bit of help I can get!
-
- Explorer
- Posts: 87
- Joined: Wed Oct 07, 2020 11:12 pm
- Gender: Male
- Sexual Orientation: Straight
Re: EOS question
Just put something in the eval which is true when the button should be displayed.
In your case just
Other examples:
In your case just
Code: Select all
option2
Code: Select all
password == 'something'
Code: Select all
money == 5
- MisterFlames
- Explorer At Heart
- Posts: 145
- Joined: Sun Apr 29, 2018 2:44 pm
- Gender: Male
- Sexual Orientation: Straight
- I am a: Switch
Re: EOS question
Hey! :)Istratis wrote: ↑Fri Feb 12, 2021 4:50 pm Options 2 and 3 shall only be visible if the player has fullfilled a certain task.
After fullfilling the tasks I can simply set a boolean variable to "true" (e.g. option2=true;)
Now: Option 2 shall only be visible, if "option2==true". But how does the correct code in the choice-script have to look like?
Darigaaz answered the question already. I just want to add something.
Putting "option2" into the field directly checks if the boolean is true. "!option2" checks if it is false.
It's important to set "option2=false" before doing that, though. Otherwise the program won't know how to read the variable. A good way to do that is to initialize all the variables you need in your Init Script. (which always runs at the start of the program)
-
- Curious Newbie
- Posts: 2
- Joined: Sat May 16, 2020 5:36 pm
- Gender: Male
- Sexual Orientation: Straight
Re: EOS question
Thanks guys! Works perfectly now ;)
Who is online
Users browsing this forum: No registered users and 4 guests