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
Elevator Two floor keyframe elevator with sit  

Two floor keyframe elevator with sit


This is a simple 2 floor elevator, consisting of 3 scripts, one for the elevator itself, another for the elevator
call button, and a 3rd for the elevator door to open and close. The door in this case is a hollowed cylinder,
giving a slightly futuristic look. Operation is intuitive and simple: Just stand on the elevator, and it will
go up (or down) as necessary. If the elevator is not on your floor, the door will be closed and you will need
to press the call button.
The elevator is a simple, flattened disk, and the assumption going forward is the elevator will be a flattened
prim you step onto.
originally found at http://www.sluniverse.com/php/vb/script-library/68363-2-floor-key-framed-elevator.html

Category: Elevator
By : Soen Eber
Created: 2014-12-04 Edited: 2014-12-04
Worlds: Second Life

the Zip file

Download all files for Two floor keyframe elevator with sit
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. call button.lsl
Get file # 2. door.lsl
Get file # 3. elevator.lsl
1
2
3 // While operation is simple, there are enough complexities in the setup that you should probably have some experience
4 // with building and scripting, or have a friend available who is.
5
6 // Setup requires the following steps:
7
8 // 1. Edit the DESCRIPTION field of the prim or prims containing the elevator script to the word "setup" (without quotes),
9 // and then reset the script using tools -> reset. If the elevator is more than one prim, make sure the script is in the
10 // root prim. THE ELEVATOR SHOULD NOT BE LINKED TO ANYTHING ELSE or strangeness will occur.
11
12 // 2. Follow the prompt to move the elevator to the first floor location, and then reset again with tools -> reset.
13 // You will be prompted to move the elevator to the 2nd floor location. Once you have done so, reset the script
14 // again with tools -> reset.
15
16 //3. Place the prim or prims containing the elevator call script on each floor. For the 1st floor change the
17 // DESCRIPTION to "1" (no quotes) and to "2" (again, no quotes) for the 2nd floor. If you link the prim(s//)
18 // containing the call button to anything, its probably not a good idea to make the prim with the call script
19 // in it a root prim or strangeness will occur.
20
21 // 4. (optional) Place the prim or prims containing the elevator door script on each floor, changing the
22 // description as you did for the prim containing the call script. The door in this case will be a hollowed cylinder,
23 // hollowed to 95% with a path cut from .375 to .625. If you want a rectangular, non-curved door or a double door
24 // that opens from the center, you will have to roll your own script or get someone to write it for you,
25 // using the existing elevator door script as a template.
26
27 // Altered by Vegaslon Plutonian to be a sit type elevator instead of stand
28 // from http://forums.osgrid.org/viewtopic.php?f=5&t=5201&hilit=lift
29
30 float wait;
31 integer ch = -11;
32 integer floor_start;
33 integer floor_dest;
34 vector pos_1;
35 vector pos_2;
36 vector elevator_scale;
37 float scan_radius;
38 string context;
39 integer CHANNEL = 42; // dialog channel
40 list MENU_MAIN = ["Floor 1", "Floor 2"];
41
42 calc_start()
43 {
44 if(llVecDist(llGetPos(), pos_1) < 3.5) floor_start = 1;
45 else if(llVecDist(llGetPos(), pos_2) < 3.5) floor_start = 2;
46 }
47 calc_dest()
48 {
49 if(floor_start == 1) floor_dest = 2;
50 else floor_dest = 1;
51 }
52 go()
53 {
54 float move;
55 vector v = llGetPos();
56 if(floor_dest == 1) move = pos_1.z - v.z;
57 if(floor_dest == 2) move = pos_2.z - v.z;
58 if(llFabs(move) > 1.5) llWhisper(ch, (string)floor_start+" depart");
59 wait = 3;
60 context = "moving";
61 llSetKeyframedMotion([<0,0,move>,ZERO_ROTATION,8],[]);
62 }
63 get_floor_pos()
64 {
67 llWhisper(0,"floor 1="+(string)pos_1);
69 llWhisper(0,"floor 2="+(string)pos_2);
70 llWhisper(0,"If these are not the correct positions, please change the elevator description to 'reset' (no quotes),");
71 llWhisper(0,"reset its script using Tools -> Reset Scripts in Selection, and follow the prompts");
72 }
73 get_set_floor_pos()
74 {
76 if(s == "reset") {
77 llWhisper(0, "Please move the elevator floor to first floor starting position, "
78 + "and then reset its script using Tools -> Reset Scripts in Selection"
79 );
80 llSetObjectDesc("setup");
81 }
82 else if(s == "setup") {
83 s = "1="+(string)llGetPos();
84 llWhisper(0,"Setting first floor to "+s);
85 llWhisper(0,"Now please move the elevator floor to the second floor starting position and reset the script");
87 }
88 else if(llSubStringIndex(s,"2=") == -1) {
89 s+=(";2="+(string)llGetPos());
90 llWhisper(0,"Setting desc to "+s);
92 get_floor_pos();
93 }
94 else {
95 get_floor_pos();
96 }
97 }
98 default
99 {
101 {
102 llListen(CHANNEL, "", NULL_KEY, "");
103 llSitTarget(<0,-0.5,0.5>, llEuler2Rot(<0,0,-90>) );
104 llSetText("Sit Here to Ride Elevator",<0,0,0>,1.0);
105
106 elevator_scale = llGetScale();;
107 if(elevator_scale.x >= elevator_scale.y) scan_radius = elevator_scale.x;
108 else scan_radius = elevator_scale.y;
109 get_set_floor_pos();
110 state operate;
111 }
112 }
113 state operate
114 {
116 {
117 llListen(ch,"",NULL_KEY,"");
118 if(context == "moving") {
119 llShout(ch, (string)floor_dest+" arrived");
120 context = "exiting";
121 wait = 3;
122 state idle;
123 }
124 else if(context == "exiting") {
125 context = "";
126 }
127 }
128
129 changed(integer Change)
130 {
131 llDialog(llAvatarOnSitTarget(), "Where to?", MENU_MAIN, ch);
132 }
133 listen(integer ch,string name,key id,string msg)
134 {
135 integer idx = llListFindList(MENU_MAIN, [msg]);
136 if( idx!=-1 )
137 {
138 llSay(0,"Elevator heading to " + msg + "." );
139 calc_start();
140 floor_dest = idx+1;
141 go();
142 state idle;
143 }
144 else if(llListFindList(["1 call","2 call"],[msg]) != -1) {
145 calc_start();
146 floor_dest = (integer)llGetSubString(msg,0,0);
147 go();
148 state idle;
149 }
150 }
151 }
152 state idle
153 {
155 {
156 llSetTimerEvent(wait);
157
158 }
159 changed(integer Change)
160 {
162 }
163
164 timer()
165 {
167 state operate;
168 }
169 }

