Keypad Door

From The SchomEmunity Wiki
Jump to: navigation, search

This script I got off the actual Linden Forum, but try as I might, it doesn't work. You can buy it from the guy who made it (see bottom) but I doubt the staff would like that. This does however, solve the problem of privacy on the island.

you say it doesn't seem to work. Any idea why? - Dan
Umm, one breif thing, its wouldnt solve privacy as such...for that we would need walls or forcefeilds that stop / bann ppl from coming into the area...the keypad door just moovs standard security up a notch....it not like if you put a security door on the library i wouldnt be able to get in, or even on anythiing else...the only time thins would be of much use is above 768 because thats how high prims go...but then you cant decorate your building...so go figure! - Baso

Not yet, but I will endeavour to sort it out :S This keypad Door is composed of 3 scripts, one for the door, one for the keypad, and one for each keypad button. Below is the script for the button: Put this script in each button. Make 11 buttons and name them the following: "Reset","Enter",and the numbers 1-9.

//Button Script default {

   touch_start(integer total_number)
   {
       llMessageLinked(LINK_ROOT,1,llGetObjectName(),NULL_KEY);
   }

}

Then mount the buttons on a root prim and call the root prim "Key Pad" (without quotes) and put the following script in it. On rez it will ask you what you want the code to be, say it in the form x,y,z with as many digits as desired. After 15 seconds of not anwsering, it we default to 1,2,3,4.

integer channel = 3800; //If you change this remeber to change it in the door script as well list temp; list code = [1,2,3,4]; integer handle;

default {

   on_rez(integer param)
   {
       handle = llListen(0,"",llGetOwner(),"");
       llOwnerSay("What do you wish the code to be?");
       llSetTimerEvent(15);
   }
   link_message(integer send_num, integer num, string msg, key id)
   {
       if(msg == "Reset")
       {
           temp = [];
       }
       if(msg == "Enter")
       {
           if(temp != code)
           {
               llWhisper(0,"Incorrect Code!!");
               temp = [];
           }
           if(llList2CSV(temp) == llList2CSV(code))
           {
               llWhisper(channel,"open");
               llWhisper(0,"You may enter.");
               temp = [];
           }
       }
       if(msg != "Reset" && msg != "Enter")
       {
           temp += [(integer)msg];
           if(llGetListLength(temp) > llGetListLength(code))
           {
               temp = [];
           }
       }
   }
   timer()
   {
       llOwnerSay("You have run out of time. Setting default " + llList2CSV(code));
       llListenRemove(handle);
       llSetTimerEvent(0);
   }
   listen(integer chan, string name, key id, string msg)
   {
       llListenRemove(handle);
       code = llCSV2List(msg);
       llOwnerSay("Code set to " + llList2CSV(code) + ".");
       llSetTimerEvent(0);
   }

}

Now the door script. The door can be called anything. Script is as follows:

integer channel = 3800; //Must be the same as in the key pad script float open_time = 3; //Change to how long you want it to stay open

default {

   state_entry()
   {
       llListen(3800,"Key Pad",NULL_KEY,"open");
   }
   listen(integer chan, string name, key id, string msg)
   {
       llSetStatus(STATUS_PHANTOM,TRUE);
       llSetAlpha(0.1,ALL_SIDES);
       llSleep(open_time);
       llSetAlpha(1.0,ALL_SIDES);
       llSetStatus(STATUS_PHANTOM,FALSE);
   }

}

If you want the completed object with key pad and door, you can buy it at http://www.tslemporium.com for 30 L$. I will not give support to people who use the scripts on this page for thier own door, only paying customers.

Retrieved from "http://wiki.secondlife.com/wiki/Key_Pad_Door"