0 votes
by (380 points)

Maybe i worded the question a bit roughly, what i mean to achieve is, i have a handful of "hub" passages, they work just like the name implies, they're small hubs that you have to visit many times, and in each one they have different things to give to the PC, but what i'm trying to do is, i want certain options to only appear in those hub passages only if you pass through some certain passages first.

I was thinking of some 'if' statements that refer to the last passage, like:

<<if lastPassage is "Street 1">>
The cat comes up to you.
<</if>>

The code above is just to illustrate what i'm trying to achieve.

I searched two threads on the twine forums, but from what i read, it doesn't seem to be what i'm looking for.

This one 

And this one

What macro can i use to get the result i'm looking for?

2 Answers

+1 vote
by (38.4k points)
selected by
 
Best answer

You can just use the previous() function to get the name of the previous passage you were at.  So your sample cod would be done like this:

<<if previous() is "Street 1">>
The cat comes up to you.
<</if>>

I highly recommend just reading through the SugarCube documentation, as there are a lot of neat features that you won't know you can use if you don't at least look through it once.  (Personally, I always keep it open when working in Twine.)

Hope that helps! smiley

by (380 points)

Thank you once again for your help.

I really gotta make experimental stories just to try out every macro i see in the documentation. Believe it or not, i looked in the documentation more than once, but i got so overwhelmed because of every command i see that i don't understand, that i just stuck with what i already know.

 

Thank you once again. wink

+1 vote
by (410 points)
Perhaps you could set a variable in the first passage such as <<set $Street1 to true>> and then on the next passage have <<if $Street1 is true>>The cat comes up to you.<</if>>?
by (380 points)

I thought about doing that, but i was looking for something less messy. Luckily HiEv gave me the answer i was looking for.

Thank you anyway! yeswink

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...