Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Door deluxe_door_script_by  

deluxe_door_script_by

deluxe door script by Ezhar Fairlight.lsl

Category: Door
By : Ezhar Fairlight
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for deluxe_door_script_by
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. deluxe_door_script_by_Ezhar_Fairlig_1.lsl
1
2 // deluxe door script by Ezhar Fairlight
3 // features: one prim, no building skills required, automatic closing, workaround for rotation drift,
4 // doesn't mess up when moved, adjustable direction (inwards/outwards) and sound volume, HHGG quotes!
5 // updated for SL 1.5
6
7 // just rez a cube primitive and put this script inside - it will shape and texture itself into a door
8
9 // ********** SETTINGS HERE ************
10 float TIMER = 30.0; // automatically close the door after this many seconds,
11 // set to 0 to disable automatic closing
12
13 integer DIRECTION = -1; // direction door opens in. Either 1 (outwards) or -1 (inwards);
14
15 float VOLUME = 0.8; // sound volume, 1.0 loudest, 0.0 to disable sound
16 // ********** END OF SETTINGS **********
17
18
19 key SOUND_OPEN = "cb340647-9680-dd5e-49c0-86edfa01b3ac";
20 key SOUND_CLOSE = "e7ff1054-003d-d134-66be-207573f2b535";
21
22 vector gPos; // door position (objects move a tiny amount
23 // away from their position each time they are rotated,
24 // thus we need to workaround this by resetting
25 // the position after rotating)
26
27 door(integer open) {
28 if(open) {
29 llTriggerSound(SOUND_OPEN, VOLUME);
30 llSetRot(llEuler2Rot(<0, 0, -DIRECTION * PI_BY_TWO>) * llGetRot());
31 } else { // close
32 llSetRot(llEuler2Rot(<0, 0, DIRECTION * PI_BY_TWO>) * llGetRot());
33 llTriggerSound(SOUND_CLOSE, VOLUME);
34 }
35 }
36
37
38 default { // first time startup
39 state_entry() {
40 if(llGetTexture(0) == "89556747-24cb-43ed-920b-47caed15465f") { // is default texture, set it up
41 llSetPos(llGetPos() + <0, 0, 3.325 / 2 - 0.25>);
42 llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375, 0.875, 0>, 0.0, ZERO_VECTOR, <1, 1, 0>, ZERO_VECTOR,
43 PRIM_SIZE, <0.2, 4, 3.325>,
44 PRIM_TEXTURE, 0, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <2.000000, 0.060000, 0.000000>, <0.500015, 0.469985, 0.000000>, 1.570840,
45 PRIM_TEXTURE, 1, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <-2.000000, 1.000000, 0.000000>, <0.500015, 0.000000, 0.000000>, 0.000000,
46 PRIM_TEXTURE, 2, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <0.100000, 1.000000, 0.000000>, <0.599994, 0.000000, 0.000000>, 0.000000,
47 PRIM_TEXTURE, 3, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <2.000000, 1.000000, 0.000000>, <0.500015, 0.000000, 0.000000>, 0.000000,
48 PRIM_TEXTURE, 4, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <2.000000, 0.080000, 0.000000>, <0.500015, 0.550005, 0.000000>, 1.570840,
49 PRIM_TEXTURE, 5, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <0.100000, 1.000000, 0.000000>, <0.449995, 0.000000, 0.000000>, 0.000000,
50 PRIM_TEXTURE, 6, "086c7e6b-bdd6-7388-f146-f3d1b353ed15", <0.100000, 1.000000, 0.000000>, <0.449995, 0.000000, 0.000000>, 0.000000]
51 );
52 llSetObjectName("Door Deluxe");
53 llSetObjectDesc("Door Deluxe (for SL 1.5) - free script available at http://www.badgeometry.com/wiki/LibraryDoor");
54 llSay(0, "Thank you for making a simple door very happy.");
55 }
56 gPos = llGetPos(); // remember where we're supposed to be
57 door(TRUE);
58 state closed;
59 }
60 }
61
62 state closed { // door is closed
63 on_rez(integer start_param) {
64 gPos = llGetPos();
65 }
66
67 state_entry() {
68 door(FALSE);
69 }
70
71 touch_start(integer total_number) {
72 state open;
73 }
74
75 moving_end() { // done moving me around, store new position
76 gPos = llGetPos();
77 }
78 }
79
80 state open { // door is open
81 on_rez(integer start_param) {
82 gPos = llGetPos();
83 state closed;
84 }
85
86 state_entry() {
87 llSetTimerEvent(TIMER);
88 llSetPos(gPos); // rotation drift workaround
89 door(TRUE);
90 }
91
92 touch_start(integer num) {
93 state closed;
94 }
95
96 timer() { // auto-close
97 state closed;
98 }
99
100 moving_start() { // close when being moved
101 state closed;
102 }
103
104 state_exit() {
106 }
107 }// END //

Back to the Best Free Tools in Second Life and OpenSim.