Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Double Tapping

Victor Reisman
Smithy of SL
Join date: 5 May 2006
Posts: 18
05-06-2007 17:33
I know the theory behind double tapping a direction to do an action...by setting an event timer, I just dont know the actual script code, can anyone help?
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
05-06-2007 19:47
here is a rough idea there will just be a small delay for one click

CODE

integer click;
default
{
touch_start(integer num)
{
llSetTimerEvent(0.5);//time between clicks
if (click)
{
llSetTimerEvent(0.0);
click = FALSE;
//code here for double
llOwnerSay("double click");
}
else click = TRUE;
}
timer()
{
llSetTimerEvent(0.0);
click = FALSE;
//code here for single click
llOwnerSay("Single click");
}
}
Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
05-06-2007 20:39
There's an example under llGetAndResetTime in the sripting wiki (the old wiki at techrealms and rpgnet ... not sure its on the new wiki) that can be adapted without too much effort; also I think somebody's already posted a doubleclick script either here or in the library - search it out!

CODE

default
{
touch_start( integer total_number )
{
float elapsed = llGetAndResetTime();
float deadline = 10.0;

if ( elapsed >= deadline )
llWhisper( 0, "I'm sorry, you were too slow: "
+ (string)elapsed
+ " seconds" );
else
llWhisper( 0, "Yay! You beat the deadline by "
+ (string)(deadline - elapsed)
+ " seconds" );
}
}
Victor Reisman
Smithy of SL
Join date: 5 May 2006
Posts: 18
05-06-2007 21:15
I was looking for double tapping a direction, not double clicking :/ Ill try to use this, should work the same way, but I would still appreciate a soling script code if anyones feeling generous :D