Howdy, Stranger!

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

Is there a way to automatically activate a passage based on the outcome of an (either: ) macro?

With regard to Harlowe... Is there a way that the outcome of an (either: ) macro in one passage could automatically activate a subsequent passage, that is, without having to click on a link associated with the outcome of the (either: ) macro? So for example if the outcome of (either: 0, 1) is 0, is there a way to automatically activate a passage connected to 0? Hope my question makes sense.

Comments

  • Save the outcome of the (either: ) macro to a variable:
    (set: $coinFlip to (either: 0, 1))
    
    Use an (if:) macro to check the value of the variable:
    (if: $coinFlip is 0)[Whatever you what to happen when coinFlip is equal to zero]
    (else:)[Whatever you what to happen when coinFlip is not equal to zero]
    

    note: You are using the Numbers 1 and 0 to determine if something happened or not, and generally it is better to use the Boolean values of true and false to do that.

    The above examples changed to use Boolean values:
    (set: $sawBunny to (either: true, false))
    
    (if: $sawBunny)[Whatever you what to happen when sawBunny is equal to true]
    (else:)[Whatever you what to happen when sawBunny is not equal to true]
    
    (if: not $sawBunny)[Whatever you what to happen when sawBunny is equal to false]
    
    ... as you can see, the format of the (if:) macros is slightly different than when testing for non-boolean values (numbers, strings). I also included an example of how to use the not keyword to test for false.
  • Thank you. You've taught me several lessons in one!
Sign In or Register to comment.