0 votes
by (120 points)

I'm fairly new to Harlowe so this may be an easy fix. Any help is appreciated.

I'm trying to prompt the player to give the correct answer to a question presented via the (prompt: function. If they answer correctly, they should be directed to one passage, but if they answer incorrectly they will go to a different one. I'm able to assign the player's answer and the correct answer to different variables:

(set: $creature to (prompt: "He's a...", "Answer"))
(set: $correct to "Monster")

However, I don't know how to get Twine to check if the two variables have the same value or different ones. I also know how to use the (go-to function, but not where it should go given the circumstances. Any insight?

2 Answers

0 votes
by (62.7k points)

You seem to be looking for the (if:) macro. 

https://twine2.neocities.org/#macro_if

(set: $creature to (prompt: "He's a...", "Answer"))
(if: $crearure is "Monster")[
    (goto: "monster passage")
]

 

0 votes
by (156k points)

Please don't include information about the story format in the Question Title.

You can use the (if:) macro to compare the value of the two variables to determine if they are the same, and the (else) macro to handle the situation when they are not.

(set: $creature to (prompt: "He's a...", "Answer"))
(set: $correct to "Monster")

(if: $creature is $correct)[
	(go-to: "Correct Answer Passage")
]
(else:)[
	(go-to: "Incorrect Answer Passage")
]

 

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.
...