Timer - RhythmLunatic/stepmania GitHub Wiki
The timer is a C++ object that every screen has. However, you can't create it yourself, it's loaded automatically when you define a screen based on ScreenWithMenuElements.
lua functions for the timer are here: MenuTimer
You can obtain the timer through lua using SCREEN:GetTopScreen():GetChild("Timer")
in an OnCommand.
You can define an infinite number of timer classes in metrics. The _fallback theme has two defined for you already called MenuTimer and MenuTimerNoSound. MenuTimer starts beeping at 10 seconds and less, and you can guess what MenuTimerNoSound does.
Metrics
These metrics are used to set up your timer class.
Name | type | Example | What it does |
---|---|---|---|
Warning#Command (Replace # with a number) | actor command | diffuse,Color.Red; |
It's a command that runs on the timer numbers. |
WarningStart | int | 10 | Controls the number of WarningCommands to be loaded. Default is 10. |
WarningBeepStart | int | 10 | When to start beeping. Set this to 0 if you don't want it to beep. The beep sound is named "class_name tick" where class_name is the name of the metrics class (usually MenuTimer) |
HurryUpTransition | float | 7.5 | Play the "hurry up" announcer sound if an announcer is enabled. |
MaxStallSeconds | float | 0 | The timer is paused for this amount of seconds if the Stall() function is called. Right now this is only done if the roulette option in the wheel is pressed and the default value for this metric is 0 anyways. |
Text1FormatFunction Text2FormatFunction | lua function | see below | Formats the text, duh. The timer contains two text actors, one for the seconds and one for the decimal (although you can manipulate either one freely). |
Text1OnCommand Text2OnCommand | actor command | shadowlength,0; |
Command to run on the text actors. By default Text2OnCommand hides the decimal from the timer. |
These metrics would go in your screen.
Name | type | Example | What it does |
---|---|---|---|
TimerSeconds | float | -1 or any value above 0 | Controls the timer seconds. If it's -1 a timer will not be loaded. |
TimerX TimerY | float | 0 | X and Y position of the timer. |
TimerMetricsGroup | string | "MenuTimer" | Which timer class you want to use in your screen. |
ForceTimer | bool | false | If timer should still go when the timer is disabled in the options menu. |
Timer format function
todo
default function
function(fSeconds)
fSeconds=math.min( 99, math.ceil(fSeconds) );
local digit = math.floor(fSeconds);
return ""..digit
end