Screen Definitions - RhythmLunatic/stepmania GitHub Wiki

Use Ctrl+F to find your screen. They're not alphabetically sorted.

Introduction

Screens can provide actors written in C++.

Usually to utilize some of the actors and functions in these screens you would make a screen that falls back on one of these screens. For example, to define a new screen and use the features in ScreenWithOptionsList, you would add this to metrics.ini:

[ScreenDebug]
Fallback="ScreenWithOptionsList"

"ScreenDebug" is then the name of your new screen, and will load on top of the predefined values in "ScreenWithOptionsList".

If you don't want to fall back on anything for some reason, you can also manually choose what class you want and fall back on "Screen". Note that this requires filling out all the metrics values, so you'd rarely want this.

[ScreenWithStartButton]
Class="ScreenInstructions"
Fallback="Screen"

If an actor built into the screen has the name set, it can be obtained with SCREENMAN:GetTopScreen():GetChild(actor_name_here) after the screen has reached an 'on' state. For example, the menu timer can be obtained with SCREENMAN:GetTopScreen():GetChild("Timer");.

ScreenWithMenuElements

The base screen most screens derive from.

Does not have any special input handlers, so you have to write your own using lua.

ScreenWithMenuElementsBlank

The same as ScreenWithMenuElements but no background is shown.

ScreenWithMenuElementsSimple

No idea. I don't think this screen has anScy changes, so its implementation is probably unfinished?

ScreenPrompt

Screen with yes, no, and cancel options. This screen has no lua bindings, so it doesn't seem possible to configure beyond replacing the text. The screen is also hard-coded to only accept keyboard input so it's not very useful. Currently it's only used inside edit mode.

There are no unique metrics for this screen.

To replace the text, add a function inside metrics.ini. For example: QuestionOnCommand=%function(self) self:settext('aaa') end;

actor dependencies information
"Question" Font: ScreenName Question The prompt text.
"Cursor" Graphic: ScreenName cursor The cursor used for the prompt.
"Answer%dOf%d" (%d meaning a number) None Text for YES, NO, CANCEL

Source Code

ScreenInstructions

It's identical to ScreenWithMenuElements but Back and Start is mapped to go to the previous or next screen.

(Why this is called ScreenInstructions is a mystery, as nothing in this screen requires instructions... It should be called ScreenWithStartButton or something)

Since this screen class doesn't have a predefined screen already, to use it you would have to do this:

[ScreenWithStartButton]
Class="ScreenInstructions"
Fallback="ScreenWithMenuElements"

ScreenSplash

A loading screen.

If SM_DoneFadingIn is broadcast then it will prepare the next screen, and if the timer reaches zero it will start transitioning to the next screen. (Editor note: What is SM_DoneFadingIn?)

This screen also handles pressing start and back.

metric type information
AllowStartToSkip bool Allow pressing the start button to go to the next screen, otherwise you'd have to wait for the timer to run out

ScreenHowToPlay

I have no idea how this screen works. (Insert documentation here please)

Appears to pull from ThemePath/Other/<ScreenName> steps.ssc (or .sm), which is almost always ScreenHowToPlay steps.ssc

If you have the correct 3D models it can also act like the DDR Extreme how to play screen.

ScreenAttract

It's part of the attract cycle. Use this screen as a fallback if you want something in the attract cycle.

While in pay mode, you cannot press start on this screen unless you have enough coins to start.

metric type information
ResetGameState bool Reset GameState upon entering this screen.
AttractVolume bool Determines if this screen should listen to the SoundVolumeAttract preference or not.
If the metric is true (default) then music volume is determined by the SoundVolumeAttract preference, configurable in StepMania's options menu.
If the metric is false then sound will always play.

ScreenTitleMenu

This screen is based off ScreenSelectMaster.

The title screen, or the join screen if you're in free play mode. It will reset gamestate when you load it.

This screen listens for the NextTheme, NextTheme2, NextAnnouncer, NextAnnouncer2 combos in the [CodeDetector] section of metrics.

It will reload when you change the current play mode by holding F3, since you'd need to be able to switch between ScreenTitleMenu and ScreenTitleJoin on the fly.

ScreenTitleJoin is identical to ScreenTitleMenu except there's only one choice available. There's still a scroller, it's just not shown.

ScreenJukebox

metric type information
AllowAdvancedModifiers bool If dark and stealth modifiers can be shown.

ScreenDemonstration

Screen for playing a random song during the attract sequence. This screen is based off ScreenJukebox.

metric type information
SecondsToShow int Seconds to show this screen.
AllowStyleTypes string Comma separated list of styles to show. Usually only "TwoPlayersTwoSides".
DifficultiesToShow string Comma separated list of difficulties to show. Default is "easy,medium"

