Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer open;
- string digstring = "enter the five digit code";
- list buttons = [" ","0"," ","7","8","9","4","5","6","1","2","3"];
- string answer = "25233";
- string input;
- integer keylis;
- integer method = 0;
- key interId;
- default
- {
- touch_start(integer total_number)
- {
- if(llDetectedTouchFace(0)!=5 && llDetectedTouchFace(0)!= 4)
- {
- if(!open)
- {
- llDialog(llDetectedKey(0),"What do you want to do?",["open","leave alone"],-44);
- }
- if(open)
- {
- llDialog(llDetectedKey(0),"What do you want to do?",["close","leave alone"],-44);
- }
- }
- if(llDetectedTouchFace(0) == 4)
- {
- vector UV = llDetectedTouchUV(0);
- if((UV.x >= 0.11387 && UV.y >= 0.24315) && (UV.x <= 0.72869 && UV.y <= 0.75463))
- {
- interId = llDetectedKey(0);
- llSensor("",interId,AGENT,4,PI);
- method = 1;
- }
- }
- if(llDetectedTouchFace(0) == 5)
- {
- vector UV2 = llDetectedTouchUV(0);
- if((UV2.x >= 0.03189 && UV2.y >= 0.65122) && (UV2.x <= 0.14528 && UV2.y <= 0.36491)) //Blue
- {
- llSay(0,"BLUE!");
- }
- }
- }
- sensor(integer numdect)
- {
- if(llDetectedKey(0) == interId);
- {
- if(method == 1)
- {
- llDialog(interId,digstring,buttons,-5465);
- keylis = llListen(-5465,"",interId,"");
- input="";
- }
- }
- }
- link_message(integer sn, integer num, string msg, key id)
- {
- if(msg == "opened")
- {
- open = TRUE;
- }
- if(msg == "closed")
- {
- open = FALSE;
- }
- }
- listen(integer chn, string name, key id, string msg)
- {
- if((msg == "1")||(msg == "2")||(msg =="3")||(msg == "4")||(msg=="5")||(msg=="6")||(msg == "7")||(msg=="8")||(msg=="9")||(msg=="0"))
- {
- llTriggerSound("866c7334-cd83-1837-9aa4-5c57658447d6",1.0);
- input += msg;
- if(llStringLength(input) == 5)
- {
- if(input == answer)
- {
- llTriggerSound("5a59a4f1-0610-77f3-df6f-aac33bcb685a",1.0);
- llListenRemove(keylis);
- llMessageLinked(LINK_SET,0,"open","");
- llSetTimerEvent(30);
- open = TRUE;
- input = "";
- }
- else
- {
- llTriggerSound("0d196760-c9a6-5acd-8512-476c5cd2d381",1.0);
- llListenRemove(keylis);
- open = FALSE;
- input="";
- }
- }
- else if(llStringLength(input) < 5)
- {
- llDialog(interId,digstring,buttons,-5465);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment