0 votes
by (690 points)
I've tried using timers before, but they always fail. I still have yet to set up a working timer.

1 Answer

0 votes
by (159k points)

There are a number of ways you can cause "things" to appear using a (live:) macro, which you use can depend on what exactly that "thing" is. And your question is a little vague on exactly what "things" you are talking about in this case.

I will assume you are trying to make some hidden text appear after 3 seconds, although this same technique can be used to reveal other "things".

Some text
|hidden)[Some hidden text
]\
Some more text

(live: 3s)[\
	(show: ?hidden)
	(stop:)
]

... the above example uses the following:

a. Hidden (named) Hook Markup to initially hide the relevant text. 

b. A (live:) macro with a 3s (3 second) delay.

c. A (show:) macro to reveal the contents of the relevant named hook.

d. A (stop:) macro to cause the execution of the live macro's associated hook to occur only a single time.

note: You can change the name of the Hidden Hook to something other than the hidden I used as long as you remember to also change the hook name passed to the related (show:) macro.

by (690 points)
Okay, uh, wow...

That's way to much code for what I was going to use it for, more code then text actually...

Thanks anyways, I'm sure I can find a use for this in the future, so your struggle was not in vain.
by (690 points)

But wait, couldn't I just do

(live: 3s)[hiddentext]

Or is that what I've been doing wrong?

by (159k points)

Yes, you could do that but you need to include a (stop:) macro in the associated hook to stop the (live:) macro re-displaying the same text every 3 seconds until the Reader moves to another passage.

(live: 3s)[hiddentext (stop:)]

The downsides of doing it this way are:

a. You have less control on the extract positioning of the hidden text within the over all page.

b. It becomes an issue if you want multiple hidden things within the same Passage, because each (live:) macro in a passage creates it's own timer thread handler and each of these handlers interfere with the Readers ability to interact with the page.

eg. to reveal two things at the same time.

The quick|hidden)[ brown] fox jumbed over the|hidden)[ lazy] dog.

(live: 3s)[{
	(show: ?hidden)
	(stop:)
}]

eg. to reveal two things, one after another.

The quick|fox)[ brown] fox jumbed over the|dog)[ lazy] dog.

(set: $counter to 0)
(live: 2s)[\
	(set: $counter to it + 1)
	(if: $counter is 1)[
		(show: ?fox)
	]
	(else-if: $counter is 2)[
		(show: ?dog)
		(stop:)
	]
]

Like I originally stated, it greatly depend on exactly what "things" you are trying to reveal.

...