Game Development Community

Modifier keys fail to register with moveMap.bindCmd

by Vern Jensen · in Torque Game Builder · 04/24/2007 (5:13 pm) · 8 replies

If I do something like:

moveMap.bindCmd(keyboard, "space", "doStuff();", "stopStuff();");

then it works great. But as soon as I use any modifier keys, such as "shift" "ctrl" "alt" or even the Mac-specific ones (I'm on a Mac) such as "cmd" or "opt" it fails to do anything. But non-modifier keys work fine, such as tab, space, any letter, arrow keys, etc.

Am I missing something, or is this a bug in Torque? (Using 1.5 beta 3) Can any other Mac users confirm that modifier keys do or don't work? Is there some special call I need to make first to "enable" them?

For documentation, I'm going off of this:

http://tdn.garagegames.com/wiki/Script/Input_Keys_and_Maps

#1
04/24/2007 (6:30 pm)
According to the docs, you should be using lctrl and lshift ... which, I've had success with lshift but not lctrl ... oddly enough ... and this is on a windows machine.
#2
04/24/2007 (10:33 pm)
Nope, lshift fails to respond as well.

Is anyone on here using a Mac, who can confirm if this is a bug in Torque?
#3
04/25/2007 (1:19 am)
You might need to use "ctrl-a" rather then "ctrl a" ... i seem to remember ActionMap looking for the dash but not a space, but I could be misremembering.

T.
#4
04/25/2007 (9:17 am)
@Tom, pretty sure he's trying to use the key by itself -- like bindCmd("keyboard", "lctrl", "doStuff(); "stopStuff();"); ...

Vern -- can you confirm this ... cause I believe it does make a difference ...
#5
04/25/2007 (10:10 am)
Yes, I want to get an event when *only* the modifier key is pushed, not it in combination with some normal key. I'm making a space shooter, and I want shift or control to be able to be used to activate the main weapon. So far, that seems to be impossible, which if that's true, would be a *major* flaw in the engine that I would be really surprised no one has run across yet. So that's why I'm hoping it's my lack of knowledge on how to do it properly instead.
#6
04/25/2007 (10:19 am)
It's a modifier key, not a strict input key. The internal design is based on modifier keys modifying other key's input, not being pressed by themselves as an individual input.

If you wish to change this behavior, you can purchase the Pro version and modify the key handler code itself.
#7
04/25/2007 (10:42 am)
Huh, that's pretty surprising, given that most gamers who play action games would want to use modifier keys as direct input keys, so it's odd you wouldn't support it natively in the engine. (Especially given that many keyboards don't properly handle more than 2 keys pushed at once, UNLESS they are modifier keys, in which case you can have 2 normal keys and *any number* of modifier keys down at once, and it'll still work correctly.)

Anyway, thanks for the reply, good to know that I'll have to modify the engine directly. I do have the Pro version, but know nothing about Windows, so while I can probably modify the Mac side fairly easily, modifying Windows may take more time and energy.
#8
04/25/2007 (11:11 am)
Vern -- the 2 keys at a time issue is actually relative to the keyboard matrix and where those keys are located ... last I checked, and unless they updated ... recalling from memory here ... the keyboard is split up into a matrix ... something like 6-10 areas ... and certain keys are in certain sections ... and only one key can be pressed in a single section ... but all sections can have a key pressed ... allowing upwards around 6-10 keys to be pressed at the same time ... however, they are scattered in various locations ... making it fairly hard to use for rapid key presses in a fast action game ...

I do sort of agree with the modifiers not being available 'out of the box' though ... some work that way, not all do though ... I know I recently got rshift to work as a key binding ... haven't tried lshift ... but this was in windows ...