Clearing a binding in the optionsDlg
by OneST8 · 03/19/2005 (2:51 pm) · 5 comments
File edited: fps/client/scripts/optionsDlg.cs
Function: OptRemapInputCtrl::onInputEvent
Find the first if statement that looks like this:
Change it to this: (additions in bold)
That's it! Now when you double click on a binding you can hit "backspace" and the existing binding will be instantly cleared.
Updated as per Eric Hartman's Jul 13 comment. Thanks Eric! :)
Function: OptRemapInputCtrl::onInputEvent
Find the first if statement that looks like this:
// Test for the reserved keystrokes:
if ( %device $= "keyboard" )
{
// Cancel...
if ( %action $= "escape" )
{
// Do nothing...
return;
}
}Change it to this: (additions in bold)
// Test for the reserved keystrokes:
if ( %device $= "keyboard" )
{
// Cancel...
if ( %action $= "escape" )
{
// Do nothing...
return;
}
[b]else if ( %action $= "backspace" ) // clear the current binding.
{
//get the current binding, device and action
%bind = moveMap.getBinding( $RemapCmd[%this.index] );
%device = getWord( %bind, 0 );
%action = getWords( %bind, 1, getWordCount(%bind) - 1 );
//remove the binding
moveMap.unbind( %device, %action );
//refresh the options dialog to reflect the change
OptRemapList.setRowById( %this.index, buildFullMapString( %this.index ) );
return;
}[/b]
}That's it! Now when you double click on a binding you can hit "backspace" and the existing binding will be instantly cleared.
Updated as per Eric Hartman's Jul 13 comment. Thanks Eric! :)
#2
05/09/2005 (10:30 am)
You are most welcome :)
#3
06/11/2005 (1:57 pm)
This is extremely useful. Thank you very much.
#4
The line:
%action = getWord( %bind, 1 );
Should be:
%action = getWords( %bind, 1, getWordCount(%bind) - 1 );
Otherwise it wont work for multi-key binds like shift+whatever
07/13/2006 (6:06 pm)
Ancient resource but I just discovered a bug :DThe line:
%action = getWord( %bind, 1 );
Should be:
%action = getWords( %bind, 1, getWordCount(%bind) - 1 );
Otherwise it wont work for multi-key binds like shift+whatever
#5
08/09/2008 (5:21 am)
Works fine for me...
Torque Owner Tim Heldna