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 A_Door_Hinge  

A_Door_Hinge

The script

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

the Zip file

Download all files for A_Door_Hinge
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. A_Door_Hinge_1.lsl
1 // Swinging door LSL script #1
2 // Handles the touch event.
3 // Handles the collision event.
4 // Handles closing the door automatically via a timer event.
5 // Triggers sounds when the door opens or closes.
6
7 // Parameters you might want to change
8
9 float delay = 3.0; // time to wait before
10 // automatically closing door
11
12 float direction = 1.0; // set to 1.0 or -1.0 to control
13 // direction the door swings
14
15 float volume = 0.5; // 0.0 is off, 1.0 is loudest
16
17 // Variables you will most likely leave the same
18
19 key open_sound = "cb340647-9680-dd5e-49c0-86edfa01b3ac";
20 key close_sound = "e7ff1054-003d-d134-66be-207573f2b535";
21
22 // Processing for the script when it first starts up
23
24 default {
25 // What we do when we first enter this state
26
27 state_entry() {
28 state open; // Move to the open state
29 }
30 }
31
32 // Processing for the script when it is in the closed state
33
34 state closed {
35 // What we do when we first enter this state
36
37 state_entry() {
38 llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
39 llSetRot(llEuler2Rot(<0, 0, direction * PI_BY_TWO>) * llGetRot());
40
41 }
42
43 // What we do when the door is clicked ("touched") with the mouse
44
45 touch_start(integer total_number) {
46 state open; // Move to the open state
47 }
48
49 // What to do when something hits the door
50
51 collision_start(integer total_number)
52 {
53 state open; // Move to the open state
54 }
55
56 // What to do when the timer goes off
57
58 timer()
59 {
60 llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
61 }
62 }
63
64 // Processing for the script when it is in the open state
65
66 state open {
67 // What we do when we first enter this state
68
69 state_entry() {
70 llTriggerSound(open_sound, volume);// Trigger the sound of the door opening
71 llSetRot(llEuler2Rot(<0, 0, -direction * PI_BY_TWO>) * llGetRot());
72
73 llSetTimerEvent(delay); // Set the timer to automatically close it
74 }
75
76 // What do do when pulling the door from Inventory if it was saved while open
77
78 on_rez(integer start_param) {
79 state closed;
80 }
81
82 // What we do when the door is clicked ("touched") with the mouse
83
84 touch_start(integer total_number) {
85 state closed; // Move to the closed state
86 }
87
88 // What to do when something hits the door
89
90 collision_start(integer total_number)
91 {
92 // Do nothing, the door is already open
93 }
94
95 // What to do when the timer goes off
96
97 timer()
98 {
99 llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
100 state closed; // Move to the closed state
101 }
102 }

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