Guest User

Untitled

a guest
Jan 12th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer open;
  2. string digstring = "enter the five digit code";
  3. list buttons = [" ","0"," ","7","8","9","4","5","6","1","2","3"];
  4. string answer = "25233";
  5. string input;
  6. integer keylis;
  7. integer method = 0;
  8. key interId;
  9.  
  10.  
  11.  
  12. default
  13. {
  14.     touch_start(integer total_number)
  15.     {
  16.         if(llDetectedTouchFace(0)!=5 && llDetectedTouchFace(0)!= 4)
  17.         {
  18.             if(!open)
  19.             {
  20.                 llDialog(llDetectedKey(0),"What do you want to do?",["open","leave alone"],-44);
  21.                
  22.             }
  23.             if(open)
  24.             {
  25.                  llDialog(llDetectedKey(0),"What do you want to do?",["close","leave alone"],-44);
  26.             }
  27.         }
  28.         if(llDetectedTouchFace(0) == 4)
  29.         {
  30.             vector UV = llDetectedTouchUV(0);
  31.             if((UV.x >= 0.11387 && UV.y >= 0.24315) && (UV.x <= 0.72869 && UV.y <= 0.75463))
  32.             {
  33.                 interId = llDetectedKey(0);
  34.                 llSensor("",interId,AGENT,4,PI);
  35.                 method = 1;
  36.             }
  37.         }
  38.         if(llDetectedTouchFace(0) == 5)
  39.         {
  40.             vector UV2 = llDetectedTouchUV(0);
  41.             if((UV2.x >= 0.03189 && UV2.y >= 0.65122) && (UV2.x <= 0.14528 && UV2.y <= 0.36491))  //Blue
  42.             {
  43.                 llSay(0,"BLUE!");
  44.             }
  45.         }
  46.     }
  47.     sensor(integer numdect)
  48.     {
  49.         if(llDetectedKey(0) == interId);
  50.         {
  51.             if(method == 1)
  52.             {
  53.                 llDialog(interId,digstring,buttons,-5465);
  54.                 keylis = llListen(-5465,"",interId,"");
  55.                 input="";
  56.             }
  57.         }
  58.     }
  59.     link_message(integer sn, integer num, string msg, key id)
  60.     {
  61.         if(msg == "opened")
  62.         {
  63.             open = TRUE;
  64.         }
  65.         if(msg == "closed")
  66.         {
  67.             open = FALSE;
  68.         }
  69.     }
  70.     listen(integer chn, string name, key id, string msg)
  71.     {
  72.         if((msg == "1")||(msg == "2")||(msg =="3")||(msg == "4")||(msg=="5")||(msg=="6")||(msg == "7")||(msg=="8")||(msg=="9")||(msg=="0"))
  73.         {
  74.             llTriggerSound("866c7334-cd83-1837-9aa4-5c57658447d6",1.0);
  75.             input += msg;
  76.             if(llStringLength(input) == 5)
  77.             {
  78.                 if(input == answer)
  79.                 {
  80.                     llTriggerSound("5a59a4f1-0610-77f3-df6f-aac33bcb685a",1.0);
  81.                     llListenRemove(keylis);
  82.                     llMessageLinked(LINK_SET,0,"open","");
  83.                     llSetTimerEvent(30);
  84.                     open = TRUE;
  85.                     input = "";
  86.                 }
  87.                 else
  88.                 {
  89.                     llTriggerSound("0d196760-c9a6-5acd-8512-476c5cd2d381",1.0);
  90.                     llListenRemove(keylis);
  91.                     open = FALSE;
  92.                     input="";
  93.                 }
  94.             }
  95.             else if(llStringLength(input) < 5)
  96.             {
  97.                 llDialog(interId,digstring,buttons,-5465);
  98.             }
  99.            
  100.         }
  101.     }
  102. }
Add Comment
Please, Sign In to add comment