After messing around with (link:) and (live:) in Harlowe, I thought it might be neat to make a Twine useless box. So I made:
(live: 3s)[(link: "Push the button?")[It stubbornly closes itself!]]
And that was cool, but I found I couldn't replace the 3s with random or with a variable that randomized the seconds. Any way to set (live:) to randomize between number every time it resets its count?
And then I thought it would be cool to add an image of the Useless box and make it change, but as of yet I haven't found a way to set an image as a variable or as a hook or anything.
So, how do I randomly update a live timer and how do I set an image to change to another image when my (link:) is clicked?
This is my best attempt and it fails miserably:
<img width="300" height="209" src="
http://i.ytimg.com/vi/aqAUmgE3WyM/maxresdefault.jpg"><img|
(live: (random: 1, 6)s)[(link: "Push the button?")[It stubbornly closes itself!]]<button|
(click: ?button)[ (replace: ?img)[ "<img src="
http://awesomegeekstuff.com/wp-content/uploads/2012/12/useless-box-2-300x209.png">" ] ]
Comments
The following code emulates a (live:) macro with a randomly determined delay. It consists of two passages Start and Logic.
The code is fairly straight forward, if you have any questions just ask.
a. Start b. Logic
Okay, I get how to set this. However, while it displays logic once, it fails to restart the sequence. And the link is no longer clickable, so the change no longer happens once the button is figuratively pressed. What am I missing?
Your previous example has a couple of errors in it
1. A named hook is made up of two parts:
a. the hook tag, which is the part that looks like |hookname> or <hookname|
b. the hook container, which is the part that looks like [the content of the hook]
so the first line of your previous example should be as follows: note the added square brackets! 2. You are using both (link:) and (click:) to make the second line click-able, and you only need one of them. Both of these macros only allow you to click them a single time, to get around this issue you need to create a new (link:) OR (click:) macro each time.
3. You can't change the delay length of an active (live:) macro so what you need to do is (stop:) it and then start another (live:) macro with a different delay.
Try replacing your previous example with the following two passages: Start and Logic
a. Start passage b. Logic passage