GetX().
+ b.
fRate * fRate), where fRate is in seconds.
+ Plays the commands that follow at an accelerated rate (fRate²), where fRate is in seconds.accelerate is a basic tween command, along with , , , and .
rot to the Actor's current x rotation.
+ Adds rot degrees to the Actor's current X rotation.
rot to the Actor's current y rotation.
+ Adds rot degrees to the Actor's current Y rotation.
rot to the Actor's current z rotation.
+ Adds rot degrees to the Actor's current Z rotation.
xPos to the Actor's current x position.
@@ -1073,13 +1079,13 @@ save yourself some time, copy this for undocumented things:
Sets the Actor's base alpha to fAlpha, where fAlpha is in the range 0..1.
rot.
+ Sets the Actor's base X rotation to rot degrees.
rot.
+ Sets the Actor's base Y rotation to rot degrees.
rot.
+ Sets the Actor's base Z rotation to rot degrees.
zoom.
@@ -1109,13 +1115,16 @@ save yourself some time, copy this for undocumented things:
[02 Actor.lua]
x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y)
+ [02 Actor.lua] Centers an Actor on the screen.self:Center() is equivalent to self:x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y)
x,SCREEN_CENTER_X)
+ [02 Actor.lua] Centers an Actor on the X axis.self:CenterX() is equivalent to self:x(SCREEN_CENTER_X)
y,SCREEN_CENTER_Y)
+ [02 Actor.lua] Centers an Actor on the y axis.self:CenterY() is equivalent to self:y(SCREEN_CENTER_Y)
percent of the Actor from the top, where percent is in the range 0..1.
mode.
+ Sets the Actor's to mode.
fRate) * (1-fRate)), where fRate is in seconds.
+ Plays the commands that follow at an decelerated rate (1 - (1-fRate) * (1-fRate)), where fRate is in seconds.decelerate is a basic tween command, along with , , , and .
c.
@@ -1150,7 +1160,9 @@ save yourself some time, copy this for undocumented things:
Sets the Actor's alpha level to fAlpha, where fAlpha is in the range 0..1.
c.
@@ -1168,13 +1180,17 @@ save yourself some time, copy this for undocumented things:
Sets the Actor's lower right corner color to c.
c.
c.
@@ -1277,8 +1293,8 @@ save yourself some time, copy this for undocumented things:
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. See for the common case.
@@ -1360,7 +1384,8 @@ save yourself some time, copy this for undocumented things:
Hurries up an Actor's tweening by factor.
fRate is in seconds.
+ Plays the commands that follow at a normal (linear) rate, where fRate is in seconds.linear is a basic tween command, along with , , , and .
side ("Back" or "Front").
@@ -1399,13 +1424,13 @@ save yourself some time, copy this for undocumented things:
Sets the roll of this Actor to fRoll.
fAlign.
+ Set the Actor's rotation on the X axis to fRotation degrees.
fAlign.
+ Set the Actor's rotation on the Y axis to fRotation degrees.
fAlign.
+ Set the Actor's rotation on the Z axis to fRotation degrees.
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. See for the common case.
@@ -1575,6 +1605,66 @@ save yourself some time, copy this for undocumented things:
1).
+-- in the context of a lua file as a screen layer
+-- this ActorFrame is a 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 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
+
+ ActorFrames can contain ActorFrames, and doing so is good design for sufficiently complex screens.
+ sName.sName.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}
+
Def.Sound.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.
+ • 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,
+}
+
Font attribute. It takes a font name 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.st.
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
+
bStealth. If
true, the timer will be invisible and silent.
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)
+
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 was disqualified from ranking.
rc from .
@@ -4580,7 +4764,7 @@ save yourself some time, copy this for undocumented things:
This singleton is accessible to Lua via INPUTMAN.
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
+}
+
s.
true if all active players are on the last options row.
@@ -4962,18 +5226,76 @@ save yourself some time, copy this for undocumented things:
Returns the profile index of the specified Player.
pn to iProfileIndex.iProfileIndex have special, hardcoded behavior:-1: join the player and play the theme's start sound effectpn 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
+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
+}
+
nil.
nil.
{start_beat=1.0, rate=1.0, transition="example", effect="example", file1="example", file2="example", color1="#FFFFFFFF", color2="#FFFFFFFF"}
nil.
nil.
s. (If bExtra2 is true, it will use the second Extra Stage data instead of the first. Again, Lua.xsd sucks)
+ s. If b2ndExtra is true, it will use the second Extra Stage data instead of the first.
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. This function is not a member function and should be used as Frames = Sprite.LinearFrames( 5, 2.6 ).
+ [02 Sprite.lua] Returns a 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.
@@ -5429,19 +5781,29 @@ save yourself some time, copy this for undocumented things:
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.
Track, XOffset, and Name of the column.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"}.{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"}.{Track=1, XOffset=-96, Name="DownLeft"}.local path, metrics_group, element = THEME:GetPathInfoB("ScreenTitleJoin", "decorations")
+{
+ [1]="Home",
+ [2]="default",
+ [3]="_fallback"
+}
+ true if the theme has the specified metric.
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.
+