Hello - probably a very stupid question, but this is Day One for me so it's bound to be!
Midway through my game, I have the user prompted to enter their name. If they have received a clue early on, I would like them to receive additional options if they enter a specific name. Let's say the name that will open an additional option is 'gimli'. So far I have:
---
(set: $name to (prompt: "Text asking the player to enter their name"))
You are (print: $name).
(if: $name = gimli)
newpassage](else:)
usualpassage]
---
I've tried putting in more, and fewer, brackets, but the result is the same - I get a screen with the attached image.
--
If you are able to help me, please do - I've got a lot of other things working, but this is confusing me horribly.
Very grateful for your help,
Frog
Comments
1. As stated in the (prompt:) macro documentation, the value returned by that macro is a String. This means that any value you compare to your $name variable also needs to be a String.
2. In TwineScript (and Javascript) a single equals sign = operator is used to represent assignment, whereas a double (or triple) equals sign == (===) operator is used to represent comparison. Using the wrong equal sign operator is a common mistake so Harlow suggests using the to operator (for assignment) and the is operator (for comparison) instead.
This means that the expression in your (if:) macro is trying to assign the value gimli (of unknow data type) to your $name variable and you are getting the "not define" message because Harlowe cant find something defined gimli.
The following is a corrected version of your example: