local keyword, they will be global.
false if the player should be disallowed from entering the options menu from ScreenSelectMusic (i.e. during an ExtraStage or when the is Oni). Returns true otherwise.
color with HSV values matching c and alpha set to percent, where percent is in the range 0..1.
true if player modifiers should be forced. This is effectively the negation of .
true if song modifiers should be forced (i.e. during an ExtraStage, or when the is Oni, Battle, or Rave).
v is false (or nil). Returns all arguments otherwise. sAssertMessage is an optional error message (the default is "assertion failed!").assert is a core function of Lua's basic library; see the Lua manual for more details.
arg1, and nil otherwise.arg2, and nil otherwise.
path. For example, passing in "/path/to/file.txt" will return "file.txt", while "/path/to/some/directory/" will return "directory".
c's R, G, and B values by fBoost.
true if the Center1Player preference is enabled during single style. Returns true when the style is double or routine, regardless of the Center1Player preference.false otherwise.
true if checkpoint judgments and tap judgments
are considered separate, or false otherwise.
fValue between fLow and fHigh.
false.
opt.collectgarbage is a core function of Lua's basic library; see the Lua manual for more details.
color can be in hex ("#FFFFFFFF") or 0..1 values ("1.0,1.0,1.0,1.0"), in RGBA order.
c[1]/2, c[2]/2, c[3]/2, c[4])
c[1]+(c[1]/2), c[2]+(c[2]/2), c[3]+(c[3]/2), c[4])
c[1]/1.5, c[2]/1.5, c[3]/1.5, c[4])
{1, 0, 0.4, 1} will return "FF0066FF".
Hue, Sat, Value, and Alpha.
params will contain two boolean values indexed by bReverse and bCentered.number can be a string, an integer, or a float.comma is an optional argument that is used instead of a comma.dot is an optional argument that is used instead of a dot to find the end of the part that should be commified.comma and dot arguments are provided to ease compliance with locales or languages that do not use comma and dot in numbers the way English does.
false.
d localized for the current language using strings defined under [CourseDifficulty].
ct localized for the current language using strings defined under [CourseType].
indent is the number of pixels to indent lines. width is the width in pixels that lines should be constrained to.
dir for xml files of actors and converts them to equivalent lua files.
See Docs/Themerdocs/XmlToLua.txt.
cd localized for the current language using strings defined under [CustomDifficulty].
1-31.
0-365.
dofile is normally a core function of Lua's basic library. StepMania overrides this in
[01 base.lua] to use loadfile, which itself has been overridden.
master_lang_name is the name of the ini file that contains the language with all strings used by the theme.list.
tab with the given value.
f takes a key and a value.
num with " songs played" and returns the resulting string.
fPercentDancePoints formatted as a percentage.
CoursesToShowRanking preference if it is not an empty string.name from the Env table.
1-7
path in seconds.RageSound, and then use to avoid loading the file twice.
true if player pn is using the ProTiming UserPref.
DisplayAspectRatio preference).
"".
ScreenWidth by ScreenHeight as each is defined under the theme's [Common] metric.
1-9.
true if you need to step on hold heads to activate them.
TimingWindowSecondsHold preference value in other games.
hue is from 0-360saturation and value are 0..1
0-360saturation, value, and alpha are 0..1
hsv table should use indexes Hue, Sat, Value, Alpha.
hsv table should use indexes Hue, Sat, Value, Alpha.
t, and 0,
so that the construction for i,v in ipairs(t) do body end
will iterate over the pairs (1,t[1]), (2,t[2]), ···, up to the first integer key absent from the table.ipairs is a core function of Lua's basic library; see the Lua manual for more details.
true if the coin mode is not set to CoinMode_Home.
true if the current is Nonstop, Oni, or Endless.true if IsArcade() and the coin mode is CoinMode_Free.
true if the current game is sGame.
true if the coin mode is set to CoinMode_Home.
false.
false.
false.
true if W1 is allowed (and tns == 'TapNoteScore_W2')
true if Routine mode is being played.
true if the aspect ratio is 16:10 (1.6) or higher.
delimiter, returning a string of the results.
data and returns the result.
data as JSON. Empty tables are represented as arrays in the output.minify is optional and defaults to false. If true, all unnecessary whitespace is omitted from the output.
jl localized for the current language using strings defined under [JudgmentLine].
sPath. If sPath points to a Lua file, any additional arguments will be passed to that script.
loadfile is normally a core function of Lua's basic library. StepMania overrides this in
[01 base.lua] to use lua.ReadFile.
class, creating CamelCase aliases for each function. Not intended to be used by themers.
sString.
0-11.
m localized for the current language using strings defined under [Month].
m as a non-localized string.
currents in place, as well as returning currents.currents, goals, and speeds must all be the same size and contain only numbers.multiplier is optional. The speeds in the speeds table will be multiplied by multiplier. This makes it more convenient to use multiapproach in a per-frame update: pass in the frame delta and the speeds will be scaled to the time that passed.next returns the next index of the table and its associated value.next is a core function of Lua's basic library; see the Lua manual for more details.
t, and nil,
so that the construction for k,v in pairs(t) do body end
will iterate over all key–value pairs of table t.pairs is a core function of Lua's basic library; see the Lua manual for more details.
pma localized for the current language using strings defined under [PeakComboAward].
pm localized for the current language using strings defined under [PlayMode].
pn localized for the current language using strings defined under [PlayerNumber].
p1val or p2val depending on pn.
numerator and denominator.
cat localized for the current language using strings defined under [RadarCategory].
v1 is equal to v2, without invoking any metamethod.rawequal is a core function of Lua's basic library; see the Lua manual for more details.
t[index], without invoking any metamethod.rawget is a core function of Lua's basic library; see the Lua manual for more details.
t[index] to value, without invoking any metamethod.
The modified t is then returned.rawset is a core function of Lua's basic library; see the Lua manual for more details.
optional is true, then a nil path is returned instead of emitting an error if no file is found.
path and returns its contents.
indent is an optional argument that will be prepended to every line.
indent is an optional argument that will be prepended to every line.
false.
x, originally within low1 and high1, to fall between low2 and high2.
fSecs to Hours:Minutes:Seconds format using two digits for each section.
fSecs to Minutes:Seconds format using one digit for Minutes and two digits for Seconds.
fSecs to Minutes:Seconds format using two digits for both sections.
fSecs to Minutes:Seconds.Milliseconds format using one digit for Minutes, two digits for Seconds, and two digits for Milliseconds.
fSecs to Minutes:Seconds.Milliseconds format using two digits for each section.
fSecs to Minutes:Seconds.Milliseconds format using two digits for Minutes, two digits for Seconds, and three digits for Milliseconds.
index is a number, returns all arguments after argument
number index. Otherwise, index must be the string
"#", and [it] returns the total number of extra arguments it received."
t.
name to value in the Env table.
true if a decoration should be shown on the current screen or not.
so localized for the current language using strings defined under [SortOrder].
delimiter, returning a table of the results.
sa localized for the current language using strings defined under [StageAward].
i localized for the current language using strings defined under [Stage].
nil if the string passed in does not match any valid BlendModes.
local b = StringToBlend("AlphaMask")
Trace(b) -- "BlendMode_AlphaMask"
t.
num.
tns localized for the current language using strings defined under [TapNoteScore].
e to a number. Returns nil if it can't convert the input to a number. (base is optional.) tonumber is a core function of Lua's basic library; see the Lua manual for more details.
e to a string.tostring is a core function of Lua's basic library; see the Lua manual for more details.
i localized for the current language using strings defined under [UnlockRewardType].
list. This function is equivalent to return list[i], list[i+1], ···, list[j].i and j are optional; by default, i is 1 and j is the length of the list.unpack is a core function of Lua's basic library; see the Lua manual for more details.
0-6, where Sunday is 0.
ar43 (4:3; 640px) and ar169 (16:9; 854px).
buf to the file at path.
prefName to its config file with value being tostring'd.
SongUtil to get playable from a song given the current :
local song = GAMESTATE:GetCurrentSong()
local playable_steps = SongUtil.GetPlayableSteps(song)
sPath.
true if sClassName is a registered Class.
optional is true, then a nil path is returned instead of emitting an error if no file is found.
iCol at beat fNoteBeat for the provided PlayerState. Y Offset is affected by Speed mods and Accel mods, and impacts most other arrow effects.
iCol with a Y offset of fYOffset for the provided PlayerState.fYReverseOffsetPixels is the separation between targets with and without reverse. This argument is optional and will pull defaults from the metrics for [Player]
iCol with a Y position of fYPos for the provided PlayerState.fYReverseOffsetPixels is the separation between targets with and without reverse. This argument is optional and will pull defaults from the metrics for [Player]
iCol with a Y offset of fYOffset for the provided PlayerState.
iCol with a Y offset of fYOffset for the provided PlayerState.
fYOffset for the provided PlayerState.
fYOffset for the provided PlayerState.
fNoteBeat for the provided PlayerState.bIsHoldHead is an optional argument which defaults to false. If true, this function will return 0 if the [PlayerOptions] modifier DizzyHolds is off.
iCol with a Y offset of fYOffset for the provided PlayerState.fPercentFadeToFail is optional and defaults to -1.fYReverseOffsetPixels is the separation between targets with and without reverse. This argument is optional and will pull defaults from the metrics for [Player]fDrawDistanceBeforeTargetsPixels is optional and will pull defaults from the [Player] metric DrawDistanceBeforeTargetsPixelsfFadeInPercentOfDrawFar is optional and will pull defaults from the [NoteField] metric FadeBeforeTargetsPercentiCol with a Y offset of fYOffset for the provided PlayerState. The arguments are the same as for GetAlpha.
fNoteBeat for the provided PlayerState.
fYOffset for the provided PlayerState.fOverlappedTime is optional and will default to 0.
PlayerNumber[1] would be the
string 'PlayerNumber_P1'.Enum namespace are valid member
functions of every Enum where the first argument is
omitted and the name of the Enum is used in place
of Enum.
Enum.GetName(PlayerNumber)
Enum.Reverse(PlayerNumber)
can be condensed like
PlayerNumber:GetName()
PlayerNumber:Reverse()
x and y need to be elements of the enumerated
type e. Returns a value less than/greater than/equal to
0 corresponding to the numerical value of x being
less than/greater than/equal to the numerical value of y as
determined by
Enum.Reverse( e ).
e. For example,
Enum.GetName( )
will return the string 'PlayerNumber'.
e. For
example:
local pn1 = PlayerNumber:Reverse()['PlayerNumber_P1']
local pn2 = PlayerNumber:Reverse()['PlayerNumber_P2']
-- pn1 is 0
-- pn2 is 1
Note that the values returned from Reverse() will correspond
to the 0-based indexing from C++ and not 1-based indexing conventional to Lua.
true if the type of v is sType.
sPath. If successful, it returns the file's contents.
If unsuccessful, it returns two values: nil and "error".
error is optional and defaults to "Script error occurred.".error_type is optional and defaults to "LUA_ERROR". Errors of type "LUA_ERROR" will be shown in-game if the ShowThemeErrors preference is enabled. A dialog will not appear for an error_type the user has chosen to ignore.
func(...) with LuaThreadVariables set according to the keys and values of t, and returns the return values of func().t is {x=12}, calling Var "x" from func will return 12.
sString to log.txt. Aliased by
.
sString to info.txt and log.txt as
a warning. Aliased by .
0..1. With a single argument (n), the number is in the range of 1..n. With two arguments (lower, upper), the number is in the range of l..u.
seed.
local file = RageFileUtil.CreateRageFile()
pn.
st) are playable.
st) are playable.
GetX().
nil if it doesn't have one.
nil if it doesn't have one.
b.
fRate is in seconds.accelerate is a basic tween command, along with , , , and .
rot degrees to the Actor's current X rotation.
rot degrees to the Actor's current Y rotation.
rot degrees to the Actor's current Z rotation.
xPos to the Actor's current x position.
yPos to the Actor's current y position.
zPos to the Actor's current z position.
h and v are in the range 0..1.
true, cull the Actor's back faces. See also: .
fAlpha, where fAlpha is in the range 0..1.
rot degrees.
rot degrees.
rot degrees.
zoom.
zoom.
zoom.
zoom.
self:Center() is equivalent to self:x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y)
self:CenterX() is equivalent to self:x(SCREEN_CENTER_X)
self:CenterY() is equivalent to self:y(SCREEN_CENTER_Y)
tweens
can either be a string like "linear,0.25,accelerate,0.75" or
a table with tween information { {Type="linear", Percent=0.25, Bezier=nil}, {Type="accelerate", Percent=0.75, Bezier=nil} }
percent of the Actor from the bottom, where percent is in the range 0..1.
percent of the Actor from the left, where percent is in the range 0..1.
percent of the Actor from the right, where percent is in the range 0..1.
percent of the Actor from the top, where percent is in the range 0..1.
mode.
1 - (1-fRate) * (1-fRate)), where fRate is in seconds.decelerate is a basic tween command, along with , , , and .
c.
fAlpha, where fAlpha is in the range 0..1.
c.
c, ignoring any alpha value in c.
c.
c.
c.
c.
c.
c.
c.
iOrder, where larger values display first.
s.
c.
c.
fTime. The offset is added to the time into the effect before calculating percent_through_effect.
fTime.
percent of the Actor from the bottom where percent is in the range 0..1.
percent of the Actor from the left where percent is in the range 0..1.
percent of the Actor from the right where percent is in the range 0..1.
percent of the Actor from the top where percent is in the range 0..1.
true if the Actor has a command named sCmdName.
fAlign which should be a float in the range 0..1. An alignment of 0 is left-aligned while an alignment of 1 is right-aligned.fHeading.
b is true, but don't unhide if b is false."
align.
local spr = LoadActor('awesome.png')
spr.InitCommand=function(self)
self:horizalign('HorizAlign_Left')
end
Use for fractional alignment.
factor.
fRate is in seconds.linear is a basic tween command, along with , , , and .
side ("Back" or "Front").
sName.
fPitch.
sCommandName. params is passed to the command as an argument if it is a table.
p being a human player.
sCommandName to be played.
!sMessageName (Note the ! at the beginning. The source code says this: "Hack: use "!" as a marker to broadcast a command, instead of playing a command, so we don't have to add yet another element to every tween state for this rarely-used command.")
fRoll.
fRotation degrees.
fRotation degrees.
fRotation degrees.
cmds on the Actor's children, as well as the Actor itself.RunCommandsRecursively belongs to StepMania's base Actor class, it is available to all specialized actors. Calling it from an ActorFrame or ActorFrameTexture can be helpful, as those specialized actors can contain children actors.
Def.ActorFrame{
Name="AF",
Def.Sprite{ Name="sun", Texture="sun.png" },
Def.ActorFrame{
Name="AF2",
InitCommand=function(self)
-- bounce() will be applied to AF2, airhorn, and catchphrase
self:RunCommandsRecursively( function(actor) actor:bounce() end )
end,
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
}
}
iNewState.
c.
fLength.
fLength.
fLength.
fAmount.
fAmount.
fSeconds before executing the next command.
spring is a basic tween command, along with , , , and .
time is in seconds. type is a TweenType_Bezier, then the params table must have 4 or 8 numbers. 4 numbers creates a 1 dimensional bezier curve, 8 numbers creates a 2 dimensional bezier curve.TweenType_Bezier, the params table is ignored.fAlign which should be a float in the range 0..1. An alignment of 0 is top-aligned while an alignment of 1 is bottom-aligned.align.
local spr = LoadActor('awesome.png')
spr.InitCommand=function(self)
self:vertalign('VertAlign_Bottom')
end
Use for fractional alignment.
xPos.
yPos.
zPos.
fBias.
bUse.
zoom scale.
zoomX and zoomY.
zoom height. See also: .
zoom width. See also: .
zoom scale on the X axis.
zoom scale on the Y axis.
zoom scale on the Z axis.
true, turns it off if false
testMode.
true or false based on bWrite.
stretchto,0,0,SCREEN_WIDTH,SCREEN_HEIGHT)
1).
-- in the context of a .lua file as a screen layer
-- this ActorFrame can be thought of as a Lua table
local af = Def.ActorFrame{}
-- add a Sprite at the next index
af[#af+1] = Def.Sprite{
Texture="smilingsun.png"
}
-- add a BitmapText at the next index
af[#af+1] = Def.BitmapText{
Font="Common normal",
Text="Yo!"
}
-- have the file return the ActorFrame
-- for the StepMania engine to interpret
return af
When actor commands like and
are used to position and scale an ActorFrame, its children will position relative to the parent ActorFrame
and scale proportionally.
local af = Def.ActorFrame{}
-- move the ActorFrame +100px
-- over a 2 second duration
-- its children will move with it
af.OnCommand=function(self)
self:linear(2):addx(100)
end
-- add various children actors
-- to the parent ActorFrame
af[#af+1] = Def.Sprite{
Texture="taro.png"
}
af[#af+1] = Def.Sprite{
Texture="laer.png"
}
-- etc.
return af
Likewise, if you stop drawing an ActorFrame by applying visible(false) to it, its children
will stop drawing with it.sName.sCommandName command on the ActorFrame's children.
sCommandName command on the ActorFrame's leaves.
cmds on the ActorFrame's immediate children.
Def.ActorFrame{
Name="AF",
InitCommand=function(self)
-- bounce() will be applied to sun and AF2
self:RunCommandsOnChildren( function(child) child:bounce() end )
end,
Def.Sprite{ Name="sun", Texture="sun.png" },
Def.ActorFrame{
Name="AF2",
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
}
}
cmds on the ActorFrame's leaves. Leaves are nodes in the ActorFrame tree that have no further child nodes.
Def.ActorFrame{
Name="AF",
InitCommand=function(self)
-- bounce() will be applied to sun, airhorn, and catchphrase
self:runcommandsonleaves( function(leaf) leaf:bounce() end )
end,
Def.Sprite{ Name="sun", Texture="sun.png" },
Def.ActorFrame{
Name="AF2",
Def.Sprite{ Name="airhorn", Texture="airhorn.png" },
Def.BitmapText{ Name="catchphrase", Font="Common Normal", Text="Yo!" }
}
}
c.
c.
c.
fRate.
sName.
index with the properties provided. The tables of properties are each optional and can be provided in any order.
vertices should themselves be tables, of the form provided to SetVertex. If vertices is the first argument it will start from vertex 1. If an integer is provided before vertices it will start from that vertex. It will add vertices as necessary.
Example: self:SetVertices( { { { x1, y1, z1 } , { r1,g1,b1,a1 } , { tcx1,tcy1 } }; { { x2, y2, z2 } , { r2,g2,b2,a2 } , { tcx2,tcy2 } } } )
Mode must be a .First is the index of the first vertex to draw.Num is the number of vertices to draw. -1 for Num means draw all verts after First.
-- Sets all three parts of the draw state.
self:SetDrawState{Mode="DrawMode_Quads", First= 1, Num= -1}
-- Set only the draw mode. First and Num remain unchanged from previous.
self:SetDrawState{Mode="DrawMode_Quads"}
-- Set the first and number to draw. Draw mode remains unchanged.
self:SetDrawState{First= 3, Num= 4}
texture
path.
a.
fWidth by fHeight pixels.
fNumItems items.
fSecs.
fSeconds.
0 means the scroller will not scroll.
fItemHeight.
fItemWidth.
Def.Sound.File attribute.
Def.Sound{
File="./path/to/soundeffect.ogg",
OnCommand=function(self)
-- play this sound effect at the parent screen's OnCommand
self:play()
end
}
ActorSounds have three additional boolean attributes:SupportPan - Let the sound pan from side to side.SupportRateChanging - Let the sound change rate and pitch.IsAction - If true, the sound is an action sound, and will be muted if the MuteActions preference is turned on.
Def.Sound{
File="./path/to/soundeffect.ogg",
SupportPan=true,
SupportRateChanging=true,
IsAction=false,
}
sPath.
bPause.
SupportPan = true on load.
ANNOUNCER.
sAnnouncer exists.
sNewAnnouncer.
HOOKS.
true if the application presently has focus.
true if the Banner is currently scrolling.
sPath (typically or ).
Font attribute. It takes a font name as a string,
pathed relative to the current theme's ./Fonts/ directory../Program/ directory of packaged StepMania releases.Text attribute, and changed
later using settext().
Def.BitmapText{
Font="Common normal",
Text="Hello!",
OnCommand=function(self)
self:sleep(2):settext("Hey!")
end
}
File attribute,
which takes the path to the ini file as a string, relative to the root of StepMania.
-- use a custom font from a simfile
local song_dir = GAMESTATE:GetCurrentSong():GetSongDir()
local ini_path = "Fonts/courier/_courier 20px.ini"
Def.BitmapText{
File=song_dir .. ini_path,
Text="Hello, World!"
}
attr to the string at position
iPos.Length
which specifies how many (multi-byte) characters the attribute
is to apply. If Length=-1, then the attribute applies
until another attribute overrides it.Diffuse, then the color value
is applied to the range of text.Diffuses, then it should be
an array of 4 colors which specify the diffuse color for the
top left, top right, bottom left, and bottom right.Glow, then the color value
is applied as a glow to the range of text.attr = { Length = 10; Diffuse = color("#AABBCC"); }
bJitter is true, move each character of the string around by a small random amount.
fHeight. If fHeight is 0, then there is no maximum height.
fWidth. If fWidth is 0, then there is no maximum width.
false.
true, set each character of the text in turn to the rainbow colors in the metrics BitmapText::RainbowColor#.
sText. This clears all attributes.
string.format(sFormat, ...).
c.
true, make all text uppercase.
iSpacing pixels of padding between lines of text.
iWidth pixels. If you or by x and you want the text wrapped at width, then you should use wrapwidthpixels(width/x).
CHARMAN.
sID.
sMetricsGroup.
true if all of the songs in the course have been defined (as opposed to random songs).
iIndex from the Course.
true if the Course has a background.
true if the Course has a banner.
true if the Course has modifiers.
true if the Course has timed modifiers.
true if the Course is an edit.
true if the Course was automatically generated.
true if the Course is Endless.
true if the Course is Nonstop.
true if the Course is Oni.
true if the Course is playable in StepsType st.
true if the Course is a ranking course.
true if this CourseEntry is a fixed song.
true if this CourseEntry is secret.
CRYPTMAN.
sPath.
s.
sPath.
s.
sPath as a binary formatted string.s as a binary formatted string.pn,
then sets the DifficultyIcon's state from the difficulty of Steps pSteps
pn,
then sets the DifficultyIcon's state from the difficulty of Trail pTrail
pn.
nil if there is no such mode.
true if this DisplaySpec is describing the
"logical display" like an X screen or the Win32 "Virtual screen", or
false otherwise (if this describes a physical display).
userdata object which describes the displays
configured on the user's machine.
This object supports the __len operator (#t), and
integer indexing, but does not support
iteration via pairs or ipairs.
Each element of the array is a .
i
true if notes are counted separately in this game.
tns.
nil if there isn't one).
GAMEMAN.
game.
true if any noteskins exist for the specified Game s.
st.
game.
Game. The second argument is optional, and if provided will determine which theme is loaded when the game changes. If the second argument is not provided, the default theme from the preferences for the new game type will be loaded.SOUND.
fVolume for fDuration seconds.
pn.
musicPath starting from musicStart for
musicLength seconds one time. Both fadeIn and
fadeOut can be customized as required. loop
tells the sound manager to loop the music part. applyRate
tells the sound manager to apply the current music rate. If alignBeat
is true or nil, the length is automatically adjusted to cover an integer number of beats.
sPath one time. is_action is optional, if it is true, the sound is an action sound, and will be muted if the MuteActions preference is turned on.
GAMESTATE.
true if any player has performed a feat worthy of ranking.
sCommand
for pn, if given. See .
false and an error string if gameplay cannot be entered safely.
local can, reason = GAMESTATE:CanSafelyEnterGameplay()
if not can then
lua.ReportScriptError("Cannot safely enter gameplay: " .. tostring(reason))
end
true if pn's options will disqualify them for ranking.
true if enough credits have been inserted to join.
local credits = {GAMESTATE:GetCurrentStepsCredits()};nil if it does not exist.
nil
if it does not exist.
true if the gameplay lead in is enabled. If
false, gameplay begins immediately.
true if the game is Multiplayer.
pn.
pn.
pn.
pn.
pn.
true if a delay is active in the song.
true if the song is currently in a freeze.
fBeat.
pn.
true if the workout goal is complete.
true if an extra stage was earned.
true if either player does not have a profile loaded, and there is a loadable profile.
true if either player has a profile loaded.
true if we are specifically in the Step Editor's
editing portion. If in recording or playing mode, this will return
false.
iCoins number of coins. iCoins can be negative or positive.
true if this is an extra stage.
true if any human player is using a memory card.
true if playing in Battle mode.
true if playing in a Course mode.
true if in Demonstration mode.
true if the match was a draw.
true if Event Mode is on, temporary or otherwise.
true if this is the first extra stage.
true if this is the second extra stage.
true if player pn has completed the current Goal.
true if player pn is human.
true if player pn is enabled.
true if player pn has joined the game.
true if player pn is the winner.
pn. Does not deduct coins.
LoadEdits is true, or by default if the argument is omitted.
true if player pn is using modifier sModifier.
true if players can join the game.
course.
pm.
song.
pn's current Steps to steps.
trail.
iFields
pn to Difficulty dc.
song.
sGroup.
so using ModsLevel m.
bOn.
bOn.
pn.
sMetricsGroup.
g.
sMetricsGroup.
pn to empty.
pn from RadarValues rv
pn to the specified (floating point) values in the table.
fSeconds.
tips (and optionally altTips).
sTips using colons to separate new sections.
hns.
tns.
true if this high score's name uses a fill-in marker.
INPUTFILTER.
true if failing.
true if the LifeMeter is "hot".
true if in danger.
iNumLives. (Negative values subtract lives.)
MEMCARDMAN.
true if player pn's card is locked.
pn.
true if player pn's name is available.
fSeconds.
bSilent.
bStealth. If
true, the timer will be invisible and silent.
MESSAGEMAN.
sMessage. The
second argument is an optional table of parameters. It may be omitted or explicitly
set to nil.
fWidth.
sAniName at fPlayRate speed (default 1.0).
fRate.
sAnimation at fPlayRate speed (default 1.0).
pn from the Metrics in group sMetricsGroup.
true if the order was changed.
true if the MusicWheel is currently handling Roulette selection.
n.
false on failure.
false on failure.
NETWORK.HttpEnabled=1 in the preferences. Individual hosts have to be added to HttpAllowHosts as a comma separated list to allow access.
url is allowed.
NETWORK:HttpRequest{
url="https://api.example.com",
method="GET", -- default: "GET"
body="", -- default: ""
multipartBoundary="", -- default: ""
headers={ -- default: {}
["Accept-Language"]="en-US",
["Cookie"]="sessionId=42",
},
connectTimeout=3, -- default: 60
transferTimeout=10, -- default: 1800
downloadFile="", -- default: no download file
onProgress=function(currentBytes, totalBytes) -- default: no callback
...
end,
onResponse=function(response) -- default: no callback
...
end,
}
Everything but url is optional. Supported methods are GET, POST, PUT, PATCH, DELETE and HEAD.
{
statusCode=200,
headers={
["Content-Type"]="application/json",
["Cache-Control"]="max-age=172800",
["Server"]="Apache",
},
body="{...}"
uploadSize=204,
downloadSize=216,
}
In case of an error the callback is called with a structure like this:
{
error="HttpErrorCode_Blocked",
errorMessage="access to https://api.example.com is not allowed",
}
If the downloadFile parameter is set, the response body is not accumulated in memory, but written to /Downloads/${downloadFile}.
The file is available in the onResponse callback where it can be unzipped/copied to another location using FILEMAN:Unzip()/FILEMAN:Copy() respectively.
The file is deleted once the callback returns.
NETWORK:WebSocket{
url="wss://api.example.com/chat",
headers={ -- default: {}
["Accept-Language"]="en-US",
["Cookie"]="sessionId=42",
},
handshakeTimeout=3, -- default: 60 seconds
pingInterval=10, -- default: disabled
automaticReconnect=false, -- default: true
onMessage=function(message) -- default: no callback
...
end,
}
Everything but url is optional.
-- Data
{
type="WebSocketMessageType_Message",
data="some data",
binary=false,
}
-- Open
{
type="WebSocketMessageType_Open",
uri="/chat",
headers={
["Date"]="Fri, 27 May 2022 18:50:47 GMT",
},
protocol="",
}
-- Close
{
type="WebSocketMessageType_Close",
reason="Normal closure",
remote=false,
}
-- Error
{
type="WebSocketMessageType_Error",
retries=1,
waitTime=100,
httpStatusCode=404,
reason="Expecting status 101 (Switching Protocol), got 404",
decompressionError=false,
}
value.
query encoded as a query string. Keys and values are automatically URL encoded.
NOTESKIN.
sNoteSkin.
sNoteSkin.
sNoteSkin.
sNoteSkin.
sNoteSkin.
sButton sElement.
sButton sElement using NoteSkin sNoteSkin.
sButton sElement.
sButton sElement using NoteSkin sNoteSkin.
true if the strName noteskin exists in the current gametype.
true if the first item in the row goes down.
pn is on.
true if this row is focused by player pn.
true if this row forces one choice on all players.
pn.
index in the current steps queue.
true, then instead of returning the previous settings as normal, they will instead return the PlayerOptions object.player_options:Twirl(5, 1, true):Roll(5, true):Dizzy(true):Twirl()true as the second arg to be used with chaining.player_options:Backwards(true, true):Beat(5) will chain. player_options:Backwards(true):Beat(5) will not chain.
-- Sets a to the current value and b to the current approach_speed
a,b = options:Boost()
-- Stores the previous values in a and b, NOT to 5 and .5
-- Sets the value to 5 and the approach speed to .5
a,b = options:Boost(5, .5)
-- Sets a and b to the previous values, NOT to 5 and .5
-- Sets the value to 5 and leaves the approach speed at whatever it was
a,b = options:Boost(5)
W1 to W5 as defined in the enum.
true if the current PlayerOptions makes the current Course/Trail easier.
true if the current PlayerOptions makes the current Song/Steps easier.
nil or the NoteSkin does not exist. Returns the name of the previous NoteSkin and whether the set attempt succeeded.
-- Sets note_name to the player's current noteskin
note_name = options:NoteSkin()
-- Sets prev_note_name to the noteskin the player had set
-- changes the current noteskin to "cel"
-- sets succeeded to true if the "cel" noteskin exists.
prev_note_name, succeeded = options:NoteSkin("cel")
true if the player is using reverse. (equivalent to GetReverse() == 1.0)
true if a full combo (TNS_W3 and up) was obtained.
true if a full combo (tns and up) was obtained.
true if the player failed.
tns.
true if the player was disqualified from ranking.
GetPlayerOptions before sm-ssc v1.2.3)
sPlayerOptions for the specified ModsLevel.
PREFSMAN.
sPreference.
sPreference exists.
sPreference to value.
sPreference to the default value.
Course c, Trail t)
Course c, Trail t)s has been played with the profile.
st.
g on.
g on.
Guest profiles appearing first, then Normal, then Test.true if the player has passed any steps in the specified Song s.
true if the specified code sUnlockEntryID is unlocked.
iCals calories.
iSecs seconds.
gt.
weightPounds.
PROFILEMAN.
pn.
pn.
/Save/LocalProfiles/00000001/.s has been played with the specified ProfileSlot.
true if player pn's profile is persistent.
true if Song s has never been played before (according to the machine profile).
true if the profile from the memory card is new.
true if pn's Profile was loaded from a memory card.
true if the last load of player pn's profile was a LastGood copy of the profile.
true if the last load of player pn's profile resulted in a tampered or corrupt profile.
pn.
rc from .
DISPLAY.
userdata of type ,
which describes the displays configured on the user's machine.
true if the current renderer supports render-to-texture,
false otherwise.
true if the current renderer/window implementation supports
a fullscreen borderless-window mode, false otherwise.
true if the current position within the file is the end. (EOF = End of File)
sPath (relative to the StepMania root directory).iAccessType can be set to read (1), write (2), stream (4) or flush to disk on close (8).iAccessType to 3 (1+2).
length bytes from the RageFile's current position.
str.
FILEMAN.
fromPath to toPath.
Returns true if the file was copied successfully.
true if a file exists at sPath.
sPath. The last two arguments are optional (and default to false).
sPath.
zipPath to targetPath.strip is optional and defaults to 0.
If set to a number larger than 0, that many components are removed from the paths of the extracted files. e.g. a/b/c is replaced with b/c when stripping one component or just c when stripping two.true if all files were extracted successfully.
INPUTMAN.
sProperty to fVal. The supported properties depend on how the associated was loaded.
sProperty to fVal. The supported properties depend on how the associated was loaded.
fPitch. The associated have SupportsRateChanging = true on load.
fSpeed. The associated must have SupportsRateChanging = true on load.
fVolume, which is between 0..1.
{left, top, right, bottom}.
bLoop.
fPos.
fRate.
sGroupName.
f.
callback to the list of functions the screen will pass input to, giving Lua access to player input as it occurs.callback will be passed a table with the details of the event. callback must return a bool to indicate whether the event was handled. If callback returns true, the event will not be passed any further.
local InputHandler = function( event )
-- do something cool with the event table in here :)
-- the details of the event table are documented below
-- example:
-- show the GameButton that was most recently pressed/held
if event.type ~= "InputEventType_Release" then
SCREENMAN:SystemMessage( event.GameButton )
end
return false
end
Def.ActorFrame{
OnCommand=function(self)
SCREENMAN:GetTopScreen():AddInputCallback( InputHandler )
end
}
Details of the event table:
{
-- The "semi-raw" button that was pressed. This is what
-- the button was mapped to by the keymap settings, without
-- the conversions that occur when OnlyDedicatedMenuButtons
-- is true. Will be empty if the button was not mapped.
button = string,
-- "InputEventType_FirstPress", "InputEventType_Repeat",
-- or "InputEventType_Release".
type = string,
-- The "cooked" button that was pressed. This is button with
-- mapping that occurs when OnlyDedicatedMenuButtons is true
-- applied. This is nil for unmapped buttons.
GameButton = string,
-- The player that the controller is mapped to, or nil.
PlayerNumber = PlayerNumber,
-- The game controller this event was mapped to.
-- "GameController_1" or "GameController_2", or nil if the event
-- wasn't mapped to either controller.
controller = string,
-- The details of the event.
DeviceInput = {
-- The type of device. The first half of the string will
-- be "Device_", the second half will be from InputDeviceNames
-- in RageInputDevice.cpp.
device = string,
-- The button that was pressed. The first half of the string
-- will be "DeviceButton_", the second half will be from InitNames
-- in RageInputDevice.cpp.
button = string,
-- A floating point value for analog input.
level = float,
-- Mousewheel input.
z = float,
-- Whether the button is down. This is level with a threshold
-- and debouncing applied.
down = bool,
-- How long ago this input occurred, in seconds.
ago = float,
-- True if the device is a joystick.
is_joystick = bool,
-- True if the device is a mouse.
is_mouse = bool
},
-- Unknown purpose. SMOnline?
MultiPlayer = string
}
f seconds.
sScreenMsg to the Screen after fDelay seconds.
true if a single has its NoteField centered using the Center1Player preference.false if the current theme has AllowCenter1Player=false under [ScreenGameplay].false when the player's NoteField is visually centered, as is convention in double style or Techno_Single8.pn.
pn.
true if the game is paused.
bPause.
SCREENMAN.
sMessage is an optional ScreenMessage posted once the new screen is finished.)
true if screen class s exists.
true if screen s is prepared.
s.
true if Player pn backspaced successfully.
true if Player pn was able to add sKey to their name.
pn and returns true
if successful.
true if anyone is entering their name.
true if anyone is still entering their name.true if Player pn is entering their name.
true if Player pn is finished entering their name.
pn.
true if all active players are on the last options row.
true if the specified player is on an items that ends the screen.
pn is on. (Was previously GetCurrentRow.)
true if we are going to PlayerOptions.
true if there is a profile that can be loaded.
true if there is a profile that can be saved.
pn's current selected item as an integer.
true if the player is going to the options screen.
pn
true
if successful.
pn to iProfileIndex.iProfileIndex have special, hardcoded behavior:-1: join the player and play the theme's start sound effect-2: unjoin the player, unlock their MemoryCard, and unmount their MemoryCard-3: allow the user to play without a local or USB profile (as a guest)
local args = {
Question="Do you like Waffles?",
InitialAnswer="Yeah, we like waffles!",
MaxInputLength=300,
OnOK=function(answer)
-- answer is what the player typed
local msg = "Your response was: " .. answer
SCREENMAN:SystemMessage(msg)
end
}
SCREENMAN:AddNewScreenToTop("ScreenTextEntry")
SCREENMAN:GetTopScreen():Load( args )
args.
local args = {
-- ScreenMessage to send on pop
-- optional, "SM_None" if omitted
SendOnPop = "",
-- the question text to display
Question = "",
-- initial answer text
InitialAnswer = "",
-- Maximum amount of characters
MaxInputLength = 0,
-- mask character input (optional)
Password = false,
-- validation function
-- must return boolean and string
Validate = function(answer, errorStr) end,
-- function called on ok
OnOK = function(answer) end,
-- function called on cancel
OnCancel = function() end,
-- Validate appending a character
-- must return boolean
ValidateAppend = function(answer, append) end,
-- Format answer for display
-- must return string
FormatAnswerForDisplay = function(answer) end
}
true if the screen is currently transitioning.
sScreenMsg. To go to the next screen, use "SM_GoToNextScreen" as the argument.
nil.
nil.
{start_beat=1.0, rate=1.0, transition="example", effect="example", file1="example", file2="example", color1="#FFFFFFFF", color2="#FFFFFFFF"}
nil.
nil.
nil otherwise.)
st.
true if the song has steps for the specified difficulty in st.
true if the song has attacks.
true if the song has a background.
true if the song has a banner.
true if the song has BGChanges.
true if the song has a CD image.
true if the song has a CDTitle.
true if the song has a Disc graphic.
true if the song has edits.
true if the song has a jacket graphic.
true if the song has lyrics.
true if the song has music.
true if the song has a preview video.
true if the song has significant BPM changes or stops.
true if the song has the specified StepsType.
true if the song's DisplayBPM is constant.
true if the song's DisplayBPM is random.
true if the song's DisplayBPM is secret.
true if the song is considered easy.
true if the song is enabled.
true if the song meets the criteria for a "Long Version".
true if the song meets the criteria for "Marathon" length.
true if the song and the specified steps have different timing.
true if the song only has Beginner steps.
true if the song is normally displayed.
true if the song is shown in Demonstration and Ranking.
SONGMAN.
true if the specified course group exists.
true if the specified song group exists.
sCourse is found.
sSong is found.
c.
s. If b2ndExtra is true, it will use the second Extra Stage data instead of the first.
0.
0.
s.
st.
sGroupName.
s.
sGroupName.
{theme}/Other/SongManager sListName.txt.
(New since ITGmania 0.6.0) If the optional argument bIsAbsolute is set, instead treats
sListName as an absolute path instead of loading it from the Theme's Other directory.
{theme}/Other/SongManager sListName.txt.
(New since ITGmania 0.6.0) If the optional argument bIsAbsolute is set, instead treats
sListName as an absolute path instead of loading it from the Theme's Other directory.
false.
false.
true if a Delay is active.
true if a Freeze is active.
Texture attribute.
local spr = Def.Sprite{
Texture="path/to/mycoolimage.png"
}
Frame-based animated sprites can be initialized with the Frames attribute.
local spr = Def.Sprite{
Texture="path/to/Spikes 6x3.png",
Frames=Sprite.LinearFrames(18, 1)
}
Frames table consisting of iNumFrames frames lasting for a total of fSeconds seconds.Frames = Sprite.LinearFrames( 5, 2.6 ).
sPath is nil, then unload the texture. Otherwise, load the texture at path sPath.
sPath.
sPath.
sType from the cache based on sPath.
Internal types: "Banner", "Background", "CDTitle", "Jacket", "CDImage" and "Disc".
song's background.
song's banner.
mode.
fSeconds.
{
{ Frame=0, Delay=0.333, {0, 0}, {.25, .25} },
{ Frame=1, Delay=0.333, {0, 0}, {.25, .25} },
{ Frame=2, Delay=0.333, {0, 0}, {.25, .25} },
{ Frame=3, Delay=0.333, {0, 0}, {.25, .25} },
}
Frame is optional, defaulting to 0.Delay is optional, defaulting to 0.
{
{Frame=0, Delay=0.333},
{Frame=1, Delay=0.333},
{Frame=2, Delay=0.333},
{Frame=3, Delay=0.333}
}
This example makes the sprite use the whole of each frame.
texture.
RageTexture:loop( bLoop ) on the texture.
RageTexture:position( fPos ) on the texture.
RageTexture:rate( fRate ) on the texture.
fWidth and height fHeight clipping if the dimensions do not match.
iNewState.
use is true, then the sprite will use the effect clock for texcoordvelocity.
fWidthxfHeight.
fRate. Useful for Sprites that need to change by BPM (e.g. Tran from DDR 5th Mix, the cube from DS EuroMix 2).
true if everyone failed.
true if any player has given up on the song.
mp.
pn.
true if at least one person passed.
true if player pn has a high score.
STATSMAN.
pn's final grade.
pn's final grade.
iAgo rounds ago.
true if the Steps has any attacks.
true if the Steps pattern has significant timing changes.
pn. Use to grab a specific value.
true if the Steps are an edit.
true if the Steps are a player edit (loaded from a profile).
true if the steps were automatically generated.
true if the DisplayBPM is constant.
true if the DisplayBPM is random.
true if the DisplayBPM is secret.
true if the Steps use different TimingData from the Song.
sMetricsGroup.
pn.
pSteps.
iMeter, and Difficulty.
pTrail.
Track, XOffset, and Name of the column.GAMESTATE:GetCurrentStyle():GetColumnInfo('PlayerNumber_P1', 2) when the current
game is dance will return {Track=2, XOffset=-32, Name="Down"}.GAMESTATE:GetCurrentStyle():GetColumnInfo('PlayerNumber_P1', 1) when the current
game is pump will return {Track=1, XOffset=-96, Name="DownLeft"}.true if this style locks the difficulty for both players.
false.
THEME.
true if the specified language exists in the current theme.
true if the specified theme exists.
Element in Class from metrics.ini.
Class from metrics.ini.
ClassName Element in the BGAnimations folder.
local path, metrics_group, element = THEME:GetPathInfoB("ScreenTitleJoin", "decorations")
Element in Class for the currently loaded language.
Class for the currently loaded language.
{
[1]="Home",
[2]="default",
[3]="_fallback"
}
true if the theme has the specified metric.
true if the theme has the specified string.
true if the specified theme is selectable.
false (or nothing) is the argument to these functions, they return tables of strings. The strings are numbers separated by '='.true, they return tables of tables, and the inner tables contain numbers as described for each function.
local bpms_and_times = timing_data:GetBPMsAndTimes()
for i, s in ipairs(bpms_and_times) do
local bpm_and_time = split("=", s)
bpms_and_times[i] = {tonumber(bpm_and_time[1]), tonumber(bpm_and_time[2])}
end
-- do something with the bpms and times now that they are numbers.
local bpms_and_times = timing_data:GetBPMsAndTimes(true)
-- do something with the bpms and times because they are already numbers.
fElapsedTime.
fBeat.
fBeat.
true if the TimingData contains BPM changes.
true if the TimingData contains delays.
true if the TimingData contains any BPM changes with a negative BPM.
true if the TimingData contains stops.
true if the TimingData contains warps.
true if the TimingData contains fake segments.
true if the TimingData contains speed scrolling changes.
true if the TimingData contains general scrolling changes.
true if song s is in the Trail.
iEntry.
true if any of the Trail entries are secret.
m_sEntryID.
sCourseName.course,"Driven"
true if the UnlockEntry requires you to pass Hard steps.
true if the UnlockEntry requires you to pass Challenge steps.
true if the UnlockEntry is locked.
sModifier.
m_fRequirement.
sSongName. sSongName also requires the group.song,"In The Groove/Pandemonium"
steps,"In The Groove/Pandemonium","expert"
UNLOCKMAN.
true if there are any unlocks to celebrate.
sEntryID.
sEntryID.
iIndex.
sUnlockEntryID
data.
If the optional binary argument is set to true, the message is marked as binary.iIndex.
true if the wheel is locked.
true if the wheel is settled/stopped moving.
n.
sSection.
iSongIndex.
-- using strings
GAMESTATE:SetPreferredDifficulty( "PlayerNumber_P1", "Difficulty_Hard" )
-- using values
GAMESTATE:SetPreferredDifficulty( 0, 3 )
-- using global Lua tables
GAMESTATE:SetPreferredDifficulty( PlayerNumber[1], Difficulty[4] )
It's worth pointing out that, as tables, these enums can be iterated over using or . This can be handy when you want to perform some action on every value in an enum; for example, displaying a graphic for each Difficulty.
-- Difficulty is a global Lua table that corresponds with
-- the StepMania engine's Difficulty enum
for i, diff in ipairs(Difficulty) do
-- append a file extension to create a string like
-- "Difficulty_Beginner.png"
local filename = diff .. ".png"
-- load files like "Difficulty_Beginner.png",
-- "Difficulty_Easy.png", etc. from the directory
-- where this code is run, and offset each vertically
af[#af+1] = LoadActor( filename )..{
InitCommand=function(self) self:y( i * 100 ) end
}
end
ProfileSortOrder preference. The engine initially sorts profiles based on their , showing Guest profiles first, then Normal, then Test. ProfileSortOrder allows additional subsorts to be configured.Priority allows users to manually sort profiles using the Priority= key in each profile's Type.ini file. New profiles are created with Priority=0. A profile with Priority=0 will appear before any profiles with Priority=1 which will appear before any profiles with Priority=2 and so on.Recent automatically sorts profiles in the order they are used, with the most recently used profile appearing first.
DISPLAY, NOTESKIN, etc.).
-- use GameState's singleton to get the current song
local song = GAMESTATE:GetCurrentSong()
-- use ScreenManager's singleton to briefly show text on-screen
SCREENMAN:SystemMessage("hello from Lua!")
Def table.
-- Sprite, Sound, and Quad are each Actors with unique specializations
local spr = Def.Sprite{ Texture="./path/to/image.png" }
local snd = Def.Sound{ File="./path/to/soundeffect.ogg" }
local sqr = Def.Quad{ InitCommand=function(self) self:xy(80, 100) end }
-- common convention is to not use () with actor
-- functions, but syntax like this is also valid
local args = { Texture="./path/to/image.png" }
local spr = Def.Sprite(args)
[ScreenTitleJoin] or
[ScreenPlayerOptions].