Jump to content

Triple touch detection with specific functions for each click


Qiijinn
 Share

You are about to reply to a thread that has been inactive for 1264 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ive been doing this for a while and i keep getting stumped, originally i tried to make an animesh character that gets increasingly frustrated the more you click it, with 3 stages, each click should make it say something new. Originally I tried to separate the individual arguements with  "else if" that didnt work so i tried making a specific integer that adds +1 when touch_start is triggered, can anyone help me out this is driving me nuts.

Link to comment
Share on other sites

you might also need/want to use either a timer or llGetTime() to manage the ammount of time between clicks.

for example (not tested in-world, might have bugs.) :

integer gTouchNumber;

default
{
  touch_start(integer i)
  {	++gTouchNumber;
    float time = llGetAndResetTime();
    if(time>10.0) gTouchNumber=1;
    if(gTouchNumber>3) gTouchNumber = 3; // can change this depending on desired behavior.
   
    if(gTouchNumber==1)
    {	llSay(0,"Don't touch me.");
    }else if(gTouchNumber==2)
    {	llSay(0,"Knock it off!");
    }else if(gTouchNumber==3)
    {	llShout(0,"KNOCK IT OFF!!!");
    }else
    { // programming error.
      llOwnerSay("Programing error, unexpected touch number: "+gTouchNumber);
    }
  }
}

 

Edited by Quistessa
tabs
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1264 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...