Game Development Community

Repeating MouseButton ticks

by Johan Carlsson · in Torque Game Engine · 03/22/2005 (1:03 am) · 2 replies

Hi ya all,

I had a quick look att capturing mouse buttons by mapping them to a
server command. But it seems like mapped mosue buttons only get called
when pressed and when released?

I would like to get continous events as long as a button is pressed,
for instance for rapid fire or some thing.

While writting I guess i figured out a solution, namely setting a flag on
press/release (on the client or the player?) and have a check in
processTick some where?

Any good exemple code that are doing something similar?

#1
03/22/2005 (6:06 am)
function bone(%val)
{
   if (%val)
      $boneSchedule = schedule(50, 0, 'myRepeatingFunc');
   else
      cancel($boneSchedule);
}

function myRepeatingFunc()
{
   // do stuff


   $boneSchedule = schedule(50, 0, 'myRepeatingFunc');
}
#2
03/22/2005 (6:40 am)
Excellent. Thanks Ian.