Howdy, Stranger!

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

Cycling link that affects another link (Harlowe)

Hello! I'm pretty new to Twine, and using the forums I was able to figure out a simple cycling link, but now I've run into some difficulty with a slightly harder problem.

I want to have a link to a certain passage -- in this case, called "out" -- only accessible if certain conditions are met.

The code I'm failing at looks like this:
According to the sundial, [it's an hour after sunrise]<time|.

out]<outside|(click: ?wait)[(replace: ?outside)[(display: "outsideLogic")]]
[Wait.]<wait|(click: ?wait)[(replace: ?time)[(display: "Logic")]]

"Logic" is exactly the "Logic" passage from this forum post: http://twinery.org/forum/discussion/4641/very-basic-question-about-cycling-links-in-harlowe with the phrases changed as appropriate ("noon," "afternoon," "dark".)

I can't figure out what to put in "outsideLogic," but I want it to turn the link out into plaintext "Go outside." when <time| is "dark".


When I click on "Wait," <time| cycles how it should, but no matter what I put in "outsideLogic," "Go outside" never changes.


I hope this makes sense. Thanks!

Comments

  • edited September 2015
    I don't think it's possible to have more than one click handler on a single hook, which is why outsideLogic isn't having any effect. A better way to handle it would be to get rid of the part that displays outsideLogic and to put the code into the logic passage. I don't know exactly what you've got in Logic, but something like this will work
    {(set: $cycle to (it + 1) % 3)
    (if: $cycle is 0)[noon]
    (else-if: $cycle is 1)[afternoon]
    (else-if: $cycle is 2)[dark]
    (click: ?wait)[(replace: ?time)[(display: "Logic")]]
    
    (if: $cycle is 2)[(replace: ?outside)[You can't go out when it's dark]]
    (else:)[(replace: ?outside)[[[Go outside.->out]]]]}
    
Sign In or Register to comment.