Game Development Community

Binding keyboard minus sign [RESOLVED]

by Keith G Wood · in Technical Issues · 06/07/2012 (11:37 pm) · 5 replies

I want to use the keyboard "+" and "-" signs to control camera zoom, so I have the following:

moveMap.bind( keyboard, "+", zoomIn );
moveMap.bind( keyboard, "-", zoomOut );

Linking to appropriate functions which have the desired effect.

However, whereas zoomIn gets called when pressing the "+" on the keyboard extreme right (numeric keypad); zoomOut only gets called when pressing the "_/-" key (immediately to the right of the "0"/zero key). Pressing the "-" on the keyboard extreme right (numeric keypad) does not call the function.

Similarly pressing the "+/=" (immediately to the right of the "_/-" key) does not call zoomIn.

What I want to use, of course, is the "+" & "-" with the numeric keypad - to me these seem the intuitive keys to use. I would be quite happy to have both keys work for each function, but the current situation is just clumsy.

So - is there a way to bind to the "-" key of the numeric keypad?

#1
06/08/2012 (1:17 am)
did u delete config.cs?if not then find that file and delete it everytime before starting your game.
or
run DeletePrefs.bat everytime

for parmanent solution,do this:
open game\scripts\client\init.cs
serach for this lines:

if (isFile("./config.cs"))
exec("./config.cs");

comment or delete them

now try again.


#2
06/08/2012 (5:22 am)
No, that's not it, config.cs is updated, and one of the "-" keys does call the intended function - it's just pressing the "-" by the numeric keypad doesn't call the function.
#3
06/08/2012 (6:57 am)
strange
i also failed to use numeric "-" .


to use numeric "+" :
moveMap.bind(keyboard, "+", moveForward);


for another "+"(in my keyboard it is "+/=" ) :
moveMap.bind(keyboard, "=", moveForward);


to use "-"(not numeric "-" and in my keyboard it is "_/-") :
moveMap.bind(keyboard, "-", moveForward);
or
moveMap.bind(keyboard, "_", moveForward);

but for numeric "-",nothing is working
#4
06/08/2012 (2:38 pm)
The key names for the number pad are these:

numpad0
numpad1
numpad2
numpad3
numpad4
numpad5
numpad6
numpad7
numpad8
numpad9
numpadmult
numpadadd
numpadsep
numpadminus
numpaddecimal
numpaddivide
numpadenter

So it should be -

moveMap.bind(keyboard, numpadminus, zoomOut);
moveMap.bind(keyboard, numpadadd, zoomIn );

I think that should work anyway.
These are from the source code:
Torque3D/source/sim/actionmap.cpp

I'm sure I've seen a list in the documentation but I can't find it now.
#5
06/08/2012 (11:18 pm)
Yes - that does it - thanks