Page 1 of 1

EOS If usage

Posted: Wed Feb 19, 2020 4:51 pm
by rayray77
Hello @ all,

since I have no clue about JavaScript... And I mean 0,0 ... I don't know how to handle my following problem:

I want to make it easier for viewers to carry decisions made in one tease to the next. Get away from buttons & choices, where I list all the possible choices you made a tease (or teases) earlier. My idea was to give the viewer at the end of a path either a number (like 11) or a word (i.e. cat).
In the next tease I ask the viewer, which he got at the end of the tease and then guide him to an invisible page, which enables or disables certain pages later on.

I tried following, but it doesn't work:

Page1:
Prompt -> variable name: number
Say -> number (just out of curiosity if it works & it does. EOS display the var number correctly)

Page2:
If -> Code:'var number = 11', Then: Goto Page3, Else: empty
If -> Code:'var number = 22', Then: Goto Page4, Else: Goto Page5

Page3, 4 & 5:
Image (different pictures to identify if it worked)


Sadly the script stops, when it reaches the first If-Command.

How can I fix it? :blush:

Re: EOS If usage

Posted: Wed Feb 19, 2020 5:01 pm
by kerkersklave
This code

Code: Select all

var name = 5
declares a variable name (i.e. it defines that name to be a variable) and sets it to 5.

You want to check a variable for a value:

Code: Select all

name == 5
The == operator checks for equality and returns either true or false, that is what you need for an if-block in EOS.
The = operator stores a value into a variable. You can use that in an eval block or the initialization script to set initial values.

Re: EOS If usage

Posted: Wed Feb 19, 2020 10:42 pm
by rayray77
whoops... it's kinda obvious :blush:

Thank you very much! :-)