Advertisement
Jousway

SMLoader V0.01

Jun 7th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. function SMLoader(Steps)
  2.     local Open_SM = RageFileUtil.CreateRageFile()
  3.    
  4.     local CurGS = ToEnumShortString(Steps:GetStepsType()):lower():gsub("_","-")
  5.     local CurDiff = ToEnumShortString(Steps:GetDifficulty())
  6.     local FBeat = GAMESTATE:GetCurrentSong():GetFirstBeat()
  7.    
  8.     local function CheckGS(Line)
  9.         for i in string.gmatch(Line, "%s+(.-):") do
  10.             if i == CurGS then
  11.                 return true
  12.             end
  13.         end
  14.         return false
  15.     end
  16.    
  17.     local function CheckDiff(Line)
  18.         for i in string.gmatch(Line, "%s+(.-):") do
  19.             if i == CurDiff then
  20.                 return true
  21.             end
  22.         end
  23.         return false
  24.     end
  25.    
  26.     Open_SM:Open(Steps:GetFilename(), 1)
  27.     SM_File = Open_SM:Read()
  28.    
  29.     Output = {}
  30.    
  31.     for i in string.gmatch(SM_File, "#NOTES:.-;") do
  32.         if CheckGS(i) and CheckDiff(i) then
  33.             local Beat = 0
  34.             for i2 in string.gmatch(i:gsub(".+:",""):gsub(";",","):gsub("//.-\n",""):gsub(" ",""), "%s(.-),") do
  35.                 Beat = Beat + 4
  36.                 AL = 0
  37.                 CL = 0
  38.                 for _ in string.gmatch(i2, "%w+") do
  39.                     AL = AL + 1
  40.                 end
  41.                 for i3 in string.gmatch(i2, "%w+") do
  42.                     SBeat = (Beat-4)+((4/AL)*CL)
  43.                     CL = CL + 1
  44.                     CI = 1
  45.                     for i4 in string.gmatch(i3, "%w") do
  46.                         if i4 == "1" then
  47.                             Output[#Output+1] = {SBeat,Exp_Buttons[GAMESTATE:GetCurrentGame():GetName()][GAMESTATE:GetCurrentStyle():GetName()][CI]}
  48.                         end
  49.                         CI = CI + 1
  50.                     end
  51.                 end
  52.             end
  53.         end            
  54.     end
  55.     return Output
  56. end
  57.  
  58. Exp_Buttons = {
  59.     dance = {
  60.         single = {"Left","Down","Up","Right"},
  61.         solo = {"Left","UpLeft","Down","Up","UpRight","Right"},
  62.     },
  63.     pump = {},
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement