Game Development Community

Can't bind mouse button to ActionMap

by Cyrad · in Torque Game Builder · 01/07/2010 (5:57 pm) · 1 replies

I can't seem to bind a mouse button to an action map. I prefer to use an action map rather than mouse callbacks for various practical reasons. I want the character to attack by pressing the mouse buttons.

playerControls.bindCmd(mouse0,"button0","classPlayer::attack_primary($player,1);","classPlayer::attack_primary($player,0);");

It looks a little strange, but this same syntax worked for the keyboard bindings, but not the mouse button. I searched the forums for similar issues, but all of them were either unanswered or gave a solution for an old version of TGB that doesn't work for the current version.

Any help with this?

#1
01/07/2010 (10:11 pm)
Are you sure it does not work?

That means:
1. Is the function not called at all (short echo("im alive"); at the start helps)
2. Is there an error mentioned in the log?


If I would have to guess then I would guess that the reason is the usage of the variable within the function without enclosing it in eval( ... ) but thas just a guess