Door script 0.1
Appearance
<source lang="lsl"> /*
Fu's talking door script
v0.1 - state changes - passing data between states - llListen() and listen event handler
v0.0 - basic states
(c)2017 - Fu Barr (OSGrid)
- /
integer DEBUG = TRUE;
string passphrase = "Pretty please";
string txt_locked = "Locked."; string txt_welcome = "Welcome, ";
key avatar_uuid;
default {
state_entry() {
llOwnerSay("running " + llGetScriptName());
state closed; }
}
state closed {
state_entry() {
avatar_uuid = NULL_KEY;
llListen(0, "", NULL_KEY, passphrase); // NOTE: implicit passphrase checking }
touch_end(integer t){
llSay(0, txt_locked); }
listen(integer channel, string name, key uuid, string msg) {
avatar_uuid = uuid;
if(DEBUG){llOwnerSay("Passphrase spoken by: " + avatar_uuid);}
state open;
}
}
state open {
state_entry() {
llSay(0, txt_welcome + llKey2Name(avatar_uuid));
state closed; }
} </source>