Skip to content

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

Summary#

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.

Example#

Download

Twee Code#

:: StoryTitle
SugarCube: Timed Passages

:: StoryJavaScript[script]
UIBar.destroy();

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

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

:: 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