Top Free Scripts
Script ID : 33
Audience : Default
Version 1.00
Published Date: 2010/5/12 5:04:01
Reads : 2395
Time

Have 2 different things happen for regular Touch and Long Touch, (hold for 2 seconds.)

If avatar Touches like normal they get TOUCH 1

If avatar Touches and holds for 2+ seconds they get TOUCH 2

float mintime 2.0//how many seconds to get long touch option

float t;
integer donenow FALSE;
 
default
{
    
on_rez(integer start_param)
    {
        
llResetScript();
    }
    
    
state_entry()
    {
        
donenow FALSE;
    }
    
    
touch_start(integer num_detected)
    {
        
llGetTime();
    }
    
    
touch(integer num_detected)
    {
        
float tempsecs llGetTime() - t;
        if ((
tempsecs >= mintime) && (donenow == FALSE))
        {
            
donenow TRUE;
            
llSay(0"Long Touch detected, you may release Touch now.");
        }
    }
    
    
touch_end(integer num_detected)
    {
        
float secs llGetTime() - t;
        
//llOwnerSay((string)secs + " seconds between touch_start and touch_end"); //debug
        
if (secs >= mintime//greater than or equal
        
{
            
llSay(0"Touch 2"); //debug
        
}
        else 
//regular touch
        
{
            
llSay(0"Touch 1"); //debug
        
}
        
donenow FALSE;
    }
}

0
|  Links 
Printer Friendly Page Send this Script to a Friend
Search for Help
New Product
Free Item
Sponsor

Site Info
Total Hits