Howdy, Stranger!

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

How to display a [hook] in Harlowe...

edited June 2015 in Help! with 2.0
Hi everyone,

(I'm using Twine 2 and Harlowe)

I am trying to work out a way to display a hook, and I am not able to solve the riddle.

I would like a previously named hook to be displayed upon clicking a different hook.

Here is a simple example:
[this is the first hook]<firstHook|
(click-replace: ?firstHook)[[this is the second hook]<secondHook|]

Up to that point, fairly straight forward. Now I want to display the first hook upon clicking the second hook, and for the first hook to be clickable again, but I am not able to do it.

I have tried the following:

This displays the first hook but not as a clickable hook:
(click-replace: ?secondHook)[[this is the first hook]<firstHook|]

The following examples all produce a blank result:
(click-replace: ?secondHook)[(print:"?firstHook")]
(click-replace: ?secondHook)[(print:?firstHook)]
(click-replace: ?secondHook)[?firstHook]



Some questions come to mind:

1. Am I trying to do something that hooks are not intended to do?
2. Is the only option to have a repeating link (as in click on firstHook displays secondHook and viceversa), through using two separate passages?

The reason I ask is that this is a very simple example involving only two hooks, whereas I am envisioning several hooks interacting with each other and cycling in certain circumstances.

Any help is greatly appreciated.

Comments

  • edited June 2015
    Have you tried setting it up as a variable and then just having the hook call the variable?

    If that doesn't work, I'll give you DOUBLE your money back.
  • Sage wrote: »
    Have you tried setting it up as a variable and then just having the hook call the variable?

    If that doesn't work, I'll give you DOUBLE your money back.

    Perhaps I am not doing it right, but I tried setting it up as a variable. This is what I did:
    (set:$firstHook to "[this is the first hook]<firstHook|")
    
    $firstHook
    
    (click-replace: ?firstHook)[[this is the second hook]<secondHook|]
    (click-replace: ?secondHook)[$firstHook]
    

    It only works the first time I click on the first hook. But when I click on ?secondHook, it only displays the TEXT of ?firstHook, not the link.

    (I've attached the html so you can see its behaviour)
  • Harlowe's Sensor Macros like (click:) and (click-replace:) are single use only, so if you want the hook to be converted into a click-able link again then you have to re-apply the sensor macro again.

    In your case this is more complex because you have more than one hook/sensor combo. Maybe something like the following for your secondHook sensor.
    (click-replace: ?secondHook)[$firstHook (click-replace: ?firstHook)[something else!]]
    
  • greyelf wrote: »
    Harlowe's Sensor Macros like (click:) and (click-replace:) are single use only, so if you want the hook to be converted into a click-able link again then you have to re-apply the sensor macro again.

    In your case this is more complex because you have more than one hook/sensor combo. Maybe something like the following for your secondHook sensor.
    (click-replace: ?secondHook)[$firstHook (click-replace: ?firstHook)[something else!]]
    

    Thanks for the code, as that does make the first hook appear again, though I would have to set the [something else!] again to the second hook, and repeat the process as many times as I would want the player to click it, whereas I was looking for an infinite option.

    Since the (click:), etc. are single use only, I'll have to work around that, possibly connecting two passages together through (display:) or something, similar to the example in the HTML I'm attaching to this post, where I use the (mouseover:) macro.
Sign In or Register to comment.