Skip to content

Instantly share code, notes, and snippets.

local item_mt= {
__index= {
-- create_actors must return an actor. The name field is a convenience.
create_actors= function(self, params)
self.name= params.name
return Def.BitmapText{
Name= name, Font= "Common Normal", InitCommand= function(subself)
-- Setting self.container to point to the actor gives a convenient
-- handle for manipulating the actor.
self.container= subself
local function make_beat_wave(params)
-- triangle wave - n results in the section above zero having width 1-n
-- so triangle - (1-w) will give us width w
-- time_wave_input is doubled and offset to put a peak on every beat.
local triangle= {'triangle', {'+', .5, {'*', 2, params.time}}}
local above_zero_is_width= {'-', triangle, {'-', 1, params.width}}
-- height above zero needs to be 1, but is currently w.
-- <result> / w will make the height 1
local height_is_one= {'/', above_zero_is_width, params.width}
-- then max is used to clip off the parts of the wave that are below
local fps_min= 1000
local fps_max= 0
local fps_check_total= 0
local fps_check_count= 0
local fps_history= {}
local next_fps_check_time= 0
local timer= false
local function fps_check_update(self, delta)
local time= timer:GetSecsIntoEffect()
local fps= DISPLAY:GetFPS()
#!/bin/bash
# You must change '~/'stepmania to the actual path to your stepmania folder for this to work.
# '~/' is your home folder. '~/stepmania' is a folder named 'stepmania' inside your home folder.
cd ~/stepmania
# git stash commands are for people that edit the source and don't commit their changes or make pull requests
# Uncommand the git stash commands if you edit the source. If you commit local changes to a local branch, you probably know which git commands to use instead.
# git stash
local status_name= false
local status_value= false
local frame= Def.ActorFrame{
Def.BitmapText{
Font= "Common Normal", InitCommand= function(self)
status_name= self
self:xy(32, 64):horizalign(left)
end
},
Def.BitmapText{
-- This actor belongs in ScreenGameplay.
-- Look for "BGAnimations/ScreenGameplay overlay.lua"
-- or "BGAnimations/ScreenGameplay overlay/default.lua"
-- and add it to the list of actors returned by the file.
t[#t+1]= Def.Actor{
OnCommand= function(self)
local spline_positions= {}
local radius= 512
local y_offset= 192
local z_offset= -512
-- This actor belongs in ScreenGameplay.
-- Look for "BGAnimations/ScreenGameplay overlay.lua"
-- or "BGAnimations/ScreenGameplay overlay/default.lua"
-- and add it to the list of actors returned by the file.
t[#t+1]= Def.Actor{
OnCommand= function(self)
-- This position table only works for dance single, because supporting
-- all styles would make this example too big.
local custom_column_positions= {
-- Swap up and down for player 1.
Menu data example:
{ -- Each table inside this table is one item in the menu.
-- A menu can have any number of items.
{name= "foo", arg= {}, func= function(arg) end},
-- arg is for any information that func needs. The menu system will not
-- touch arg in any way except to pass it to func.
-- func must return the action to perform when the item is chosen.
-- If func returns nil, the menu stays as-is.
-- If func returns "'refresh', {}", the table replaces the current menu.
-- If func returns "'submenu', {}", the table is another menu to open.

Purpose

This is a generalized system for creating mods that use the 5.1 mod system and can be picked in a nesty menu to apply in gameplay.

This is not a system for changing the mods affecting a player as part of a scripted simfile.

Mods chosen can be saved to the player's profile, and will be loaded when the profile is loaded.

Purpose

item_scroller is a lua based alternative to ActorScroller. It's designed around actors controlled by lua objects to display whatever data the theme wants.

The item_scroller creates a fixed number of items when the create_actors function is called. These are then set to the information elements based on the current scroll position and their transform function is called to position them.