0 votes
by (130 points)
Hello! I'm new to Twine and I was wondering, 1. Is it possible to make a link that goes back to the start? And 2. If so, is it possible to change/add a link while still in game? (For example, if you made a certain decision, then it would "unlock" a different option.) Thanks!

2 Answers

0 votes
by (23.6k points)
You'll have to give us the full version number of Twine and the Storyformat you are using.
by (130 points)
Version: 2.2.1

Storyformat:???
+3 votes
by (159k points)

I suggest you read the How to Choose a Story Format section of the Twine Wiki to learn what a story format is. I will assume you are using the default story format which is Harlowe v2.1.0 who's manual can be found here.

You can use a story variable to track if a particular event or action has occurred and then later test the current value of that story variable to determine if a particular outcome should occur.

1. The following example uses a (set:) macro to initialise an $unlocked story variable to be Boolean false within your project's startup tagged special passage, if you don't already have such a passage then:
a. create a new passage and assign it whatever name you like, I suggest Startup.
b. assign this new passage a startup tag (all lowercase and no space characters)

(set: $unlocked to false)

2. The following example uses a (link:) macro to allow the Reader to unlock the locked item, this is achieved by changing the $unlocked story variable's value to true.

(link: "Unlock the item")[
	(set: $unlocked to true)
]

3. The following example uses an (if:) macro to determine if the item has been unlocked or not, this is done by testing if the $unlocked story variable currently equals true.

(if: $unlocked)[The item has been unlocked!]

... you can also use the Boolean not operator to test if the $unlocked story variable currently equals false as the following example demonstrates.

(if: not $unlocked)[You still need to unlock the item!]

...make a link that goes back to the start?

Yes. Assuming that your start passage is named Start then you could use either of the following links to return to that passage. The first example uses a Markup based link and the second uses a (link:) macro combined with a (go-to:) macro.

[[Return to the start->Start]]

(link: "Return to the start")[
	(go-to: "Start")
]

...however, the above will NOT cause the story variables to reset to their initial values!

If you truly want you allow the Reader to restart the story afresh then I suggest using the (reload:) macro to do that like so.

(link: "Restart the story")[
	(reload:)
]

 

by (130 points)
edited by
Thank you very much! This is very detailed and I'm sure that it would be very helpful, the problem is, I don't understand. I apologize as sometimes I am clueless. But would you maybe type in these certain code snippets? I don't know. Thank you!
...