functions getting called on both keydown and keyup...
by Ian Omroth Hardingham · in Torque Game Engine · 03/25/2002 (8:05 am) · 4 replies
Hi again everyone.
I'm using this:
GlobalActionMap.bind(keyboard, "F8", myfunction)
to bind F8 to myfunction. The problem is: it runs myfunction twice: once on keydown and once on keyup. Anyone know how to avoid this?
Cheers
I'm using this:
GlobalActionMap.bind(keyboard, "F8", myfunction)
to bind F8 to myfunction. The problem is: it runs myfunction twice: once on keydown and once on keyup. Anyone know how to avoid this?
Cheers
About the author
Designer and lead programmer on Frozen Synapse, Frozen Endzone, and Determinance. Co-owner of Mode 7 Games.
#2
For anyone who needs to know how, the syntax is:
someMap.bindCmd(inputdevice, "key", "command to run on key down", "command to run on key up");
and it's important to semicolon terminate the commands for this one, unlike straight bind.
eg GlobalActionMap.bindCmd(keyboard, "F12", "foo();", "mop(5,3,2);")
03/25/2002 (8:58 am)
bindcmd worked perfectly, cheers.For anyone who needs to know how, the syntax is:
someMap.bindCmd(inputdevice, "key", "command to run on key down", "command to run on key up");
and it's important to semicolon terminate the commands for this one, unlike straight bind.
eg GlobalActionMap.bindCmd(keyboard, "F12", "foo();", "mop(5,3,2);")
#3
03/25/2002 (12:26 pm)
The only problem with bindcmd is that you will have to change your options screen code as, I believe, it cannot handle bindcmd keybinds currently.
#4
12/28/2002 (8:19 am)
Where is the option dialog code?
Associate Stefan Beffy Moises
try to leave one empty ... just search the scripts how to use it...
Or you could handle the problem in your function:
with an if statement like this:
function doIt(%val) { if(%val) { executeSomeActionHere(); } }... and your code handled in executeSomeActionHere() should only run on keydown...