0 votes
by (120 points)

I want to create conditionals based on whether the player has made a certain choice or not. For example, if you choose to make coffee before checking your email, you miss an open house. I've run into several problems: 

1) Back arrows onscreen once you've selected a choice, how do I get rid of these? Many of the choices in my game are final, you shouldn't be able to go back and change them. 

2) In this example, you end up checking your email either way but the outcome changes depending on what actions you took. 

NPR drones in the background as your kettle settles into a simmer. You hear your [[phone|1.3]] chirp from your bedroom, just as the kettle starts to [[scream.|2.0]]

If you chose phone, I want a slide to ultimately say: 

The open house is at 10? Who hosts an open house that early? Your eyes dart to the clock on your bedside table and you groan: 9 A.M. Barely enough time to take a shower and head out the [[door.|1.5]] 

If you choose scream, I want that same slide to say: 

The open house is at 10? Who hosts an open house that early? Your eyes dart to the clock on your bedside table and you groan: 12 P.M. Maybe they're still there? You forego brushing your teeth and hurry out the [[door.|2.4]]

Sorry if this is worded poorly/confusing, I'm pretty new to Twine. Thanks in advance! 

1 Answer

0 votes
by (159k points)

Back arrows onscreen

If you mean the Undo and Redo links that automatically appear in the Left blank area of the story then you have two choices:

1. If you do not plan on using the built-in ?sidebar named hook, then you can hide the whole of the Left sidebar like so.

tw-sidebar {
	display: none;
}

2. If you do plan on using the built-in ?sidebar named hook, then you can hide just the links like so.

tw-icon {
	display: none;
}

I want to create conditionals based on whether the player has made a certain choice or not

The two simplest ways to do that are:

1. Check if a particular Passage has been visited by the Reader.

1a. The Passage where the branching options appear.

[[Make coffee before checking email->Make coffee]]
[[Check email->Check email]]

1b. The Make coffee passage.

You make some coffee.
[[Check email->Check email]]

1c. The Check email Passage.
You use the (history:) macro to obtain an Array containing a list of names of all the Passages previously visited by the Reader, you use the contains operator to determine if a particular Passage Name is in that list, and you use an (if:) macro to conditionally change the contents of the Passage.

You sit at your desk and \
(if: (history:) contains "Make coffee")[take a sip of your coffee before you ]\
check your email.

NOTE: One downside of using the (history:) macro is that the number of names within the list returned increases by one each time a passage transition occurs, so the more times the Reader changes passages the larger the list become. The contains operator checks every item in the list, so the more names in the list the longer it takes to determine if a particular name is in it.

2. Use a story variable to track if something has occurred,
You use the (set:) macro to assign a value to either a story variable or a temporary variable.

2a. The Passage where the branching options appear.
You default the story variable to indicate the Reader doesn't have a coffee.

(set: $haveCoffee to false)\
[[Make coffee before checking email->Make coffee]]
[[Check email->Check email]]

2b. The Make coffee passage.
You change the story variable to indicate that the Reader now has a coffee.

(set: $haveCoffee to true)\
You make some coffee.
[[Check email->Check email]]

2c. The Check email Passage.
You use an (if:) macro to conditionally change the Passage content based on the current value of the story variable.

You sit at your desk and \
(if: $haveCoffee)[take a sip of your coffee before you ]\
check your email.

 

by (120 points)
Thank you! That worked!
...