Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Elevator script with call/floor buttons

Ingie Bach
Registered User
Join date: 17 Dec 2002
Posts: 254
08-01-2004 19:47
Ok, here is my elevator script, built on bits of other people's work where I learned it... so long ago, I don't remember who. In fact this script is pretty old (I think over a year?)


Button script, make two buttons per floor, one attached to the elevator itself, the other as a call button on the outside of the elevator on the floor it represents:

First Floor:
CODE

default
{
touch_start(integer total_number)
{
llSay(3,"one"); //Triggers the elevator
llSay(0, "Welcome to the First Floor"); //the welcome message.
}
}


Second Floor:
CODE

default
{
touch_start(integer total_number)
{
llSay(3,"two"); //Triggers the elevator
llSay(0, "Welcome to the Second Floor"); //the welcome message.
}
}

Third Floor:
CODE

default
{
touch_start(integer total_number)
{
llSay(3,"three"); //Triggers the elevator
llSay(0, "Welcome to the Third Floor"); //the welcome message.
}
}


Then there is the elevator scrpt:

CODE

//Elevator Script

vector start_pos;
default
{
state_entry()
{
llSetStatus (STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, FALSE);
start_pos=llGetPos();
llSetStatus(STATUS_PHYSICS,TRUE);
llMoveToTarget(start_pos,1.5);
key id ="";
llListen(3,"",id,"");//choose a different channel for your elevator to listen to other than 0, which would be "audiable" I chose 3 here
}

listen(integer a, string n, key id, string m)
{
vector move_pos;
if (m=="two")//This is for the second floor level
{
move_pos=start_pos+<0,0,1>;//exparament to set the hight just right, usually around 6 meters per floor, but of course that can very, plus you want to get it just right.
llMoveToTarget(move_pos,0.2);//this is set so that the elevator does not colide with the floor (and cause it to wiggle, giggle and jerk)
}
if (m=="three")//this is the third floor
{
move_pos=start_pos+<0,0,2>;//This would normally be set around 12 meters. The settings could also be set for sideways elevators, like on the Enterprise ;P go to exact locations!
llMoveToTarget(move_pos,0.2);
}
if (m=="one")
{
llMoveToTarget(start_pos,0.2);//we go home here to where the elevator was created or the script was started.
}

}
}


I sure hope people like that... I have a sample elevator you can come by and copy at Sistiana 132, 114 (pardon my dust) I really will get back to that Bradbury building, I promise!!!

Love Ingie

edit- edited to make it a little more readable, and fixed one line that would have broken it on a copy paste. ne
_____________________
I love modeling in Blender, if you want to check out a fantastic package for modeling and game developement (great for Architectural Walkthroughs), go to my site: http://www.ingiebee.com
Ingie Bach
Registered User
Join date: 17 Dec 2002
Posts: 254
Discussion Thread
08-06-2004 11:35
/54/4c/58432/1.html

----------------------------------

use llShout instead of llSay if your elevator doesn't hear your call buttons on the outside due to distance.

Also, increase the second factor in:
llMoveToTarget(move_pos,0.2);

Change the 0.2 to something more like 3 for a better speed. You may like a larger number too, but then the decelleration is so slow it can become annoying.

Ingie
_____________________
I love modeling in Blender, if you want to check out a fantastic package for modeling and game developement (great for Architectural Walkthroughs), go to my site: http://www.ingiebee.com
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
08-08-2005 14:25
From: Ingie Bach
use llShout instead of llSay if your elevator doesn't hear your call buttons on the outside due to distance.

I have an elevator that goes from 42.5-Z to 470.75-Z....far beyond shout distance for my call buttons on those floors. I've heard of ppl using email to call the elevator, but haven't seen any sample code on how to do that. By the way, I'm using Hank Ramos's free "Elevator in a Box" with a modified elevator car and no shaft. Thank you Hank for making that available. My elevator works fine with the buttons inside the elevator, I just want to be able to call it with email from beyond shout range.

Thank you!
a lost user
Join date: ?
Posts: ?
cannot stand on elevator
08-19-2005 22:30
Hi,
I used Ingie Bach's script to build a beautiful elevator - thanks Ingie ~ it works!!
/15/2c/19094/1.html


The thing is, avatar cannot stand on it.
Can sit on it, but when approach to stand on it it moves away.
Cannot jump on it either ~

wierd.
Anyone had this issue?
thanks for your help!!
_____________________
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
08-20-2005 12:13
/15/2c/19094/1.html
_____________________
i've got nothing. ;)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
08-20-2005 12:19
/54/4c/58432/1.html

please note that i have made a discussion thread for this over in the scripting tips forum so that you can work through this script more efficiently.
_____________________
i've got nothing. ;)