0 votes
by (160 points)
edited by

I'll try to explain it with an example:

  1. In the story a guy is able to make a few career choices (e.g. bartender, cook, ...)
     
  2. Somewhere in the story of each career choice he'l have a hard time and have the possibility to give up. Then would follow a small piece of the story where someone tries to make him see reason. For every career choice this part of the story should be the same. 
    (e.g. he chose to be a bartender, in this second part he's in doubt but someone convinces him to go on)
     
  3. If the guy chose to go on, then the next part of the story should be based on the career choice he made in the beginning.
    (e.gthe link, in the second part of the story, that makes him go through with it should link to a part based on his bartender career choice)

How can I make the link that makes him go on with his career, in the second part of the story, jump to the next part of the story based on the career choice that was made in the beginning?

I basically don't want to make multiples of that second story part but I still want to use it in every career choice.

I'm new at twine and code, I'm using Harlowe 2.1.0

1 Answer

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

The simple answer is to use a story variable to track which career the Reader chose, then use that variable later to conditionally show the relevant text.

A more detailed answer:

1. You use the (set:) macro to assign a career related value to a story variable.

Choose a career:

(link: "Bartender")[\
	(set: $career to "bartender")\
	(go-to: "Name of next passage")\
]
(link: "Cook")[\
	(set: $career to "cook")\
	(go-to: "Name of next passage")\
]

2. You can use the (if:) macro and the related (else-if:) macro to conditionally do something in a later Passage.

Some common text....

(if: $career is "bartender")[\
Some text only related to the bartender career...
]\
(else-if: $career is "cook")[\
Some text only related to the cook career...
]\

Some more common text....

3. Use same technique as point 2 except to show a career related link instead.

(if: $career is "bartender")[\
[[Next Passage->Continue Bartender story]]
]\
(else-if: $career is "cook")[\
[[Next Passage->Continue Cook story]]
]

 

by (160 points)
Ok, thanks! I'll try it out.
by (159k points)
If my answer solves your problem can you please mark your question as answered.

This allows the people answering questions to know that they don't need to keep monitoring the question, and it lets any other person with the same (or similar) question know that there is an acceptable answer.

I believe there is a relevant button at the bottom of my answer for doing this.
...