The song to pick for demonstration is like this:

  1. If a course with the same name as the theme is found, use songs from the course.
  2. Songs from the course MUST be fixed.
  3. If no course is found OR no fixed course entries were found, pick from the preferred song group. (What is the preferred song group? Is it random?)
  4. Now, search for a valid song within the array of songs we found.
  5. The song must be normally displayed, which means it must be unlocked. (If this song isn't listed in the unlocks, it is also unlocked).
  6. The song must not only have beginner steps.
  7. Now, search for valid steps. If any of these fail, pick a different song.
  8. The song must have a difficulty that matches a random difficulty picked in DifficultiesToShow.
  9. The steps that were picked must not be autogen.

ScreenSelectMusic

Provides the MusicWheel. Also provides the OptionsList if you've enabled it in metrics.

ScreenSelectMaster

A screen that contains a scroller which is used for menus. Refer to The other documentation for more information.

ScreenWithOptionsList

Like ScreenSelectMusic but only provides the OptionsList. Good if you want to use your own MusicWheel but still have access to the OptionsList.

ScreenLowLevelInput

A screen that checks a pressed button every frame, for when you need low level inputs. It exposes a SetInputCallback(func) function.

To utilize it, add a SCREENMAN:GetTopScreen():SetInputCallback(lowLevelInputs); to the OnCommand of any actor in any layer of your screen, where your function would be named lowLevelInputs.

The function takes three arguments: inputs, rawInputs, fDeltaTime.

parameter type information
inputs {string} An array of strings containing mapped inputs. Will not include inputs that aren't mapped, of course.
rawInputs {string} An array of strings containing all pressed inputs, the raw keys before being mapped to a controller. Includes unmapped keys.
fDeltaTime float The time since the last frame was displayed. You should take this into account so your game logic is preformed at a constant speed, ex. movement speed is 10*fDeltaTime

Quick and dirty example

This example will move an actor across the screen every frame.

function has_value (tab, val)
    for index, value in ipairs(tab) do
    	if value == val then
            return true
        end
    end
    return false
end

-- The quad inside the ActorFrame will be assigned here.
local q;

local function lowLevelInputs(inputs, rawInputs, fDeltaTime)
    --[[
    fDeltaTime is the time between this function being called last, which is dependent on your frame rate.
    Usually it's 0.0167 (60fps), so 10 * 0.0167 = move 0.1667 every frame
    If it's 120fps it would be 10*0.0083 but since it's being called twice as fast it's the same speed. Same for 30fps, 144fps, or other frame rates.
    Make sure you use fDeltaTime or your screen will break on higher/lower frame rates!
    ]]
    local moveSpeed = 10*fDeltaTime;
    if has_value(inputs,"MenuLeft") then
        q:x(GetX()-moveSpeed);
    elseif has_value(inputs,"MenuRight") then
        q:x(GetX()+moveSpeed);
    end;
end;

local t = Def.ActorFrame{
    OnCommand=function(self)
        SCREENMAN:GetTopScreen():SetInputCallback(lowLevelInputs);
        --Pro tip: AddInputCallback still works. You can have one low level input and multiple high level input callbacks.
    end;
    Def.Quad{
        Name='Quad';
        InitCommand=cmd(setsize,100,100;Center);
        OnCommand=function(self)
            q = self;
        end;
    };
}

return t;

ScreenTextEntry

Screen for entering text from the keyboard.

You use this screen by calling SCREENMAN:AddNewScreenToTop("ScreenTextEntry") in your screen, then initializing ScreenTextEntry by supplying its Load() command with a table of parameters.

parameter type information
Question string A string that is shown above the text entry line.
MaxInputLength int Number of characters the user can enter. Usually this is 255.
OnOK (optional) function a lua function that gets run when the screen ends (usually when enter is pressed). Takes the user input as an argument.
OnCancel (optional) function Like OnOK but when you press back. Takes no arguments.
Validate (optional) function A lua function that gets run when the user presses enter or back. Takes the user input as an argument. The validation function must return both a boolean and a string. If the validation function returns false the screen will not end and instead ScreenPrompt will be shown on top with the returned string from the validation function.
ValidateAppend (optional) function ???
FormatAnswerForDisplay (optional) function ???
Password (optional) bool If * characters should be shown instead of the user input. If this parameter is missing it defaults to false.
InitialAnswer (optional) string Self explanatory.
SendOnPop (optional) ScreenMessage If any screen message should be sent upon pressing enter. By default this is SM_None.

A quick example of this screen in action:

return Def.ActorFrame{
    OnCommand=function(self)
        SCREENMAN:AddNewScreenToTop("ScreenTextEntry");
        local inputParams = {
	    Question = "Enter a cheat code.",
	    MaxInputLength = 20,
	    OnOK = function(answer)
	        MESSAGEMAN:Broadcast("ScreenOver",{answer=answer});
	    end,
	};
	SCREENMAN:GetTopScreen():Load(inputParams);
    end;
	
    CodeMessageCommand=function(self,param)
        --Need to put in CodeNames in metrics for this to work
        if param.Name == "Back" then
            SCREENMAN:GetTopScreen():StartTransitioningScreen("SM_GoToNextScreen");
        end;
    end;
	
    LoadFont("Common Normal")..{
        InitCommand=cmd(Center);
        ScreenOverMessageCommand=function(self, params)
            --Handle checking here if you want
            self:settext("You entered: "..params.answer)
        end;
    };
    LoadFont("Common Normal")..{
        Text="Press back to exit.";
        InitCommand=cmd(Center;visible,false;addy,20);
        ScreenOverMessageCommand=function(self, params)
            self:visible(true);
        end;
    };

};

ScreenTextEntryVisual

visual version of ScreenTextEntry with a keyboard you can move around. It doesn't seem to be finished and crashes when you try to use it.

ScreenGameplay

It's the gameplay screen.

Has a few extra layers prefixed by the name you picked in metrics. Remember, layers belong in the BGAnimations folder. (For example, the default name is ScreenGameplay so it would be "ScreenGameplay Failed", "ScreenGameplay ready", etc)

ready

Played right after the 'on' tween.

go

Played when 'ready' finishes (Why this is its own layer is a mystery to me)

failed

OnCommand of this layer is run when both players failed.

During an extra stage a timer showing how long you've survived is displayed on top of the failed layer when you fail the stage.

cleared

Just kidding, this layer doesn't exist. It existed in SM3.9. In modern StepMania this is "ScreenGameplay out", so make sure you name your files correctly.

⚠️ **GitHub.com Fallback** ⚠️