/* Playing with the TOUCH events Determine how long a person holds down the mouse and have the script perfomr various actions pending touch length, Example of uses: Click to operate gadget Long click (Hold DOwn mouse for more than a second for other options or the longer the touch the more health given and so on. */ float TouchBegins; float TouchEnded; default { state_entry() { } touch_start(integer i){ TouchBegins = llGetTime(); llOwnerSay("Mouse is held down"); } touch_end(integer i){ TouchEnded = llGetTime(); float Duration = TouchEnded - TouchBegins; llOwnerSay("Mouse button released."); llOwnerSay("You held the mouse down for " + (string)Duration + " seconds"); if(Duration < 1) llOwnerSay("Short and sweet."); else if(Duration < 2) llOwnerSay("That is a touch longer."); else if(Duration < 4) llOwnerSay("Getting my interest now.. Try for 5 seconds"); else llOwnerSay("Gosh, what endurance you have. \"Call Me\""); } }