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?

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.
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...