EOS If usage

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
User avatar
rayray77
Explorer
Explorer
Posts: 68
Joined: Thu Nov 27, 2014 11:58 am

EOS If usage

Post 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:
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 552
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: EOS If usage

Post 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.
User avatar
rayray77
Explorer
Explorer
Posts: 68
Joined: Thu Nov 27, 2014 11:58 am

Re: EOS If usage

Post by rayray77 »

whoops... it's kinda obvious :blush:

Thank you very much! :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests