Game Development Community

Binding Mouse to Action Map?

by J.C. Smith · in Torque Game Builder · 07/17/2005 (9:16 am) · 3 replies

Hey there guys and gals. I'm somewhat experienced with TGE, recently have purchased T2D to give it a whirl. I'm having a problem though with the mouse binding in T2D. I originally had used the mouse callbacks, but the response is really jittery at times so I decided to move it all to action maps. However when I create an action map the same way that I would for TGE, it doesn't work. I have this problem with both bind and bindcommand.

The odd thing is that if I change it from mouse and button0 to keyboard and space or whatnot my function gets called. But if I call it through script like this


playerMap.bind( mouse, button0, mouseFire );

or

playerMap.bindCmd(mouse, button0, "mouseFire();", "");

neither works. I also tried encloing the button0 in quotations while debugging, didn't work either. The function never gets called, I put an echo at the start of mouseFire() and it never gets called this way.

Simply changing it to (using the keyboard instead)

playerMap.bindCmd(keyboard, "space", "mouseFire();", "");

will get the function called every time.

Has something changed in the actionmap formatting? I've been searching can't find any documentation on it. Thanks a bunch.

#1
07/17/2005 (10:06 am)
Hello J.C.

I had a similar problem. I resolved it by turning off the mouse cursor using this command:

cursorOff();

It works for binding mouse movement too:
playerMap.bind(mouse, xaxis, rotate);

Hope it helps...

The only problem I had so far, is that if the player turns on the console, then the mouse will show up again and the binded functions will not get called, even after closing the console.
The CursorOff function should be called again, but I had no luck in binding the tilde key to a function that actually opens and close the console turning on and off the mouse cursor accordingly.
It seems that if I call ToggleConsole inside a function, it doesn't work... Any suggestions?

Bye,
Jacopo
#2
07/17/2005 (10:54 am)
Ahh thanks a bunch bruhda, that fixed it.
#3
07/17/2005 (11:15 am)
You are welcome! :)

BTW, I've found a solution for my console problem. ToggleConsole needs a parameter, so changing:

ToggleConsole();

in

ToggleConsole(true);

inside my function, worked.

Bye,
Jacopo