Advertisement
Jousway

AMod System Prototype *WORKING*

Apr 16th, 2013
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. local bpmtime = GAMESTATE:GetCurrentSong():GetTimingData():GetBPMsAndTimes();
  2. local numbbpms = 0; for _ in pairs(bpmtime) do numbbpms = numbbpms + 1 end;
  3.    
  4. local Btime = {};
  5. local Bbpm = {};
  6. local AverageBPM;
  7. local bpmt1;
  8. local bpmt2;
  9. local bpmt3;
  10.  
  11. for i=1,#bpmtime do
  12.     _, _, Btime[i], Bbpm[i] = string.find(bpmtime[i], "(%d+%p%d+)=(%d+%p%d+)");
  13. end;
  14.  
  15. for v=1,#bpmtime do
  16.     if numbbpms == 1 then
  17.         AverageBPM = Bbpm[1];              
  18.     elseif Btime[v+2] ~= nil then
  19.         bpmt1 = Btime[v+1] - Btime[v];
  20.         bpmt2 = Btime[v+2] - Btime[v+1];
  21.         if bpmt1 > bpmt2 then
  22.             if bpmt3 == nil then
  23.                 AverageBPM = Bbpm[v];
  24.                 bpmt3 = bpmt1;
  25.             elseif bpmt1 > bpmt3 then
  26.                 AverageBPM = Bbpm[v];
  27.                 bpmt3 = bpmt1;
  28.             end;
  29.         else
  30.             if bpmt3 == nil then
  31.                 AverageBPM = Bbpm[v+1];
  32.                 bpmt3 = bpmt2;
  33.             elseif bpmt2 > bpmt3 then
  34.                 AverageBPM = Bbpm[v+1];
  35.                 bpmt3 = bpmt2;
  36.             end;
  37.         end;
  38.     elseif Btime[v+1] ~= nil then
  39.         bpmt1 = Btime[v+1] - Btime[v];
  40.         bpmt2 = GAMESTATE:GetCurrentSong():GetLastSecond() - Btime[v+1];
  41.         if bpmt1 > bpmt2 then
  42.             if bpmt3 == nil then
  43.                 AverageBPM = Bbpm[v];
  44.                 bpmt3 = bpmt1;
  45.             elseif bpmt1 > bpmt3 then
  46.                 AverageBPM = Bbpm[v];
  47.                 bpmt3 = bpmt1;
  48.             end;
  49.         else
  50.             if bpmt3 == nil then
  51.                 AverageBPM = Bbpm[v+1];
  52.             elseif bpmt2 > bpmt3 then
  53.                 bpmt3 = bpmt2;
  54.                 AverageBPM = Bbpm[v+1];
  55.                 bpmt3 = bpmt2;
  56.             end;
  57.         end;
  58.     end;
  59. end;
  60.  
  61. local optionsp1 = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerOptionsString("ModsLevel_Preferred");
  62. GAMESTATE:GetPlayerState(PLAYER_1):SetPlayerOptions('ModsLevel_Preferred', optionsp1 .. "," .. 750/AverageBPM .."x"); --setting it to A750
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement