Skip to content

"Timed Passages": SugarCube (v2.18)#


Made famous in Queers in Love at the End of the World (2013), "Timed Passages" uses the the <<repeat>> macro to repeat while checking if the timer has reached zero. If so, the <<goto>> macro will immediately transition to another passage.



Twee Code#

:: StoryTitle
SugarCube: Timed Passages

:: StoryJavaScript[script]

:: Start
[[Start Timer|First Passage]]

:: Timer
<span id="countdown">The world will end in $seconds seconds.</span>
    <<repeat 1s>>
        <<set $seconds to $seconds - 1>>
        <<if $seconds gt 0>>
            <<replace "#countdown">>The world will end in $seconds seconds.<</replace>>
            <<replace "#countdown">><</replace>>
            <<goto "World End">>

:: First Passage
<<include "Timer">>

[[Second Passage]]

:: Second Passage
<<include "Timer">>

[[First Passage]]

:: World End
The world has ended.

:: StoryInit
<<set $seconds to 10>>

Twee Download

See Also#

Delayed Text, Typewriter Effect