Fix for #24 plus preventative measures in place in case the displaybpm does something...
authorCameron Ball <c.ball1729@gmail.com>
Mon, 16 Dec 2013 02:54:49 +0000 (10:54 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Mon, 16 Dec 2013 02:54:49 +0000 (10:54 +0800)
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/Scripts/gnSystem.lua

index 612cf6f..15f9a52 100644 (file)
@@ -458,7 +458,7 @@ function DisplayBPM(pn)
 
     local rateMod = string.gsub(GetRateMod(),'x','')
 
-    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil then
+    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil or tonumber(lowBPM) == nil then
         return "???"
     end
 
@@ -478,7 +478,7 @@ function DisplayScrollSpeed(pn)
        
     if speedMod.Type == "c-mod" or speedMod.Type == "m-mod" then return tostring((speedMod.Base + speedMod.Extra)*100) end
 
-    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil then
+    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil or tonumber(lowBPM) == nil then
         return "???"
     end
 
index a0a9e02..e2da466 100644 (file)
@@ -376,7 +376,12 @@ RegisterEasterEgg("NoScope", BPMEasterEggs)
 local function LowBPM( BPMDisplay )
        BPMDisplay = BPMDisplay:GetText()
        
+        Trace("YOLOSWEGGER " .. BPMDisplay)
+
        local pos = string.find(BPMDisplay, "-")
+
+        if pos == 1 then pos = string.find(BPMDisplay, "-", 2) end -- if we have a negative bpm at the start then look for another occurence after
+
        if pos then return string.sub(BPMDisplay,1,pos-1) else return BPMDisplay end
 end
 
@@ -384,6 +389,9 @@ local function HighBPM( BPMDisplay )
        BPMDisplay = BPMDisplay:GetText()
 
        local pos = string.find(BPMDisplay, "-")
+        
+        if pos == 1 then pos = string.find(BPMDisplay, "-", 2) end -- if we have a negative bpm at the start then look for another occurence after
+
        if pos then return string.sub(BPMDisplay,pos+1) else return BPMDisplay end
 end