// Door authorization LSL script #2 // Handles the touch event. // Handles partial transparency when the door is in phantom mode. // Allows only the owner to open the door, but checks all who click it. // Processing for the script when it first starts up float alpha = 0.75; // alpha value for partial transparency // of the door when in phantom mode. // 1.0 is solid, 0.0 is transparent. default { // What we do when we first enter this state state_entry() { state closed; // Move to the closed state } } // Processing for the script when it is in the closed state state closed { // What we do when we first enter this state state_entry() { llSetStatus(STATUS_PHANTOM,FALSE); // Turn off phantom property llSetLinkAlpha(LINK_SET, // Turn off transparency 1.0, ALL_SIDES); } // What we do when the door is clicked ("touched") with the mouse touch_start(integer total_number) { // If the door was clicked by the owner of the door, open it, // otherwise give a message. Check everyone who clicked the door. integer allow_access = FALSE; integer i; for (i = 0; i < total_number && ! allow_access; ++i) { if (llGetOwner() == llDetectedKey(i)) { allow_access = TRUE; } } if (allow_access) { state open; // Move to the open state } else { llSay(0, "Sorry, you are not authorized to open the door."); } } } // Processing for the script when it is in the open state state open { // What we do when we first enter this state state_entry() { llSetStatus(STATUS_PHANTOM,TRUE); // Turn on phantom property llSetLinkAlpha(LINK_SET, // Turn on partial transparency alpha, ALL_SIDES); } // What we do when the door is clicked ("touched") with the mouse touch_start(integer total_number) { state closed; // Move to the closed state } }