Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- //#################################################################################################################################
- //
- // Detect Long or Short Touch
- //
- // Dorex Delicioso 2023
- //
- //#################################################################################################################################
- integer DODEBUG = TRUE;
- // ############################## VARIABLES ##############################
- float touchEventTime;
- // ############################## FUNCTIONS ##############################
- sayDebug(string text){
- if (DODEBUG){
- llOwnerSay(text);
- }
- }
- shortTouch(key avId){
- sayDebug("short Touch");
- }
- longTouch(key avId){
- sayDebug("long Touch");
- }
- // ############################## DEFAULT STATE ##############################
- default
- {
- on_rez(integer start) {
- llResetScript();
- }
- touch_start(integer a)
- {
- touchEventTime = llGetTime();
- }
- touch_end(integer num_detected){
- // how long is a long touch, in seconds
- integer longTouchMinTime = 2;
- if (llGetTime() > touchEventTime + longTouchMinTime){
- longTouch(llDetectedKey(0));
- } else {
- shortTouch(llDetectedKey(0));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement