Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- path is where the file lives relative to StepMania's root.
- local path = "Save/_freezone/CurrentSong.txt"
- local function player_current_song_stats(pn)
- local outStr = ""
- local song = GAMESTATE:GetCurrentSong();
- if song then
- -- attach song dir
- local songDir = song:GetSongDir()
- outStr = outStr .. "\"" .. songDir .. "\""
- -- attach stepstype and difficulty
- local steps = GAMESTATE:GetCurrentSteps(pn)
- if steps then
- local st = string.gsub(ToEnumShortString(steps:GetStepsType()),"_","-")
- local diff = ToEnumShortString(steps:GetDifficulty())
- outStr = outStr .. " " .. st .. " " .. diff
- end;
- -- attach rate mod
- local sOptions = GAMESTATE:GetSongOptionsObject("ModsLevel_Song")
- if sOptions then
- local sRate = sOptions:MusicRate()
- outStr = outStr .. " " .. sRate
- end;
- return outStr
- end
- end
- function write_current_song_stats()
- local str= ""
- if GAMESTATE:IsCourseMode() then return end
- for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
- str= str .. player_current_song_stats(pn)
- end
- local file= RageFileUtil.CreateRageFile()
- if not file:Open(path, 2) then
- Warn("Could not open '" .. path .. "' to write current playing info.")
- else
- file:Write(str)
- file:Close()
- file:destroy()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement