Keyboard Sensitivity Slider
by Glenn Bermingham · 05/14/2013 (12:13 pm) · 3 comments
I wanted to control my vehicles using the keyboard instead of the mouse, I didn't like that the turn rate was a set value and not adjustable on the fly.
Part 1.A
First go to:
Game/art/gui/optionsDlg.gui
Change:
Part 1.B
Change:
Part 1 Finished:
Test! load up your Torque game to see if there's a 2nd slider bar in the controls tab in Options, it won't do anything but you're checking to make sure nothing is overlapping!
Part 2
Next goto Game/scripts/gui/optionsDlg.cs
Goto:
Scroll Down to:
And you're done changing code. Now load up your game and bind your Left and Right Arrow keys to Turn left and Turn Right, you should now be able to change your turn rate on the fly! Works best on vehicles.
Part 1.A
First go to:
Game/art/gui/optionsDlg.gui
Change:
new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
lockHorizScroll = "1";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "5 24";
extent = "347 152";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";to:new GuiScrollCtrl() {
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
lockHorizScroll = "1";
lockVertScroll = "0";
constantThumbHeight = "0";
childMargin = "0 0";
mouseWheelScrollSpeed = "-1";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "5 24";
extent = "347 130"; //Changed
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";Part 1.B
Change:
new GuiSliderCtrl(OptMouseSensitivity) {
range = "0.02 2";
ticks = "10";
value = "0.75";
isContainer = "0";
Profile = "GuiSliderProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "105 182";
Extent = "244 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "OptMouseSetSensitivity(OptMouseSensitivity.value);";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Mouse Sensitivity:";
maxLength = "255";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "GuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "15 182";
Extent = "85 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};to:new GuiSliderCtrl(OptMouseSensitivity) {
range = "0.02 2";
ticks = "10";
value = "0.75";
isContainer = "0";
Profile = "GuiSliderProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "153 159"; //Changed
extent = "200 20"; //Changed
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "OptMouseSetSensitivity(OptMouseSensitivity.value);";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Mouse Sensitivity:";
maxLength = "255";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "GuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "63 158"; //Changed
extent = "85 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};Then add this under previous code:new GuiSliderCtrl(OptKeyboardSensitivity) {
range = "0.1 1";
ticks = "10";
snap = "0";
value = "0.5";
position = "153 186";
extent = "200 20";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiSliderProfile";
visible = "1";
active = "1";
command = "OptKeyboardSetSensitivity(OptKeyboardSensitivity.value);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Keyboard Sensitivity:";
maxLength = "255";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "48 183";
extent = "100 18";
minExtent = "8 8";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};Part 1 Finished:
Test! load up your Torque game to see if there's a 2nd slider bar in the controls tab in Options, it won't do anything but you're checking to make sure nothing is overlapping!
Part 2
Next goto Game/scripts/gui/optionsDlg.cs
Goto:
OptMouseSensitivity.value = $pref::Input::LinkMouseSensitivity;Add under:
OptKeyboardSensitivity.value = $pref::Input::KeyboardTurnSpeed;
Scroll Down to:
function OptMouseSetSensitivity(%value)
{
$pref::Input::LinkMouseSensitivity = %value;
}Add under:function OptKeyboardSetSensitivity(%value)
{
$pref::Input::KeyboardTurnSpeed = %value;
}And you're done changing code. Now load up your game and bind your Left and Right Arrow keys to Turn left and Turn Right, you should now be able to change your turn rate on the fly! Works best on vehicles.
About the author
I spend most of my time working on games.

Torque Owner Gibby
faderboy digital media