Making text appear in a random screen location

If you are requesting technical assistance with Twine, please specify:
Twine Version: Version 2.3.9
Story Format: Harlowe 3.2.3

I’m not sure if this is even possible, but I’d like to try!

I’d like to have a clickable word show up at a random location onscreen for a few seconds, then disappear and reappear somewhere else on the screen. It would keep doing this until the player clicks it. I’ve tried googling this and found guides to randomizing various other values, but not screen location/alignment. Is this even possible in Harlowe?

1 Like

Update: I’ve tried a workaround in which I create a table the width of the screen, and assign each cell a numeric hook name (say, 1-100). I then created a (live:) macro that began by assigning my event variable a random value from 1-100. I was hoping that I could use this to select a cell between 1 and 100 to display the link for a few seconds. But it appears there’s no way to compare the hook name with the variable name? (I tried using the (hooks-named:) macro, but got an error message that this was applicable only to strings.)

{(live: 4s)[

	(set: $calibrationevent to (random: 1,100))
	(replace: (hooks-named:$calibrationevent)[[[Calibrating...|Calibrated]]]
	(live: 3s)[(replace: (hooks-named:$calibrationevent)[](stop:)]
]
}

You need to use the (str:) macro to convert the Number to a String, before using it as an argument for the (hooks-named: ) macro.

(set: $calibrationevent to (str: (random: 1, 100)))

note: While the Harlowe documentation doesn’t seem to define a naming convention for a Hook Name, all of the hook names mentioned in the documentation start with a letter.

Have you considered how people who don’t use a mouse or touch-screen, or those people that have vision or reaction issues, are going to get passed the “random click area” puzzle?

Thank you!! And thank you for pointing that out about the documentation. It seems like identifying and comparing hook values is off the table, at least for now, so I’ll have to simplify this scene.

(Regarding your question: This will be part of a pseudo-immersive remote experience: I’ll know the names/identities of all the players and the devices they’ll be playing from.)