Save the script as modmgr.lua
, inside a folder on StepMania's Lua path (e.g. /Program
or /Program/lua
).
StepMania will read lua/default.lua
inside the song directory.
Add an FGCHANGES
line to the .ssc and .sm files:
#FGCHANGES:0.000=lua=1.000=0=0=1=====;
Inside default.lua
, import modmgr
and create a new instance:
local modmgr = require("modmgr")()
Register a table of mods, which maps the beat to a mod function (the arguments are a PlayerOptions
instance, and the current beats per second):
modmgr:add({
-- e.g. swap arrows between top and bottom at the top:
[15] = function(opts, bps) opts:Split(1, bps) end, -- left, down
[17] = function(opts, bps) opts:Cross(1, bps) end, -- left, up
[19] = function(opts, bps) opts:Reverse(1, bps) end, -- down, right
[21] = function(opts, bps) opts:Split(0, bps) end, -- down, up
-- and reset to normal
[23] = function(opts, bps) opts:Cross(0, bps * 2) end,
[23.5] = function(opts, bps) opts:Reverse(0, bps * 2) end,
})
Each call to add()
can take two additional arguments: diffs
(a table of difficulty names to restrict the mods to) and plrs
(as before but for active players).
Finally, add the actor to the rest of the frame:
return Def.ActorFrame({
Def.Actor({
Name = "Preserver",
OnCommand = cmd(sleep, 1000)
}),
modmgr:actor()
})