Linking to Another Passage on Hover/Mouseover? (Twine Version 2.3.16, Harlowe)

Hi friends,

Twine novice here, I’m looking to implement a feature in my game where mousing over a certain word/phrase sends you to another passage. Or, in other words, I want to create a link that triggers on a hover/mouseover instead of on clicking. I’ve already learned about the mouseover-replace macro and such, but I can’t find a macro that works as I’m intending.

I was wondering if there was some workaround I’m missing, or if it’s possible to translate the custom solution in this old post (Doing more with hover/mouseover - Twine Forum) to Harlowe (my Javascript knowledge is also minuscule).

Another potential solution I found was this site with custom macros (go to the “Mouseover Macro” page and see the second example with the pitfall: Custom Macros Demo), but that’s unfortunately for Sugarcube.

Any help would be appreciated! Thanks!

If you’ve found the (mouseout-replace:) macro, then in that same section of the documentation is the (mouseover-goto:) macro.

1 Like

Wow, no idea how I missed this, and how it never came up in my searches? Time to read the documentation more closely. Thanks a lot!

Hi,

I’m solving a similar problem and I’m quite sorry that there is no macro to inspire.
I would like to activate the button when hovering the mouse and still groping.

Jirka

Hi, I’m no Greyelf but I think I could maybe help you. Could you be a little more clear on what you’re trying to do? What’s the result you’re looking for?

1 Like

two things I would note:

  1. Generally people who view web based pages don’t expect moving their cursor over an interactive element like a “button” or “link” to trigger that element’s purpose…
  2. It’s not unusual for a cursor to pass over other “things” when the end-user moves their cursor from one part of a page to another.
1 Like

Hi,

I’m so glad you want to help me.

I am creating a game for the blind and I would like to use all the possibilities of adding sound.

Playing a sound in a loop and stopping it doesn’t bother me, just like sound in only one passage.

Also trigger sound on clicks. The code is here:

(track: & # 39; file: /// C: / Users // Desktop / Test / audio / & # 39 ;, & # 39; play & # 39;)

{

(link-repeat: & # 39; Start shooting! & # 39;) [

(track: & # 39; submachine gun & # 39 ;, & # 39; play & # 39;)

]

}

I would like to make the game more exciting and start sounding when the cursor reaches a certain place.

Example: In this fighting game, a player gets a wrong choice to the passage where the minefield is. There is no exit from here, but the text of the game keeps the player in suspense that he could get out of here.

I’m still working with the macro.

Maybe this code doesn’t throw a mistake, but it also doesn’t do anything.

(track: & # 39; file: /// C: / Users // Desktop / Test / audio / & # 39 ;, & # 39; play & # 39;)

{

(mouseover-replace: “Mina”) [’’

[

(track: & # 39; mina & # 39 ;, & # 39; play & # 39 ;, 1)

‘’ (live: 1s) [(go-to: “TRAck PLAY”)]]

}

Thank you and I will be happy for any idea

Jirka

image001.jpg

1 Like

notes
1: You should ideally create a 2nd question / thread when changing the topic of discussion.

2: You need to use the Preformatted Text </> option in the comment field’s Toolbar when you include source code examples in a comment, it stops the forum’s software from altering that code in a way that makes it unusable.

I believe your 1st code example was meant to look like so…

(track: "file:///C:/Users/Desktop/Test/audio/", "play")

{
(link-repeat: "Start shooting!")[
	(track: "submachine gun", "play")
]
}

…and your 2nd example like so…

(track: "file:///C:/Users/Desktop/Test/audio/", "play")

{
(mouseover-replace: "Mina")[
	(track: "mina", "play", 1)
	(live: 1s)[
		(go-to: "TRAck PLAY")
	]
]
}

3: When including non-standard macros in code example it helps if you either:

  • Supply the source code for them if they are your own.
  • Supply a link to where you sourced them from if not your own.

Based on the fact you are using a (track:) macro call in your example I will assume you are using Chapel’s Harlowe Audio Library. I will also assume that you have correctly used a hal.tracks Special Passage to pre-define the “tracks” you will be using in your project.

There are a couple of issues the Audio related code in your examples:

1: You are using an Absolute URL as the 1st argument in the first (track:) macro call of both of your code examples, when that argument should be the Name (identifier) of a “track” that you pre-defined in your project’s hal.tracks Special Passage.

(track: "file:///C:/Users/Desktop/Test/audio/", "play")

2: You are passing the Number 1 as the 3rd argument to the second (track:) macro call in your second code example…

(track: "mina", "play", 1)

but the “play” command doesn’t support additional arguments.

play: Plays the indicated track, if possible.
Arguments: none.
Returns: nothing.

I must admit I’m a little confused by the fact that you are adding mouse-over based interactions to a project that is being designed for Blind people, who will likely be using an Accessibility device / Reader software to interact with the project and not a Mouse.

1 Like

Greyelf took the words right out of my mouth (and made them much better and way more thorough, obviously). Your game sounds cool, though I share Greyelf’s question about how a blind person would play… but I assume you have a plan for that. The only thing I was going to add was you need to make sure the word “Mina” actually appears in the passage somewhere as plain text, otherwise the (mouseover-replace) macro has nothing to trigger it. Maybe this is already the case and you just didn’t include it with your code in your post, but I just wanted to make sure.

Hello Greyelf,

I apologize in advance for a post that does not belong here.

I create games for the blind and I am also blind.

I assume the mouse behaves the same as the cursor used by screen readers. If not, I apologize for the ignorance. I couldn’t discuss it with anyone.

I can find macro codes in the manual and in some discussion threads.

My macros may be pretty rough, but they work, but I have to work with them a lot.

I don’t speak English and the Google translator also translates some codes for me and doesn’t translate anything at all. Then I’m confused.

That’s why I’m happy when there are macros in the discussion that I can use for my own use.

I copied and edited the audio codes from the Audio Hal manual.

I’m a beginner in Twine and I’m always discovering new things I can add to the game.

I am happy for any specific advice in the form of a written macro. If I understand correctly, it is not a problem to adapt it for my own needs.

I apologize once again for the contributing text and have a nice day

Jiří Škrába

image001.jpg

1 Like