Two floor keyframe elevator with sit

Call Button for two floor elevator

Category: Elevator
By : Soen Eber
Created: 2014-12-04 Edited: 2014-12-04
Worlds: Second Life

1 // Elevator Call Script (for 2 floors)
2 // Write the floor number (1 or 2) in the description
3 // Altered by Vegaslon Plutonian to use shout instead of whisper for communication since some elevators are really tall.
4 // from http://forums.osgrid.org/viewtopic.php?f=5&t=5201&hilit=lift
5
6 integer ch = -11;
7 integer floor;
8 integer ready = TRUE;
9 status(integer flg)
10 {
11 ready = flg;
12 llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_FULLBRIGHT,ALL_SIDES, flg]);
13 }
14 default
15 {
17 {
18 llListen(ch,"",NULL_KEY,"");
19 floor = (integer)llGetObjectDesc();
20 }
21 listen(integer ch,string name,key id,string msg)
22 {
23 if(llSubStringIndex(msg,"arrived") != -1) {
24 llSleep(3);
25 status(TRUE);
26 }
27 else if(msg == (string)floor+" depart") {
28 status(FALSE);
29 }
30 }
31 touch_start(integer total_number)
32 {
33 if(ready == TRUE) llShout(ch, (string)floor+" call");
34 else llWhisper(0, "Please Wait");
35 }
36 }

Two floor keyframe elevator with sit

Two floor key frame elevator door script

Category: Elevator
By : Soen Eber
Created: 2014-12-04 Edited: 2014-12-04
Worlds: Second Life

1 integer ch = -11;
2 integer floor;
3 open()
4 {
5 llSetLinkPrimitiveParamsFast(
6 LINK_THIS,[PRIM_TYPE,PRIM_TYPE_CYLINDER,PRIM_HOLE_CIRCLE,<0.375,0.4,0.0>,0.95,<0,0,0>,<1,1,0>,<0,0,0>]
7 );
8 }
9 close()
10 {
11 llSetLinkPrimitiveParamsFast(
12 LINK_THIS,[PRIM_TYPE,PRIM_TYPE_CYLINDER,PRIM_HOLE_CIRCLE,<0.375,0.625,0.0>,0.95,<0,0,0>,<1,1,0>,<0,0,0>]
13 );
14 }
15 default
16 {
18 {
19 floor = (integer)llGetObjectDesc();
20 llListen(ch,"",NULL_KEY,"");
21 }
22 listen(integer ch,string name,key id,string msg)
23 {
24 if(msg == (string)floor+" arrived") {
25 open();
26 }
27 else if(msg == (string)floor+" depart") {
28 close();
29 }
30 }
31 }

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