#7 Pretty sure applying an M-Mod internally applies an X-Mod, which is the source...
authorCameron Ball <c.ball1729@gmail.com>
Sun, 8 Dec 2013 16:29:54 +0000 (00:29 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Sun, 8 Dec 2013 16:29:54 +0000 (00:29 +0800)
Themes/GrooveNights/Scripts/GrooveNights.lua
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/Scripts/SpeedMods.lua [new file with mode: 0644]

index 70fe917..5493e87 100644 (file)
@@ -1248,77 +1248,8 @@ return 0;
 
 end
 
-       
 bpm = { "1", "2", "3" }
 
-function GetRateMods()
-       return { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x", "2.0x"}
-end
-
-function GetBaseSpeeds()
-    if GetSpeedModRowType() == "pro" then
-        return { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" }
-    end
-        
-    if GetSpeedModRowType() == "advanced" then
-        if OPENITG then baseSpeed = { "0.25x", "0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.25x", "2.5x", "2.75x", "3x", "3.25x", "3.5x", "3.75x", "4x", "4.25x", "4.5x", "4.75x", "5x", "5.25x", "5.5x", "5.75x", "6x", "6.25x", "6.5x", "6.75x", "7x", "c400", "c425", "c450", "c475", "c500", "c525", "c550", "c575", "c600", "c625", "c650", "c675", "c700", "c725", "c750", "c775", "c800", "c825", "c850", "c875", "c900", "c925", "c950", "c975", "c1000", "m400", "m425", "m450", "m475", "m500", "m525", "m550", "m575", "m600", "m625", "m650", "m675", "m700", "m725", "m750", "m775", "m800", "m825", "m850", "m875", "m900", "m925", "m950", "m975", "m1000" }
-        else baseSpeed = { "0.25x", "0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.25x", "2.5x", "2.75x", "3x", "3.25x", "3.5x", "3.75x", "4x", "4.25x", "4.5x", "4.75x", "5x", "5.25x", "5.5x", "5.75x", "6x", "6.25x", "6.5x", "6.75x", "7x", "c400", "c425", "c450", "c475", "c500", "c525", "c550", "c575", "c600", "c625", "c650", "c675", "c700", "c725", "c750", "c775", "c800", "c825", "c850", "c875", "c900", "c925", "c950", "c975", "c1000" }
-        end
-    end
-
-    if GetSpeedModRowType() == "basic" then
-        if OPENITG then baseSpeed = { "1x", "1.5x", "2x", "2.5x", "3x", "3.5x", "4x", "4.5x", "5x", "6x", "c450", "m450" }
-        else baseSpeed = { "1x", "1.5x", "2x", "2.5x", "3x", "3.5x", "4x", "4.5x", "5x", "5.5x", "6x", "c450" }
-        end
-    end
-end   
-
-function GetExtraSpeeds()
-       if GetSpeedModRowType() == "pro" then 
-               return { "0", "+0.25", "+0.5", "+0.75", "+0.1", "+0.2", "+0.3", "+0.4", "+0.6", "+0.7", "+0.8", "+0.9" }
-       end
-       
-       if GetSpeedModRowType() == "advanced" then
-               return { "0" }
-       end
-       
-       if GetSpeedModRowType() == "basic" then
-               return { "0" }
-       end
-end
-
-function GetSpeedModTypes() 
-    if OPENITG then
-        return { "x-mod", "c-mod", "m-mod" }
-    else
-        return { "x-mod", "c-mod" }
-    end
-end
-
-function RateMods()
-       local modList = GetRateMods();
-
-       local function Load(self, list, pn)
-               for n = 1, table.getn(modList) do
-                       if GAMESTATE:PlayerIsUsingModifier(pn,modList[n]..'music') then list[n] = true else list[n] = false end
-               end
-       end
-
-       local function Save(self, list, pn)
-               for n = 1, table.getn(modList) do
-                       if list[n] then
-                               GAMESTATE:ApplyGameCommand('mod,'..modList[n]..'music',pn)
-                               --ApplyRateAdjust()
-                               Trace("The pn for ratemod is " .. pn)
-                               MESSAGEMAN:Broadcast('RateModChanged')
-                       end
-               end
-       end
-
-       local Params = { Name = "Rate" }
-       return CreateOptionRow( Params, modList, Load, Save )
-end
-
 -- Stamina Mod
 StaminaMods = { 0, 0.01, 0.02, 0.03, 0.04, 0.05 }
 Stamina = { "None", "Aoreo", "Jayce", "SteveReen", "WinDEU", "Zetorux" }
index 3490245..7922245 100644 (file)
@@ -428,115 +428,6 @@ function GetModifierNames( num )
        return s
 end
 
-function GetRateMod()
-       local RateMods = GetRateMods()
-       for n = 1, table.getn(RateMods) do
-               if GAMESTATE:PlayerIsUsingModifier(0, RateMods[n] .. 'music') or GAMESTATE:PlayerIsUsingModifier(1, RateMods[n] .. 'music') then
-                       return RateMods[n]
-               end
-       end
-
-       return '(Unknown rate mod)'
-end
-
-function GetSpeedMod(pn)
-    local BaseSpeeds = GetBaseSpeeds()
-    local ExtraSpeeds = GetExtraSpeeds()    
-    for n = 1, table.getn(BaseSpeeds) do
-        if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then
-            if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end
-        end
-
-        if GetSpeedModRowType() == "pro" then
-            for m = 1, table.getn(ExtraSpeeds) do
-                local ExtraSpeed = string.gsub(ExtraSpeeds[m],'+0', '')
-                if ExtraSpeed == "0" then ExtraSpeed = ".0" end
-
-                local CombinedSpeeds = tonumber(BaseSpeeds[n])*100 + tonumber(ExtraSpeed)*100 --combines the speeds in to things like 450
-
-                --check x-mods
-                Trace('Checking the swag for ' .. pn .. ' ' .. BaseSpeeds[n] .. ExtraSpeed .. 'x')
-                if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n] .. ExtraSpeed .. 'x') then
-                    Trace("Returning the swag " .. BaseSpeeds[n] .. ExtraSpeed .. 'x')
-                    return BaseSpeeds[n] .. ExtraSpeed .. 'x'
-                end
-
-                --check c-mods
-                Trace('Checking the swag for ' .. pn .. ' c' .. CombinedSpeeds)
-                if GAMESTATE:PlayerIsUsingModifier(pn, 'c' .. CombinedSpeeds) then 
-                    Trace("Returning the swag c" .. CombinedSpeeds)
-                    return 'c' .. CombinedSpeeds
-                end
-
-                --check m-mods (for some reason m0 is always applied, so skip it)
-                Trace('Checking the swag for ' .. pn .. ' m' .. CombinedSpeeds)
-                if GAMESTATE:PlayerIsUsingModifier(pn, 'm' .. CombinedSpeeds) and CombinedSpeeds ~= 0 then 
-                    Trace("Returning the swag m" .. CombinedSpeeds)
-                    return 'm' .. CombinedSpeeds
-                end
-            end
-       end  
-    end
-
-    --If we got here, chances are that we ignored m0, so return that
-    return "m0"
-end
-
-function GetSpeedModBase(pn)
-    local SpeedMod = GetSpeedMod(pn)
-    SpeedMod = string.gsub(SpeedMod, 'c', '')
-    SpeedMod = string.gsub(SpeedMod, 'm', '')
-
-    local SpeedModType = GetSpeedModType(pn)
-    Trace("GETSPEEDMODBASE " .. SpeedModType .. " " .. SpeedMod .. " " .. SpeedMod)
-    if SpeedModType == 'x-mod' then
-        local pos = string.find(SpeedMod, '.', 1, true)
-        return string.sub(SpeedMod, 1, pos-1)
-    end
-
-    if SpeedModType == 'c-mod' or SpeedModType == 'm-mod' then
-        SpeedMod = tonumber(SpeedMod)/100
-               
-        local pos = string.find(SpeedMod, '.', 1, true)
-               
-        if pos ~= nil then return string.sub(SpeedMod, 1, pos-1) else return SpeedMod end
-    end
-end
-
-function GetSpeedModExtra(pn)
-    local SpeedMod = GetSpeedMod(pn)
-    local SpeedModBase = GetSpeedModBase(pn)
-       local SpeedModType = GetSpeedModType(pn)
-       
-       if SpeedModType == "c-mod" or SpeedModType == "m-mod" then
-               SpeedMod = string.gsub(SpeedMod, 'c', '')
-               SpeedMod = string.gsub(SpeedMod, 'm', '')
-               SpeedMod = tonumber(SpeedMod)/100
-       end
-       
-    Trace('GETSPEEDMODEXTRA SHIT:')
-    Trace('SpeedMod: ' .. SpeedMod)
-    Trace('SpeedModBase: ' .. SpeedModBase)
-
-    local SpeedModExtra = string.gsub(SpeedMod, SpeedModBase .. '.', '')
-
-    Trace('1st SpeedModExtra: ' .. SpeedModExtra)
-
-    SpeedModExtra = string.gsub(SpeedModExtra, 'x', '')
-
-    Trace('2nd SpeedModExtra: ' .. SpeedModExtra)
-
-    if SpeedModExtra ~= nil then return SpeedModExtra else return "0" end
-end
-
-function GetSpeedModType(pn)
-    local SpeedMod = GetSpeedMod(pn)
-
-    if string.find(SpeedMod, ".", 1, true) ~= nil then Trace("Im in here lol"); return 'x-mod' end
-    if string.find(SpeedMod, "c", 1, true) ~= nil then return 'c-mod' end
-    if string.find(SpeedMod, "m", 1, true) ~= nil then return 'm-mod' end
-end
-
 function oitgACoptions()
     -- Right now we return the same line names for both OITG and whatever else happens to be running. But in the future they might be different.
     if OPENITG then return "1,2,3,4,5,6,7,8,9,10,11" end
@@ -559,94 +450,6 @@ function SpeedLines()
     end
 end
 
-function SpeedMods(name)
-    local modList = GetBaseSpeeds()
-    local s = "Speed"
-
-    if name == "Extra" then
-        modList = GetExtraSpeeds()
-        s = "Extra " .. s
-    end
-
-    if name == "Type" then
-        modList = GetSpeedModTypes()
-        s = s .. " Type"
-    end
-
-    local Params = { Name = s, OneChoiceForAllPlayers = false }   
-
-    local function Load(self, list, pn)
-        -- default to the first item in the list
-        list[1] = true
-
-        -- now loop through everything else in the list and see if it is set to true
-        for i=2, table.getn(modList) do
-                if name == "Base" then
-                                       Trace("Comparing " .. modList[i] .. " with " .. GetSpeedModBase(pn))
-                    if modList[i] == GetSpeedModBase(pn) then
-                        list[i] = true
-                        list[1] = false
-                    else
-                        list[i] = false
-                    end
-                end
-
-                               
-                if name == "Extra" then
-                                       Trace("Comparing " .. modList[i] .. " with " .. GetSpeedModExtra(pn))
-                    if string.gsub(modList[i], '+0.', '') == GetSpeedModExtra(pn) then
-                        list[i] = true
-                        list[1] = false
-                    else
-                        list[i] = false
-                    end
-                end
-                               
-                if name == "Type" then                         
-                                       Trace("Comparing " .. modList[i] .. " with " .. GetSpeedModType(pn))
-                    if modList[i] == GetSpeedModType(pn) then
-                        list[i] = true
-                        list[1] = false
-                    else
-                        list[i] = false
-                    end
-                end
-        end
-    end
-
-    local function Save(self, list, pn)
-        local SpeedMod = GetSpeedMod(pn)
-        local ModBase = GetSpeedModBase(pn)
-        local ModExtra = GetSpeedModExtra(pn)
-        local ModType = GetSpeedModType(pn)
-
-        for i = 1, table.getn(modList) do
-            if list[i] then
-                if name == "Base" then ModBase = modList[i] end
-                if name == "Extra" then ModExtra = string.gsub(modList[i], '+0.', '') end
-                if name == "Type" then ModType = modList[i] end
-            end
-        end
-
-               Trace("OMFG " .. ModBase .. " " .. ModExtra)
-               
-        SpeedMod = tonumber(ModBase .. '.' .. ModExtra);
-
-        if ModType == 'c-mod' then SpeedMod = 'c' .. SpeedMod*100 end
-        if ModType == 'm-mod' then SpeedMod = 'm' .. SpeedMod*100 end
-        if ModType == 'x-mod' then SpeedMod = SpeedMod .. 'x' end      
-                    
-               Trace("THE SPEEDMOD IS " .. SpeedMod)
-               Trace("Trying to apply to " .. pn)
-               Trace("PLAYER 1 is " .. PLAYER_1)
-        GAMESTATE:ApplyGameCommand('mod,'..SpeedMod,pn+1) --this is so annoying, the player number has to be 1 or 2 for ApplyGameCommand
-        --ApplySpeedMods()
-        MESSAGEMAN:Broadcast('SpeedModChanged')
-    end
-
-    return CreateOptionRow( Params, modList, Load, Save )
-end
-
 function DisplayBPM(pn, includeRate, includeSpeed) 
         local lowBPM = bpm[1]
         local highBPM = bpm[2]  
diff --git a/Themes/GrooveNights/Scripts/SpeedMods.lua b/Themes/GrooveNights/Scripts/SpeedMods.lua
new file mode 100644 (file)
index 0000000..90f8043
--- /dev/null
@@ -0,0 +1,252 @@
+function GetRateMods()\r
+       return { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x", "2.0x"}\r
+end\r
+\r
+function GetBaseSpeeds()\r
+    if GetSpeedModRowType() == "pro" then\r
+        return { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" }\r
+    end\r
+        \r
+    if GetSpeedModRowType() == "advanced" then\r
+        if OPENITG then baseSpeed = { "0.25x", "0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.25x", "2.5x", "2.75x", "3x", "3.25x", "3.5x", "3.75x", "4x", "4.25x", "4.5x", "4.75x", "5x", "5.25x", "5.5x", "5.75x", "6x", "6.25x", "6.5x", "6.75x", "7x", "c400", "c425", "c450", "c475", "c500", "c525", "c550", "c575", "c600", "c625", "c650", "c675", "c700", "c725", "c750", "c775", "c800", "c825", "c850", "c875", "c900", "c925", "c950", "c975", "c1000", "m400", "m425", "m450", "m475", "m500", "m525", "m550", "m575", "m600", "m625", "m650", "m675", "m700", "m725", "m750", "m775", "m800", "m825", "m850", "m875", "m900", "m925", "m950", "m975", "m1000" }\r
+        else baseSpeed = { "0.25x", "0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.25x", "2.5x", "2.75x", "3x", "3.25x", "3.5x", "3.75x", "4x", "4.25x", "4.5x", "4.75x", "5x", "5.25x", "5.5x", "5.75x", "6x", "6.25x", "6.5x", "6.75x", "7x", "c400", "c425", "c450", "c475", "c500", "c525", "c550", "c575", "c600", "c625", "c650", "c675", "c700", "c725", "c750", "c775", "c800", "c825", "c850", "c875", "c900", "c925", "c950", "c975", "c1000" }\r
+        end\r
+    end\r
+\r
+    if GetSpeedModRowType() == "basic" then\r
+        if OPENITG then baseSpeed = { "1x", "1.5x", "2x", "2.5x", "3x", "3.5x", "4x", "4.5x", "5x", "6x", "c450", "m450" }\r
+        else baseSpeed = { "1x", "1.5x", "2x", "2.5x", "3x", "3.5x", "4x", "4.5x", "5x", "5.5x", "6x", "c450" }\r
+        end\r
+    end\r
+end   \r
+\r
+function GetExtraSpeeds()\r
+       if GetSpeedModRowType() == "pro" then \r
+               return { "0", "+0.25", "+0.5", "+0.75", "+0.1", "+0.2", "+0.3", "+0.4", "+0.6", "+0.7", "+0.8", "+0.9" }\r
+       end\r
+       \r
+       if GetSpeedModRowType() == "advanced" then\r
+               return { "0" }\r
+       end\r
+       \r
+       if GetSpeedModRowType() == "basic" then\r
+               return { "0" }\r
+       end\r
+end\r
+\r
+function GetSpeedModTypes() \r
+    if OPENITG then\r
+        return { "x-mod", "c-mod", "m-mod" }\r
+    else\r
+        return { "x-mod", "c-mod" }\r
+    end\r
+end\r
+\r
+function GetRateMod()\r
+       local RateMods = GetRateMods()\r
+       for n = 1, table.getn(RateMods) do\r
+               if GAMESTATE:PlayerIsUsingModifier(0, RateMods[n] .. 'music') or GAMESTATE:PlayerIsUsingModifier(1, RateMods[n] .. 'music') then\r
+                       return RateMods[n]\r
+               end\r
+       end\r
+\r
+       return nil\r
+end\r
+\r
+function RateMods()\r
+       local modList = GetRateMods();\r
+\r
+       local function Load(self, list, pn)\r
+               for n = 1, table.getn(modList) do\r
+                       if GAMESTATE:PlayerIsUsingModifier(pn,modList[n]..'music') then list[n] = true else list[n] = false end\r
+               end\r
+       end\r
+\r
+       local function Save(self, list, pn)\r
+               for n = 1, table.getn(modList) do\r
+                       if list[n] then\r
+                               GAMESTATE:ApplyGameCommand('mod,'..modList[n]..'music',pn)\r
+                               MESSAGEMAN:Broadcast('RateModChanged')\r
+                       end\r
+               end\r
+       end\r
+\r
+       local Params = { Name = "Rate" }\r
+       return CreateOptionRow( Params, modList, Load, Save )\r
+end\r
+\r
+function GetSpeedMod(pn)\r
+    local BaseSpeeds = GetBaseSpeeds()\r
+    local ExtraSpeeds = GetExtraSpeeds()\r
+    for n = 1, table.getn(BaseSpeeds) do\r
+        if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then\r
+            if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end\r
+        end\r
+\r
+        if GetSpeedModRowType() == "pro" then\r
+            for m = 1, table.getn(ExtraSpeeds) do\r
+                local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50\r
+\r
+                --check x-mods\r
+                Trace('GetSpeedMod: Checking ' .. CombinedSpeeds .. 'x')\r
+                if GAMESTATE:PlayerIsUsingModifier(pn, CombinedSpeeds .. 'x') then\r
+                    Trace("GetSpeedMod: Hit!")\r
+                    return CombinedSpeeds .. 'x'\r
+                end\r
+                       end\r
+       end  \r
+    end\r
+       \r
+       for n = 1, table.getn(BaseSpeeds) do\r
+               if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then\r
+            if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end\r
+        end\r
+       \r
+               for m = 1, table.getn(ExtraSpeeds) do\r
+                       local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50\r
+               \r
+                       --check c-mods\r
+                       Trace('GetSpeedMod: Checking ' .. 'c' .. CombinedSpeeds*100)\r
+                       if GAMESTATE:PlayerIsUsingModifier(pn, 'c' .. CombinedSpeeds*100) then \r
+                               Trace('GetSpeedMod: Hit!')\r
+                               return 'c' .. CombinedSpeeds*100\r
+                       end\r
+               end\r
+       end\r
+       \r
+       for n = 1, table.getn(BaseSpeeds) do\r
+               if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then\r
+            if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end\r
+        end\r
+\r
+               for m = 1, table.getn(ExtraSpeeds) do\r
+                       local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50                        \r
+                       \r
+                       --check m-mods (for some reason m0 is always applied, so skip it)\r
+                       Trace('GetSpeedMod: Checking ' .. 'm' .. CombinedSpeeds*100)\r
+                       if GAMESTATE:PlayerIsUsingModifier(pn, 'm' .. CombinedSpeeds*100) then \r
+                               Trace('GetSpeedMod: Hit!')\r
+                               return 'm' .. CombinedSpeeds*100\r
+                       end\r
+               end\r
+       end\r
+       \r
+       return nil\r
+end\r
+\r
+function GetSpeedModBase(pn)\r
+    local SpeedMod = GetSpeedMod(pn)\r
+    SpeedMod = string.gsub(SpeedMod, 'c', '')\r
+    SpeedMod = string.gsub(SpeedMod, 'm', '')\r
+       SpeedMod = string.gsub(SpeedMod, 'x', '')\r
+       \r
+       if GetSpeedModType(pn) == 'c-mod' or GetSpeedModType(pn) == 'm-mod' then SpeedMod = SpeedMod/100 end\r
+       \r
+       Trace("GetSpeedModBase: The SpeedMod is " .. SpeedMod .. " returning " .. math.floor(SpeedMod) .. " as the base.")\r
+    return tostring(math.floor(SpeedMod)) -- Consistency: all the others return a string due to concatenation or w/e\r
+end\r
+\r
+function GetSpeedModExtra(pn)\r
+    local SpeedMod = GetSpeedMod(pn)\r
+    SpeedMod = string.gsub(SpeedMod, 'c', '')\r
+    SpeedMod = string.gsub(SpeedMod, 'm', '')\r
+       SpeedMod = string.gsub(SpeedMod, 'x', '')\r
+       \r
+       if GetSpeedModType(pn) == 'c-mod' or GetSpeedModType(pn) == 'm-mod' then SpeedMod = SpeedMod/100 end\r
+\r
+       Trace("GetSpeedModExtra: The SpeedMod is " .. SpeedMod .. " returning " .. '+' .. SpeedMod - math.floor(SpeedMod) .. " as extra.")\r
+    return '+' .. SpeedMod - math.floor(SpeedMod)\r
+end\r
+\r
+function GetSpeedModType(pn)\r
+    local SpeedMod = GetSpeedMod(pn)\r
+\r
+    if string.find(SpeedMod, "x") ~= nil then Trace("GetSpeedModType: Returning " .. "x-mod"); return 'x-mod' end\r
+    if string.find(SpeedMod, "c") ~= nil then Trace("GetSpeedModType: Returning " .. "c-mod"); return 'c-mod' end\r
+    if string.find(SpeedMod, "m") ~= nil then Trace("GetSpeedModType: Returning " .. "m-mod"); return 'm-mod' end\r
+end\r
+\r
+function SpeedMods(name)\r
+    local modList = GetBaseSpeeds()\r
+    local s = "Speed"\r
+\r
+    if name == "Extra" then\r
+        modList = GetExtraSpeeds()\r
+        s = "Extra " .. s\r
+    end\r
+\r
+    if name == "Type" then\r
+        modList = GetSpeedModTypes()\r
+        s = s .. " Type"\r
+    end\r
+\r
+    local Params = { Name = s, OneChoiceForAllPlayers = false }   \r
+\r
+    local function Load(self, list, pn)\r
+        -- default to the first item in the list\r
+        list[1] = true\r
+\r
+        -- now loop through everything else in the list and see if it is set to true\r
+        for i=2, table.getn(modList) do\r
+                if name == "Base" then\r
+                    if modList[i] == GetSpeedModBase(pn) then\r
+                        list[i] = true\r
+                        list[1] = false\r
+                    else\r
+                        list[i] = false\r
+                    end\r
+                end\r
+\r
+                               \r
+                if name == "Extra" then\r
+                    if string.gsub(modList[i], 'x', '') == GetSpeedModExtra(pn) then\r
+                        list[i] = true\r
+                        list[1] = false\r
+                    else\r
+                        list[i] = false\r
+                    end\r
+                end\r
+                               \r
+                if name == "Type" then                         \r
+                                       Trace("Comparing " .. modList[i] .. " with " .. GetSpeedModType(pn))\r
+                    if modList[i] == GetSpeedModType(pn) then\r
+                        list[i] = true\r
+                        list[1] = false\r
+                    else\r
+                        list[i] = false\r
+                    end\r
+                end\r
+        end\r
+    end\r
+\r
+    local function Save(self, list, pn)\r
+        local SpeedMod = GetSpeedMod(pn)\r
+        local ModBase = GetSpeedModBase(pn)\r
+        local ModExtra = GetSpeedModExtra(pn)\r
+        local ModType = GetSpeedModType(pn)\r
+               \r
+               Trace("SpeedMods: about to save. SpeedMod is " .. SpeedMod .. " ModBase is " .. ModBase .. " ModExtra is " .. ModExtra .. " ModType us " .. ModType)\r
+\r
+        for i = 1, table.getn(modList) do\r
+            if list[i] then\r
+                if name == "Base" then ModBase = modList[i] end\r
+                if name == "Extra" then ModExtra = modList[i] end\r
+                if name == "Type" then ModType = modList[i] end\r
+            end\r
+        end\r
+               \r
+               Trace("SpeedMods: Did the for loop. SpeedMod is " .. SpeedMod .. " ModBase is " .. ModBase .. " ModExtra is " .. ModExtra .. " ModType us " .. ModType)\r
+                       \r
+        SpeedMod = ModBase + ModExtra;\r
+               \r
+        if ModType == 'c-mod' then SpeedMod = 'c' .. SpeedMod*100 end\r
+        if ModType == 'm-mod' then SpeedMod = 'm' .. SpeedMod*100 end\r
+        if ModType == 'x-mod' then SpeedMod = SpeedMod .. 'x' end      \r
+          \r
+               Trace("SpeedMods: About to apply " .. SpeedMod)\r
+        GAMESTATE:ApplyGameCommand('mod,'..SpeedMod,pn+1) --this is so annoying, the player number has to be 1 or 2 for ApplyGameCommand\r
+        MESSAGEMAN:Broadcast('SpeedModChanged')\r
+    end\r
+\r
+    return CreateOptionRow( Params, modList, Load, Save )\r
+end
\ No newline at end of file