revochen Mayne Posted March 19, 2012 Share Posted March 19, 2012 This script detects if it gets touched once or twice within a short period of time. float touchTime = 0.3; list touchKeys = []; list touchTypes = []; default { touch_start(integer total_number) { key who = llDetectedKey(0); if(llListFindList(touchKeys,[who])==-1) { touchKeys += who; touchTypes += "singleTouch"; llSetTimerEvent(touchTime); } else { integer i = llListFindList(touchKeys,[who]); touchTypes = llListReplaceList(touchTypes,["doubleTouch"],i,i); } } timer() { integer i = 0; integer m = llGetListLength(touchKeys); llSetTimerEvent(0); while(i<m) { if(llList2String(touchTypes,i)=="singleTouch") { // do something on single touch llSay(0, "Thanks for your single touch "+llKey2Name(llList2Key(touchKeys,i))+"!"); } else { // do something on double touch llSay(0, "Thanks for your double touch "+llKey2Name(llList2Key(touchKeys,i))+"!"); } ++i; } touchKeys = []; touchTypes = []; } } Link to comment Share on other sites More sharing options...
Recommended Posts
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