Workarounds to Add a Small Delay to a Mouseover-Goto link? (Twine Version 2.3.16, Harlowe)

Hello all,

Twine novice, trying to intuit my way through Javascript shenanigans and not often succeeding, lol. Anyway, I essentially am working with the following: I have a word (“MINOTAUR”) that appears when it’s moused over (using the Mouseover-Replace macro to change the text color from black to white, on a black background), and then I have a Mouseover-Goto on it that links to another passage with a Game Over screen. Basically, if the player “stumbles upon” the Minotaur with their mouse, the game ends. The problem is, the link to the Game Over passage happens too fast and the player can’t even see the word “MINOTAUR” appearing. So I’m looking to create a small delay between the word being moused over and the link going through.

I think this is very likely possible via a number of means, which I’ve been trying to look into, but I don’t know my Javascript well enough to combine the right macros/changers/whatever. I think a delay could be created by combining, say, a (Mouseover:) with a (Set:) and then using (Event:) or (After:) or something, essentially creating a (Mouseover:) that starts a timer that then links to the Game Over passage after a second or two. I just… can’t work out how to do any of that, lol. Apologies. My current “workaround” is just using a Mouseout-Goto instead of Mouseover-Goto, that way there’s a fair chance the player sees the word Minotaur before it links them, but it’s not a great solution.

As always, any help would be appreciated! :slight_smile:

If I were in your position, I’d add a (transition:)

First step: on (mouseover:) your word would appear without any effect, then as second step, the transition would replace your word without effect with the same word and the (mouseover-goto:).

I haven’t tested, so I don’t know if it would work.

1 Like

Hmmm that’s an interesting idea, though I’m not quite sure how it would be implemented properly… however, your suggestion about inserting (go-to:) into the replaced text actually got me thinking. I fooled around with the script and tada, I discovered a solution that (remarkably) works!! My code stays the same as it was, except I got rid of the (mouseover-goto) stuff and changed this

(mouseover-replace: "Minotaur")[(text-colour:white)[''MINOTAUR'']]

to this

(mouseover-replace: "Minotaur")[(text-colour:white)[''MINOTAUR'' (live: 1s)[(go-to: "GAME OVER")]]]

Essentially, adding in the (go-to:) to the now-visible “Minotaur” word, but putting the trusty ol’ (live:) before it, so it only ‘appears’ and activates after 1 second. Hooray for ingenuity!