Login
Remember
IF Answers
Ask a Question

# Twine: Is there a macro or something to automatically go to another passage?

0 votes
1,856 views
asked Apr 8 in Authoring by peterorme (104 points)

Playing around with Twine 1.4, I was looking for something like

    <<if (some condition)>>
        <<goto "passage">>
    <<endif>>

Is there some way to do this, or some other pattern for doing this?

- twine

## 1 Answer

+2 votes
answered Apr 10 by RobinMarx (38 points)
selected Apr 15 by peterorme
Best answer

At least in Sugarcube, the syntax would look like:

    <<if (condition)>><<goto "Passage Name">><</if>>

or

    <<if (condition)>><<goto [[Passage Name]]>><</if>>

Source: SugarCube Macro Library

commented Apr 10 by peterorme (104 points)
Oh, awesome! So cool that what I was just pseudo-coding (<<goto "passage">>) is exactly how it works in sugarcube.
Actually I was not getting this Sugarcube thing at all, I was confusing the built-in _sugarcane_ story format with the _sugarcube_ format that you need to install yourself. For the record, what you need to do is
* go to [sugarcube](http://www.motoslave.net/sugarcube/) and download the latest version
* unzip it (I renamed the resulting `sugarcube` folder to include the version number)
* and place that folder in the folder "formats" in your twine1.4 installation
* in Twine, select Story > Story Format > sugarcube
(Edit: oh, markdown does not work in comments...)
commented Apr 20 by Taizo (1 point)
Similar to the original question,
I want to set a cheat code/password prompt that "goto" other passages.
This is what I have and it continues to send the player to "Passage 2" regardless of what answer is given.
<<set $answer = prompt ("question")>>
<<if ($answer= "Answer 1")>> <<goto "Passage 1">> <</if>>
<<if ($answer= "Answer 2")>><<goto "Passage 2">> <</if>>
How do I make it work?
commented Apr 21 by Alex (486 points)
Don't ask questions in comments, please post a separate question.

## Related questions

- How can I add changing maps or inventories to a Twine game?
- Twine: how can I check if a passage has been visited?
- Is there a way to turn Squiffy passage links into a regular link for accessibility purposes?
- Is there a standard way to deal with stacks of items, i.e., having 13 health potions or 6 flowers?
- Where does Twine delete stories to?

...