Index: code/branches/gamestates3/data/gui/scripts/MouseControlsMenu.lua
===================================================================
--- code/branches/gamestates3/data/gui/scripts/MouseControlsMenu.lua	(revision 6766)
+++ code/branches/gamestates3/data/gui/scripts/MouseControlsMenu.lua	(revision 6773)
@@ -4,26 +4,27 @@
 
 function P.onLoad()
-    block = false
-    mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar")
-    mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar")
-    normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton")
-    derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton")
-    invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox")
-    mousenormalscrollbar_active = false
-    mousederivescrollbar_active = false
-    derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_")
-    invert_active = false
-    mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_")
-    mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_")
-    mousenormalscrollbarwindow:setScrollPosition((math.log(14*mousenormalsensitivity-6))/(6*math.log(2)))
-    mousederivescrollbarwindow:setScrollPosition((math.log(14*mousederivesensitivity-6))/(6*math.log(2)))
+    P.block = false
+    P.mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar")
+    P.mousederivescrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveScrollbar"),"CEGUI::Scrollbar")
+    P.normalwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalButton"),"CEGUI::RadioButton")
+    P.derivewindow = tolua.cast(winMgr:getWindow("orxonox/MouseDeriveButton"),"CEGUI::RadioButton")
+    --P.invertwindow = tolua.cast(winMgr:getWindow("orxonox/MouseInvertCheckbox"),"CEGUI::Checkbox")
+    P.mousenormalscrollbar_active = false
+    P.mousederivescrollbar_active = false
+    local derive_active = orxonox.getConfig("KeyBinder","bDeriveMouseInput_")
+    local invert_active = false
+    local normal_active
+    P.mousenormalsensitivity = orxonox.getConfig("KeyBinder","mouseSensitivity_")
+    P.mousederivesensitivity = orxonox.getConfig("KeyBinder","mouseSensitivityDerived_")
+    P.mousenormalscrollbarwindow:setScrollPosition((math.log(14*P.mousenormalsensitivity-6))/(6*math.log(2)))
+    P.mousederivescrollbarwindow:setScrollPosition((math.log(14*P.mousederivesensitivity-6))/(6*math.log(2)))
     if derive_active == "true" then
         normal_active = false
         derive_active = true
-        derivewindow:setSelected(derive_active)
+        P.derivewindow:setSelected(derive_active)
     else
         normal_active = true
         derive_active = false
-        normalwindow:setSelected(normal_active)
+        P.normalwindow:setSelected(normal_active)
     end
     if invert_active == "true" then
@@ -35,46 +36,46 @@
 
 function P.MouseControlsMouseNormalScrollbar_changed(e)
-    if mousenormalscrollbar_active == false then
-        scrollposition = mousenormalscrollbarwindow:getScrollPosition()
-        mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
-        orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
+    if P.mousenormalscrollbar_active == false then
+        local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition()
+        P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
+        orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity)
     end
 end
 
 function P.MouseControlsMouseNormalScrollbar_started(e)
-    mousenormalscrollbar_active = true
+    P.mousenormalscrollbar_active = true
 end
 
 function P.MouseControlsMouseNormalScrollbar_ended(e)
-    scrollposition = mousenormalscrollbarwindow:getScrollPosition()
-    mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
-    orxonox.config("KeyBinder", "mouseSensitivity_", mousenormalsensitivity)
-    mousenormalscrollbar_active = false
+    local scrollposition = P.mousenormalscrollbarwindow:getScrollPosition()
+    P.mousenormalsensitivity = (math.pow(64,scrollposition)+6)/14
+    orxonox.config("KeyBinder", "mouseSensitivity_", P.mousenormalsensitivity)
+    P.mousenormalscrollbar_active = false
 end
 
 function P.MouseControlsMouseDeriveScrollbar_changed(e)
-    if mousederivescrollbar_active == false then
-        scrollposition = mousederivescrollbarwindow:getScrollPosition()
-        mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
-        orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
+    if P.mousederivescrollbar_active == false then
+        local scrollposition = P.mousederivescrollbarwindow:getScrollPosition()
+        P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
+        orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity)
     end
 end
 
 function P.MouseControlsMouseDeriveScrollbar_started(e)
-    mousederivescrollbar_active = true
+    P.mousederivescrollbar_active = true
 end
 
 function P.MouseControlsMouseDeriveScrollbar_ended(e)
-    scrollposition = mousederivescrollbarwindow:getScrollPosition()
-    mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
-    orxonox.config("KeyBinder", "mouseSensitivityDerived_", mousederivesensitivity)
-    mousederivescrollbar_active = false
+    local scrollposition = P.mousederivescrollbarwindow:getScrollPosition()
+    P.mousederivesensitivity = (math.pow(64,scrollposition)+6)/14
+    orxonox.config("KeyBinder", "mouseSensitivityDerived_", P.mousederivesensitivity)
+    P.mousederivescrollbar_active = false
 end
 
 function P.MouseNormalButton_clicked(e)
-    if block == false then
-        block = true
-        derivewindow:setSelected(false)
-        block = false
+    if P.block == false then
+        P.block = true
+        P.derivewindow:setSelected(false)
+        P.block = false
         orxonox.config("KeyBinder", "bDeriveMouseInput_", 0)
     end
@@ -82,8 +83,8 @@
 
 function P.MouseDeriveButton_clicked(e)
-    if block == false then
-        block = true
-        normalwindow:setSelected(false)
-        block = false
+    if P.block == false then
+        P.block = true
+        P.normalwindow:setSelected(false)
+        P.block = false
         orxonox.config("KeyBinder", "bDeriveMouseInput_", 1)
     end
