Howdy, Stranger!

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

Name that hook! (please check the warning!)

edited March 2016 in Help! with 2.0
Hello all,

At parties people are always asking me "which story format do you use?" and I always laugh and reply "Harlowe" then leave the party immediately and come home to code things poorly.

I'm trying to make a dream sequence, one feature of which is that certain elements will alter, sometimes just stylistically, sometimes textually, in response to user inputs (I'd particularly like to be able to use (mouseover:) to change elements, gradually turning the dream into a nightmare). I've overcome some problems e.g. here's some example code:
(set: $style to (colour: "red") + (text-style: "bold"))
|a>[$style[A link]]


(click-replace: ?a)[$style[A thing happens!]]

Where I used myself a named hook to make a link not look like a link. I was quite pleased with it. However, to use a computer science term, my actual code is "a bunch" bigger and "horribly" more complex and currently looks like this:
(set: $dream1 to "You ", $dream2 to "are ", $dream3 to "walking ", $dream4 to "through ", $dream5 to "your ", $dream6 to "child", $dream7 to "hood ", $dream8 to "home.")
(set: $nightM1 to "running ")
(set: $loadTime to 0)
(set: $nightMStyle to (colour: "red") + (text-style: "shudder"))
(live: 1000ms)[(set: $loadTime to $loadTime + 1)]
(live: 100ms)[(set: $dreamStyle to (font: "papyrus") + (transition: "dissolve") + (colour: (either: white + magenta, white + green, white + blue, white + orange, white + aqua, white + purple, "magenta", "green", "blue", "orange", "aqua", "purple", "white")))]
(set: $dreamStyle2 to (text-style: "fade-in-out"))
(set: $dreamStyle3 to (colour: "red") + (text-style: "fade-in-out"))
(live: 200ms)[(if: $loadTime > 1)[$dreamStyle[$dream1](stop:)]]
(live: 200ms)[(if: $loadTime > 2)[(append: $dream1)[$dreamStyle[$dream2]](stop:)]]

(live: 200ms)[(if: $loadTime > 3)[(append: $dream2)|a>[$dreamStyle[$dream3]](stop:)]]

(live: 200ms)[(if: $loadTime > 4)[(append: $dream3)[$dreamStyle[$dream4]](stop:)]]
(live: 200ms)[(if: $loadTime > 5)[(append: $dream4)[$dreamStyle[$dream5]](stop:)]]
(live: 200ms)[(if: $loadTime > 6)[(append: $dream5)[$dreamStyle[$dream6]](stop:)]]
(live: 200ms)[(if: $loadTime > 7)[(append: $dream6)[$dreamStyle[$dream7]](stop:)]]
(live: 200ms)[(if: $loadTime > 8)[(append: $dream7)[$dreamStyle[$dream8]](stop:)]]

(mouseover-replace: ?a)[$nightMStyle[$nightM1]]


I've included the whole first passage here but the important parts are the ones with linebreaks around them, e.g. the one where I (try to) append $dream 2 with a named hook containing $dream3 and the final line which should let me mouseover |a> and replace it (please feel free to critique any of the rest of my coding choices, I am pretty new at this and all advice is welcome, plus I will think you are smart and cool). This does not work. The hook does not become a link (though in my experimenting I managed to make *all* the appended hooks from 3 onwards part of the same named hook, which I could mouseover. Can't remember how now, but, in any case, not the desired behaviour) or, it seems, a named hook at all. Anyone able to explain why and/or how to fix it?

Additionally, when I did have partial success, I discovered that (mouseover-replace:) adds a little line of dots under the hook(s) that it affects. This isn't the worst thing ever, but is there any way I could get rid of them if I wanted?

P.S. [WARNING!] I tried:
(live: 200ms)[(if: $loadTime > 3)[(append: $dream2)[$dreamStyle[$dream3]]<a|](stop:)]]

(I don't know why I needed the extra ] but Twine was pretty insistent)

It makes the code go kind of bananas. Like "crash Twine" bananas. So don't try this.
Sign In or Register to comment.