Howdy, Stranger!

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

A link that determines whether or not you make to a new passage.

How to enter new passage while in story mode but not before I must do something that will trigger this entering of the new passage?

e.g. Go through a certain door so the story can advance, but after I click a certain link so that I can be allowed to go through the door.


  • There HAS to be a way to make a script like

    if ( x = 1 ) {
    document.getElementById("demo").innerHTML += "<br>There is a door";
    } else {
    document.getElementById("demo").innerHTML += "<br>There is just a wall";
    but since you've not been answered yet and I don't really know javascript, if it's a hurry for you, you can brute-force it, just literally duplicate every passage, changing just the door one... anyway I hope someone answers you
  • We need to know which story format and version of the story format you're using. Is there some reason a simple variable check won't work here?
  • @rafaxexe: Javascript is not needed to archive what the OP asked.

    @Dime: Basically you would do the following:

    1. Create a story variable with a default value false, this would indicate that they can't enter the 'other' passage.

    2. You would change the value of the story variable to true once the Reader has done "the something" required to allow them to enter the 'other' passage.

    3. In the passage that will contain the conditional markup link to the 'other' passage you will check the current value of the story variable and only show the link to the 'other' passage if that value is equal to true.

    As @Chapel stated, if you don't tell us the name and full version number of the story format you are using then we can't supply code examples because those examples can be different for each story format and sometimes version of story format.
  • It's the Harlowe 2.0.1 story format and the Twine version is 2.1.3
  • The following example consists of four passages:

    1. Your story's startup tagged passage, in which we initialise the $hasKey story variable using a (set:) macro.
    (set: $hasKey to false)

    2. The passage in your story you want the condition markup link to appear in, in this example it is named Hallway an it contains the following code.
    You are in a hallway
    [[Search Bathroom for key->Bathroom]]
    (if: $hasKey)[ [[Unlock Library and enter->Library]]]\
    (else:)[Locked door to Library]
    ... the above uses an (if:) macro and an (else:) macro to check the current value of the $hasKey variable to determine what to show the Reader.

    3. The Bathroom passage, in which the key required to unlock the Library is found.
    (set: $hasKey to true)\
    You enter the Bathroom and find a brass key.
    [[Return to Hallway->Hallway]]

    4. The Library passage, where the Reader wants to be.
    You enter the Library
Sign In or Register to comment.