Hello. I'm new to Twine and I've been using this resource to learn about different commands.
http://twine2.neocities.org/ But, I'm not able to figure out how to set variables based on choices made by the player.
Say I give the player four speech options. I want to be able to have four different variations of another character's reply which are each based on the speech option chosen. So far, I've been able to do this by having four passages that are slightly different. But, this takes up tons of space. I'd prefer to have each speech option link to the same passage, but have four different hooks where only one is shown based on the player's choice of speech options.
I do know how to set variables, but only based on what pages are visited, and not on what choice are made.
Thank you.
Comments
One way to simulate Setter Links in Harlowe is by using a link, set, and goto macro combo like the following: You can also simulate a Setter Link is by using a hook, click, set, and goto macro combo like the following: In the Next Passage passage you can selectively show text based on the value of the variable:
Yes, the above code is for the Harlowe story format which is Twine 2 only.
And, just to be clear, I would literally write out "link", as opposed to writing something else that is the link? Then Option 1 and 2 would be the clickable options, right? That is, what the player sees on their screen.
No, I was just showing that there is more than one way to do what you wanted. Use the first method.
[quote]
And, just to be clear, I would literally write out "link", as opposed to writing something else that is the link? Then Option 1 and 2 would be the clickable options, right? That is, what the player sees on their screen.
Yes, if you look at the Harlowe documentation (which is what you linked to in your original post) you will see that the (link:) macro takes one parameter. The parameter is the text that you want link to show.
I've tried this and I'm able to make it work, which makes my heart happy. However, the arrows showing the connection to the passage in the "goto" part don't appear. Is that normal? Is there a way to fix it? Is there a way I can put in my own arrows to help me keep track?
Yes
No (well yes but if will take modifications to the application outside your control, see below)
Not sure, but I don't believe so.
The Twine 2 application currently only knows about things that are common to all story formats (such as markup links [[Passage Name]], etc), and there is currently no way for the Creator of a Story Format to influence things like syntax highlighting or what else is a link, which is why the Twine application does not know about the (link:) macro.
BTW: Because the (if:) macros in my previous post are related (and mutually exclusive) you could use the (elseif:) macro in place of the second (if:)