Nesting If Statements

kibs
11 Jun 2018, 07:22

hello! beginner here,, this is fairly simple, but i'm wondering why the return is, "Oh Null" B(

    @set met=0;
    @set gender=female
    
Hi there! I see you are {gender}! Take a look around the room!
[left], [right]

[left]:
    @set met=1;
oh.. hi i'm lucas.. 
[right]

[right]:
Oh! {if met=0:{@gender=female: Hi there!}}{else met=1:{gender=female: aww..}}```

If you've found a good way to use this with the seen option please tell, both just don't seem to work for me B(

K.V.
11 Jun 2018, 08:02

Hello.

You have some indentation issues, and some syntax errors, and you can't check a condition in your else statement. It's just "else", not "else if".

Try this (you don't indent for JS when using @set):

@set met=0
@set gender=female
    
Hi there! I see you are {gender}! Take a look around the room!
[left], [right]

[left]:
@set met=1
oh.. hi i'm lucas.. 
[right]

[right]:
Oh! {if met=0:Hi there!{@gender=female}}{else:{if met=1:aww..{@gender=female}}}

http://docs.textadventures.co.uk/squiffy/attributes.html