Mouse Functions
by Jon Jorajuria · in Torque Game Engine · 05/24/2006 (8:49 am) · 1 replies
I have no idea why this is proving to be so difficult, but I thought I would pose this problem here. I have two mouse modes in game. One while the cursor is on and one while the cursor is off, currently they conflict with each other. Here is what I need to have happen:
While in cursor off mode:
While in cursor on mode:
Should I combine the two functions or can I bind multiple functions to mousebutton0 based upon what mode it is in. I am sure this is somthing simple, but for some reason I am having a brain fart.
While in cursor off mode:
function mouseFire(%val)
{
if(%val)
{
if($FLAG_SHIFT)
{
commandToServer( 'performBlock', "High" );
}
else
{
$mvTriggerCount0++;
}
}
else
{
CommandToServer('CancelBlock');
if($mvTriggerCount0 % 2 == 1)
{
$mvTriggerCount0++;
}
}
}While in cursor on mode:
function mouse_btn0(%val)
{
$mouseLButtonDown = %val;
$mouseLRButtonsDown = ($mouseLButtonDown && $mouseRButtonDown);
if (%val)
{
$accum_yaw = 0;
$accum_pitch = 0;
ServerConnection.setPreSelectedObjFromRollover();
cursorOff();
}
else
{
if ($accum_yaw > 0.02 || $accum_yaw < -0.02 || $accum_pitch > 0.02 || $accum_pitch < -0.02)
ServerConnection.clearPreSelectedObj();
else
ServerConnection.setSelectedObjFromPreSelected();
cursorOn();
}
testForMouseMoveForward();
}Should I combine the two functions or can I bind multiple functions to mousebutton0 based upon what mode it is in. I am sure this is somthing simple, but for some reason I am having a brain fart.
About the author
Torque 3D Owner Rubes