Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to tell harlowe which brackets go and which if statements go to which

I am trying to make a game that has a lot of if statements and the open brackets are linking up with the wrong closed brackets. For example (if: $variable is 1)[...(if: $other_variable < 1)[...] (else:)[...]](else:)[...] I'm not sure if this makes any sense, but I would like some help.

Comments

  • note: I reformatted your example to make it more readable, you don't need the indents and line-breaks for it to work correctly. I replaces the ... in your example with AA,BB,CC, and DD to make the explanation easier.
    (if: $variable is 1)[
    	AA
    	(if: $other_variable < 1)[
    		BB
    	]
    	(else:)[
    		CC
    	]
    ]
    (else:)[
    	DD
    ]
    
    The above works like follows:
    a. If both $variable is 1 and $other_variable < 1 are true then the output would be AABB
    b. If $variable is 1 is true and $other_variable < 1 is false then the output would be AACC
    c. If $variable is 1 is false then the output would be DD

    Did you expect your example to work differently, maybe something like the following:
    (if: $variable is 1)[
    	AA
    ]
    (elseif $other_variable < 1)[
    	BB
    ]
    (else:)[
    	CC
    ]
    
    The above works like follows:
    a. If $variable is 1 is true then the output would be AA
    b. If $variable is 1 is false and $other_variable < 1 is true then the output would be BB
    c. If both $variable is 1 and $other_variable < 1 are false then the output would be CC
  • Thank you! This really helped.
Sign In or Register to comment.