Records the player's total play time in hours, minutes, and seconds (though milliseconds are also tracked) and formats it for display via the <
Author | ChapelR |
Website | https://twinelab.net/custom-macros-for-sugarcube-2/#/playtime-system |
Story format | SugarCube 2 |
Last checked | Sun Jun 02 2019 |
License | Unlicense |
Download | playtime.zip |
Records the player's total play time in hours, minutes, and seconds (though milliseconds are alos tracked) and formats it for display via the <<playtime>>
macro. You can pause the timer with the pausetimer
tag, and format your own output using the global playTime()
function.
pausetimer
Including the passage tag pausetimer
will suspend the timer when the player is on said passage. May be useful for menus and such.
This system uses a story variable ($playtime
by default) to store information in your game's state. You should avoid overwriting this variable, or change it using the configuration options.
This system uses a passage tag (pausetimer
by default) to control parts of its operation. Avoid using this tag for other purposes, or change it using the configuration options.
This system creates a postdisplay
tas object called start-playtime
and a prehistory
task object called pause-playtime
. You should avoid using task objects with these names in your other code, though you can also re-name these task objects in the unminified script if you need to.
You can alter the story variable, passage tag, and whether the playTime()
function is made global using the configuration options at the top of the script. See the unminified script for more info.
Demo Twee code:
:: Start Current play time: @@#time;<<playtime format>>@@ <<silently>> <<repeat 1s>> <<replace '#time'>><<playtime format>><</replace>> <</repeat>> <</silently>>\