Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help - Remote elevator call

Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
07-11-2006 15:05
I just built my first nice 'physics elevator' for a client, using the freebie 'Elevator in a box' script as a starting point for scripting it. Now, of course, what I built for the elevator car and the shaft is much more elaborate than the simple flat platform and 3-sided shaft that came in the kit. But the script that makes the elevator go up and down is still the default freebie, altered only to set up the floor heights. My client loves it. Multiple people can walk into it, no one has to 'sit', and any one person can command it to change floors. So far, so good.

The problem I have is this. The elevator shaft is about 35 meters from top to bottom. It has two floors near the top of the shaft, for the house atop a steep sloping hill, and one stop much farther below, that leads to a boat dock. The script accepts open chat commands, like "goto floor 2" to go to the top floor, and "goto floor 0" to go to the lowest floor. But if you're at the top, and the elevator car is at the bottom... well, you have to 'shout' the command for the elevator to hear you. :( Not very elegant, and it might annoy the neighbors.

What I would like to do is to eliminate the open channel 0 listen, and replace that open chat command with a 'call elevator' button at each floor, and a 3-button control panel that is linked to the elevator car, for selecting which floor to go to.

Obviously, the three call buttons at each floor can't be linked to the moving elevator car, so I can't use a linked message handler and listener. So how do I get them to communicate with the elevator, to send it a message calling it to that floor? Do I have to set the call buttons to send an e-mail to the UUID key of the elevator's root prim? Or if I set a touch event on the top floor button to 'say' the 'goto floor 2' command on some channel other than 0, will that overcome the 20 M distance limit that chat on channel 0 imposes, if you don't shout? What is the range limit of listening on a non-zero channel?

I have a pretty good idea how to script the in-car control panel. I can see the subroutines in the script for handling the three verbal commands, and I have done scripts before that pass touch events to a listener in another linked prim. So setting up a touch event that uses llLinkMessage to pass which button was clicked on to the elevator scripts should be fairly simple. Likewise, once I get the root script to realize it's been sent a message, somehow, from call button 2, I know what to do from there to send it to 2. It's the communication step between the call button and the elevator car that I am unsure of.

Thanks in advance for any help or advice!

PS - An unrelated issue. When the elevator moves, everyone does a strange 'run in place' animation. I have Seagel's 'sit elevator' script, that uses the 'Impatient' animation for the person standing in his sit elevator. That looks so much better! Is there a way to define the animation that someone in a physics elevator will perform when it moves, if they are not sitting on something?
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
07-11-2006 15:45
You could have the call button shout on a non-zero channel. Wouldn't that take care of that issue? AFAIK the ranges are the same regardless of the channel number, but there is an llShout call that you can use.

Be careful about handling multiple requests. Or maybe that's already handled in your script. But think about what happens if you get a new request to move to a certain floor while you're already in the process of moving to a different floor. Also, if you want to implement 'real' elevator functionality (elevator is moving from floor 0 to floor 2, someone on floor 1 presses the 'up' button, elevator stops and picks him up), that can get a little more complicated :)
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
07-12-2006 05:51
Thanks, Ziggy! That did the trick just fine. I picked an odd channel to listen on, then used llShout for the call buttons, and llWhisper for the buttons attached to the elevator car itself. Works smoothly as one could hope, and no more chatter on channel 0!

Since it's a residential elevator with just 3 floors, I'm not worried about adding more complex behavior. Odds are that we'll virtually never have two people trying to call the elevator at the same moment. And if there is a conflict, it's easy enough for one person to see the other, as it's an 'open air' system with a glass-sided car and an exposed shaft and platforms. You can see who is in or near it at all times, because it's designed to have minimal impact on the view.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
07-12-2006 13:42
For those who are interested, the 'call button' is just a colored prim with a 'new script' in it, and the default touch event handler's llSay command is altered to use either llWhisper or llShout on a specific channel, and to 'speak' the command to send the elevator to that floor. I commented out the llSay line for the other default event handler, for when the prim is rezzed.

The elevator script was then altered to listen on the new channel, and the llWhisper buttons were linked to the wall of the elevator car, while the llShout buttons were placed at the floor they call it to.

The elevator is in the Desire sim, in the SW corner of the sim.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.