How to suspend a keymap binding?
by Scott Peal · in Torque Developer Network · 08/29/2009 (7:57 pm) · 3 replies
Sorry for the newbie-like question, but I was not able to find an answer in the search or sample code. Is there a command to temporary suspend a keymapping?
For example, I use the "i" key to open the inventory window. But if you open the console to type commands, the letter "i" is not available and opens the inventory window.
Thanks in advanced.
For example, I use the "i" key to open the inventory window. But if you open the console to type commands, the letter "i" is not available and opens the inventory window.
Thanks in advanced.
About the author
Step 1) be the indie, step 2) make enough to buy a commercial license :)
#2
Seems like there should be some command to auto-suspend a binding while in other GUI's, especially the console. Here is the toggle code I use for show/hide the window if it helps.
08/29/2009 (9:09 pm)
@Steve: Thanks for the pointer. I get what your saying and I think you are correct in the direction. But wouldn't that require me to set some flag on all other GUI scripts (i.e. ConsoleGui.cs)?Seems like there should be some command to auto-suspend a binding while in other GUI's, especially the console. Here is the toggle code I use for show/hide the window if it helps.
function Catalog::onWake()
{
PopulateFields();
button1.performClick();
}
function Catalog::onSleep()
{
MyObjViewer.setEmpty();
}
function ToggleCatalog(%make)
{
if (%make)
{
if (Catalog.isAwake())
{
// Deactivate the window.
Canvas.popDialog(Catalog);
}
else
{
Canvas.pushDialog(Catalog, 99);
}
}
}
#3
09/08/2009 (11:45 am)
Seems like you should be able to just pop the action maps of interest off the stack temporarily, then push them back on when you need them again.
Associate Steve Acaster
[YorkshireRifles.com]
eg:
function mouseFire(%val) { %player = LocalClientConnection.getControlObject(); //extra check that it's a player class //no point calling it on a non-avatar if (%player.getClassName() $= "Player") { if(%player.noshoot==0) { $mvTriggerCount0++; } else { //chill and no shooting } } }Call noshoot=1; on the player (from a trigger or from the console) and he'll be unable to use mouse fire button.
Whilst I've just pulled this off the top of my head, it does work. Don't know if there is a better way of doing it, though.
edited for crimes against spelling