Linking answers in dialog box to different passages

Twine Version: 2.3.16
Story Format: Harlowe 3.2.3

Hello everybody,

I am searching for a solution to this issues for quite a while now and since I didn’t found this topic here I write a new request in hope to reach out to somebody who could help me.

I want to put a summary in between of two passages so that the player can choose whether to move on (“ok”) or first revise and possibly redo the last action (“try again”). I can change the buttons text, however I do not manage to link them to my two passages. In any case, the dialoge box will direct the player on to the next passage. I tried to store the value in boolean variable as well as directly insert a (goto:) command as in the example shown.

Anybody help? Thank you in advance.

passage 1
(link:"Moving on")[
  (dialog:"Are you sure?","Ok"(goto: "passage 2"),"Try again"(goto: "passage 1"))]

Jette

Unfortunately the dialog macro gives me an error
but you may achieve the same functionality with a confirm macro:

passage 1
(link-rerun:"Moving on")[
(set: $MoveOn to (confirm: "Are you sure?", "Try Again", "Ok"))[
(if: $MoveOn is true)[
(goto: "passage 2")
](else:)[
(goto:"passage 1")]]]

(I replaced the link for the link-rerun so it can be clicked multiple times)


Probably a more knowledgeable person can give a better answer.
Hopefully this solves the issue in the meantime

You can bind a variable to the (dialog:) macro call, which will contain the Text Label of the “button” that was selected. And you can use the fact that the (dialog:) macro effectively interrupts the processing of the Passage Content to allow you to use the (if:) family of macros to conditionally do something based on the contents of that variable.

Using a (goto:) macro to re-visit the ‘current’ Passage so you can re-process it an inefficient method to achieve that outcome, as it adds unnecessary Moments to the History system. A better method to cause the dynamic updating of the ‘current’ Passage is to combine a Named Hook with the (rerun:) macro.

The following should achieve the outcome you wanted.

Blah blah
|finshed>[
	(link: "Moving on")[
		(dialog: bind $answer, "Are you sure?", "Ok", "Try again")
		(if: $answer is "Ok")[
			(goto: "passage 2")
		]
		(else:)[
			(rerun: ?finshed)
		]
	]
]

note: Place any content you want re-processed within the finished Named Hook, before the “Moving On” link.

Hey Guys,
Thank You so much for solutions + supportive explanation!

I can adapt both suggestions and they work very well with my plot!
Besides, in the past few month I discovered a ton of new challenges, some of which I will post here soon.

I really appreciate your detailed help, thank you!
Jette