Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detecting a Double Click

Jiminy Roo
Registered User
Join date: 25 Dec 2004
Posts: 42
01-05-2007 13:45
Hi There.
This allows you to get double clicks from a user. makes interfaces a bit easier to create! warning.. in laggy areas this may not be too good to use.

Enjoy!

CODE

integer poke = FALSE;
default
{
touch_start(integer x)
{
if(poke){
llSetTimerEvent(0);
poke = FALSE;
//double clicked
}
else{
poke = TRUE;
llSetTimerEvent(0.5);//change this depending on how fast you give them to click again
}
}
timer()
{
llSetTimerEvent(0);
poke = FALSE;
//single clicked
}
}

Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
01-06-2007 09:32
/54/6e/158926/1.html
_____________________
i've got nothing. ;)
Dom DaSilva
Registered User
Join date: 18 Jun 2005
Posts: 8
flat object flipping...
01-07-2007 11:21
I was using this code to flip a playing-card prim. It's mechanism goes between two states like the script originally posted does. This gives an option to handle a single, double, or triple click though... Don't know if that's useful or not.

CODE

integer clicks; integer flipped; rotation topward = <0,180,0,0>;
rotation backward = <0,0,0,0>;

handleflipping ()
{
if (flipped==FALSE)
{
llSetRot (topward); flipped = TRUE; return;
}

if (flipped==TRUE)
{
llSetRot(backward); flipped = FALSE;
}
}

default
{
state_entry ()
{
}

listen (integer chan, string name, key id, string mess)
{
if (chan==28) // saying anything on channel 28 flips this card over.
{
handleflipping();
}
}

timer ()
{
clicks=0;
}

touch_start(integer total_number)
{
clicks++;
if (clicks==2) { // the double-click is determined by the 2, of course.
if (clicks==2) { clicks=0; }
handleflipping();
}
}
}