Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to imbed hooks within a link?

Hi,

Sorry if this is a super obvious question, but I'm new to this and have no experience writing code. I want to create links within my story and set/change variables I've created based on what the player clicks. So for example, a player has a conversation early in the game that affects his possible destination later on. He then makes a choice about the mode of transportation to get there, something like:

transit(set: $destination to "cafeA")
transit(set: $destination to "cafeB")

on the transit page, the player chooses a method of transportation, something like

subway
car
bike

with each of these story options being the same, no matter whether they chose cafe A or cafe B. When they finish their trip, I was then hoping to run a script that gave them appropriate options when they exit the subway/car/bike based on the earlier location they chose, so if the variable $destination was set to cafeA, it links to one story branch but not the other. My problem is that writing the variables like

transit(set: $destination to "cafeA") doesn't imbed the hook inside the link and run it only when it's clicked; it simply runs it when I reach that page.

Hope that makes sense, any help is greatly appreciated.

Comments

  • You need to state which story format you are using when you ask a question, as answers can be different for each one. Based on your question about hooks and your examples I am going to assume you are using Harlowe.

    In Harlowe you can use a combination of a (link:), (set:), and (goto:) macros to create what is commonly called a Setter Link.
    (link: "I'll meet you at cafe A")[(set: $destination to "cafeA")(goto: "transit")]
    (link: "I'll meet you at cafe B")[(set: $destination to "cafeB")(goto: "transit")]
    
Sign In or Register to comment.