Elevator Call button via email
|
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
|
08-09-2005 11:14
I have an elevator that I made using the scripts from Hank Ramos's free Elevator in a Box kit. Thanks, Hank for making that available! I even added a bench to the elevator so the rider can sit down for a smooth ride -- no more banging around inside.
The ground floor for my elevator is on a deck at 42.75-Z, and the ele goes up to a deck at 470.75-Z. The buttons in the elevator work fine, but I need to be able to call the ele when it is not on the floor where the rider is. Since the distance is beyond shout range I cant call the elevator simply that way. I've seen and read where this can be done via email. I have a small kiosk/panel on each floor with a single call button. Right now the call button just says the "goto floor x" command that the ele script is listening for. Can anyone give me a hint (or code snippet) on how to use email in this call button to summon the elevator from such a great distance?
Thanks!
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
08-09-2005 11:43
This wasn't done in world so it may not compile. Also llEmail is a good place to look up the function  . key Destination = "";//Your elevator key goes here string msg_string = "This is a message";//your msg to listen for goes here default { state_entry() { llEmail((string)Destination + "@lsl.secondlife.com", "This is a subject", "This is a message"); llSetTimerEvent(5); } timer() { llGetNextEmail("", ""); } email(string time, string address, string subj, string msg, integer num_left) { string Clipped_Msg = llDeleteSubString(msg, 0, llSubStringIndex(msg, "\n\n") + 1); if(Clipped_Msg == msg_string) { //Do stuff } } }
|
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
|
08-09-2005 11:55
Thank you!! I'll give this a try tonight.
|
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
|
08-11-2005 09:44
Thanks so much for the script, Cid. It compiled fine the first time, just as you wrote it. Unfortunately, I can't get all this to work right yet. Here's my set-up.
Elevator car has Hank Ramos' elevator script in it, which listens for the command "goto floor 0" (at 42.75-Z) or "goto floor 1" (located at 470.75-Z). I made an "Up" button for going from the ground floor to Floor 1, and a "Ground Floor" button for going from Floor 1 to the Ground Floor. These buttons are linked to the inside wall of the elevator and they work fine by "llSay"-ing the "goto floor x" command. Because of the great distance between floors, I have put a small kiosk on each floor beside the elevator parking place, and each kiosk has a single button that when pressed should do one of two things...
(1) Send an email message directly to the elevator (using its key) which right now is only listening for its command. If I do this dont I need a script in the elevator to receive the email? This should call the elevator to either Floor where the kiosk is.
(2) Send an email message do the other kiosk and tell it to say the "goto floor x" command, since the elevator should be sitting right beside the kisok. This command would actually SEND the elevator to the other floor.
Maybe I'm missing something obvious. I see the "//Do stuff" part of your script, which I guess could be where my "llSay" command could go..not sure. Also, this entire email script needs to be activated with a "touch_start". hmmmm. Thanks for your patience with me on this. Any help would be appreciated, and I 'd be glad to meet with you inworld about it and compensate you for your consultation time.
Thanks!
|
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
|
08-12-2005 10:02
w00t! I figured it all out last night. If you want to see my pretty decent elevator (using Hank Ramos's main elevator script in the car), come to my island "Esacpe". When you get off the telehub, go to the back corner of the island behind my log house. The ele platform is back there.
Oh and btw..Escape is connected to my SL fiance's island "Enchanted". If you come and visit, anyone can ride the vehicles...jetskis, helos, speed boats, etc. Enchanted Escape islands are meant to be a place that anyone can come and enjoy. It is a non-commercial zone.
Anyway, thanks for pointing me in the right direction on the email script.
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-14-2005 23:53
While email certainly works it requires a timer and a lot of code that is not really necessary. Also the sleep on it is hardcore. 20 seconds. I recommend using llSetRemoteScriptAccessPin() to set the pin of the elevator to a known number. This number stays with the elevator for good so you only need to do this once. Then have the buttons use llRemoteLoadScriptPin() to load a simple script that linkmessages your main elevator script then removes itself from the inventory in their state entry. Not many people use llRemoteLoadScriptPin() but it is actually pretty darn simple to use. You don't have to (*snip*), use a timer, listener or anything. Sleep is also only 3 seconds. http://secondlife.com/badgeo/wakka.php?wakka=llRemoteLoadScriptPin
|
FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
|
08-15-2005 00:14
I've never thought of doing it like this...
However, you say you don't need to know the key of the elevator...
How does the call button know where to load the script then?
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-16-2005 23:10
Ignore that bit. hah. It was late as usual. You do need to know the key. Hopefully your elevator isn't often killing itself and respawning though. If this were a commercial product you may want to capture the elevator key on button rez by using a 1 time sensor that find the elevator object by name then stores the key and removes the sensor (along with instructions to be sure that when rezing buttons you are in or near the elevator). If it is just personal use you would just hardcode the key.
_____________________
DISCLAIMER: Blain Candour is a total and eternal n00b and everything he tells you should be taken with a huge pile of salt. Especially when he refers to himself in third person!
|
a lost user
Join date: ?
Posts: ?
|
08-17-2005 07:20
yes.. just chuck the llResetScript() function call into the on_rez(integer param) event of the elevator button, and a llSensor() call in the state_entry() event for the default state. Then the owner can always move it later. Not sure what you mean by remove the sensor, since llSensor() only calls once: // Global variable key Elevator_Key;
default { on_rez(integer p) { llResetScript(); }
state_entry() { llSensor("My Elevator Name", "", SCRIPTED,10.0, TWO_PI); // do other setup stuff, like getting the new position offsets, // may be reading a notecard with config and all that }
sensor(integer num) { // since we will only detect one object because of the criteria in the llSensor call // we can just get the key of whatever we found. Elevator_Key = llDetectedKey(0); } } Basically something along those lines.
|
Cazzj Brearly
Look! A UFO!
Join date: 21 Mar 2005
Posts: 113
|
08-17-2005 10:21
Wow! Thanks for the continued feedback and thoughts on how to make this better. The email code really wasnt that much at all...like one line in a touch_start to send the email, and the timer code and clipping bit to receive the email command. I'll try this new code soon. Right now my elevator is working beautifully.
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-17-2005 13:39
I meant using a repeating sensor that once it found it's target had a sensor remove call inside of it preferably with a timeout in case it never finds it.
_____________________
DISCLAIMER: Blain Candour is a total and eternal n00b and everything he tells you should be taken with a huge pile of salt. Especially when he refers to himself in third person!
|