Howdy, Stranger!

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

Passage won't display in debug view

edited May 2016 in Help! with 2.0
Hello! I'm completely new to Twine/Harlowe and am generally an idiot, so I think I might be looking at multiple syntax errors or plain dumb mistakes that I haven't been able to discern.

Basically, there are various individual "states" a player can be at, and the story branches out depending on which is chosen. I wanted to write it that only the link corresponding to your current "state" would display, but when I open the passage up in debug view, it just gives me the "Double-click this passage to edit it" message.
Four years pass faster than you knew years could even go.

(unless: (either: $scholar is true, $artlar is true, $success is true, $artcess is true, $depressed is true, $machi is true, $athlete is true, $artlete is true))[(link: "Next")(goto: "defaultschool")]

(if: (either: $scholar is true, $artlar is true, $success is true, $artcess is true, $depressed is true, $machi is true))[(link: "Next")(goto: "special preschool")]

(if: (either: $athlete is true, $artlete is true))[(link: "Next")(goto: "toddlersports")]

My issue could be entirely predicated on clumsiness with code in general, so apologies if this is a stupid question.

EDIT: Formatting it like so seemed to solve my issue!
(if: (either: $scholar is true, $artlar is true, $success is true, $artcess is true, $depressed is true, $machi is true))[|specialpreschool>[(link: "Next")[(goto: "specialpreschool")]]]
(elseif: (either: $athlete is true, $artlete is true))[|toddlersports>[(link: "Next")[(goto: "toddlersports")]]]
(else:)[|defaultschool>[(link: "Next")[(goto: "defaultschool")]]]

Comments

  • edited May 2016
    note: All the examples will use the following test data:
    (set: $scholar to true)
    (set: $artlar to false)
    (set: $success to true)
    (set: $artcess to false)
    (set: $depressed to true)
    (set: $machi to false)
    (set: $athlete to true)
    (set: $artlete to false)
    

    1. When an expression (like $var is "value") is evaluated the result is either true or false.

    ex 1. in the case of $scholar is true the result would be true.
    ex 2. in the case of $artlar is true the result would be false.

    2. The (either: ) macro returns a randomly selected item from a list of items.

    In your example you are passing a list of expressions (eg. $scholar is true) to the (either:) macro, those expressions are first evaluated and then the results of each of them are passed to the macro.
    So:
    (either: $scholar is true, $artlar is true, $success is true, $artcess is true, $depressed is true, $machi is true, $athlete is true, $artlete is true)
    
    Becomes:
    (either: true, false, true, false, true, false, true, false)
    
    ... obviously the actual values being passed in your examples depend on the current values of the related variables.

    The macro will then randomly return one of the true/false items passed to it.

    3. To check multiple expressions in a single (if:) macro you need to separate each expression with either an and operator or an or operator.
    If all of the variables contains a value of true then show the link.
    (if: $scholar and $artlar and $success and $artcess and $depressed and $machi))[
    	(link: "Next")[
    		(goto: "special preschool")
    	]
    ]
    
    If any of the variables contains a value of true then show the link.
    (if: $scholar or $artlar or $success or $artcess or $depressed or $machi))[
    	(link: "Next")[
    		(goto: "special preschool")
    	]
    ]
    
  • Ah, that makes a ton of sense! Thank you so much for the answer.
Sign In or Register to comment.