Jump to content
Sign in to follow this  
CajunMaster

How to make doors auto open

Recommended Posts

It gets to be a pain, after a while, to have to stop and touch a door to walk through it.  So I was wondering if it would be possible to build something that would react to a collision and send a touch even to a nearby door.  That way the door would open as I approached.  Ideally it would work for any door that responded to a touch.

 

Am I out of my mind or is this possible?

Share this post


Link to post
Share on other sites

Sorry, this is not possible for an object to trigger a touch event on another object...

If the door can be modified, you will have to edit or replace the script and use a sensor event.

Share this post


Link to post
Share on other sites

Not only is it possible, it's trivial.

Look up the LSL command llVolumeDetect. http://wiki.secondlife.com/wiki/LlVolumeDetect

It allows you to set a property of a prim so it acts as if phantom, and reports a collision-start, collision and collision-end event as any avatar enters, remains within, and leaves the volume covered by the volume detect prim. Any script can act on these detections, either by llLinkMessage if part of the same linkset, or by a non-zero chat command to any script in the whole region, if not linked.

Share this post


Link to post
Share on other sites

Thank you but I don't see how this helps. 

 

Doors don't respond to messages they respond to touch.  And even if they did respond to messages how would I know what channel they listen on.

 

I am looking for a way to cause any door to open when an avi approaches.  Like an invisible prim that sites on the floor under the door.  When an avi approaches the invisible prim detectes the collision and sends the touch message to the door.

 

Apparently there is no way to do this.

Share this post


Link to post
Share on other sites

The only way i can think of helping you is that maybe by 1-2m away from the door which is sensored and when it's activated it could send a RegionSay to open another door ? o.O

Share this post


Link to post
Share on other sites

Again, doors wouldn't react to something said, they react to a touch.  And if they did react to something said what channel are they listening on?

 

Like I said, I doubt it is possible to do this for every door, but it would be cool

 

Share this post


Link to post
Share on other sites

touch events in LSL only occur due to someone clicking on a prim in an object.  There is no way to 'simulate' this via another script.

 

If the script is mod, then it can be re-written to utilize the techniques above (such as the collision volume detect and such) to avoid having to 'click' on the door.  Otherwise, it would have to be completely re-scripted, or if the whole object is no-mod, replaced with a door that utilizes these other techniques.

 

Share this post


Link to post
Share on other sites

If you wantto rescript everything, this is my example:

Door:

 

open_door()
{
//open the door sequence
 
}

close_door()
{
    //close the door sequence , since I dunno what kind of door you want
}

default
{
    state_entry()
    {
       llListen(-666,"detecter","","open");
    }

    touch_start(integer total_number)
    {
      
    }
   
    listen(integer channel,string name,key id,string message)
    {
        open_door();
        llSetTimerEvent(5);
    }
   
    timer()
    {
     close_door();  
    }
}

 

detecter:

 

 

default
{
    state_entry()
    {
        llVolumeDetect(TRUE);
    }

    touch_start(integer total_number)
    {
       
    }
    
    collision_start( integer num_detected )
    {
        llSay(-666,"open");
       
    }
}

 

 

 

 

Share this post


Link to post
Share on other sites

****

Again, doors wouldn't react to something said, they react to a touch.  And if they did react to something said what channel are they listening on?

*****

 

the channel is set in the script you put in the door., and in the sensor,

you can use volume detect, or a sensor to do this, there are many free ones on MarketPlace

Share this post


Link to post
Share on other sites

It's quite simple, really.

The prim that you put the llVolumeDetect script into is an invisible prim that is in the area in front of the door. For example, a 3M x 3M x 3M cube placed right in front of the door, textured with a 100% alpha texture. When any avatar steps into the space in front of the door covered by that prim, the llVolumeDetect script senses them and can trigger any event you like, such as opening the door.

Making a door respond to a message works the same as making it respond to a touch. You just change the script event in the door script from being a touch event to being something triggered by a message. If your door script is no-mod, replace it with one you can modify.

I just sent you a freebie example from way back in 2004 called "January 2004 Volumedetect door inna box", that has a fully working example in it, with all the scripts and the 100% alpha texture for it.

I played with that example a bit in world, and it still works, the one caveat is that after you position the door parts, you need to reset the scripts to lock in their base positions. It's a pretty crude example.

In short, what it does is use the volume detect to issue a non-zero chat of "open" or "close". The door is set to listen for that same non-zero channel, and to act when it gets an 'open' or 'close' message.

A more advanced script could be a linkable door, and could use ''llRegionSay" instead of "llSay" to eliminate any distance limits.

Share this post


Link to post
Share on other sites


CajunMaster wrote:

Doors don't respond to messages they respond to touch.  And even if they did respond to messages how would I know what channel they listen on.

Apparently there is no way to do this.

Scripts respond to events.    Events include being touched, but they also include being collided with.

In this particular context, the collision_start  event, which would be fired by someone walking across an invisible prim,  works pretty much like the touch_start event does.  

As to how do you know what channel something is listening on, you know because you[ve told it which channel that is, using llListen.    So if your door contains a script saying, in state_entry(), llListen(99,"","",""), then you know it's listening for messages on channel 99 (provided, that is, you've included a listen event).

 

Share this post


Link to post
Share on other sites

Non-scripting partial workaround:

Use the WASD kets with your lef hand and move your mouse with the right. With some practice, you can navigate your avi with one hand and click with the other in one fluid movement.

Or you would enter mouselook as you approach the doors.

Share this post


Link to post
Share on other sites

All true, yes.  But it won't work for me.

 

Looking back I see I neglected to mention this, I don't own the house or the doors and I can modify the scripts that open the doors.  So I can tell it what channel to listen on.  I can't even see the code to find out if it is listening on any channel.  That's why I have said that listening will not help me do this.  I have to be able to send a touch to the doors to get them to open.  Since I can't do that it looks like this will not work.

 

Thanks

Share this post


Link to post
Share on other sites

Yes, all good advice and I thank everyone for their suggestions.  Unfortunately I can't do any of the things suggested, because I can't modify the scripts in the doors and I can modify the doors.  Like I said, no my house.

 

My original concept was to have an invisible prim detect a collision (an avi stepping on it) and sending a touch event to the door, but since events can't be sent from on prim to another it's all a theoretical exercise.

 

Thanks.

Share this post


Link to post
Share on other sites

Yes, unfortunately to change how a door operates, you need to actually own the door and have mod rights on the door and its scripts.

Next time you move, you might want to try these ideas, with a modifiable house that you purchase and own, or that you build yourself. It can actually be quite fun to build your own home, and there are tons of free scrpits and examples out there that you can use to guide your efforts - not to mention the helpful advice of the people in these forums.

Share this post


Link to post
Share on other sites

I second Ceera's suggestion.   That's exactly how I started learning to script -- I wanted to make something and couldn't find a script (or at least not one at a reasonable price) that did what I wanted, and I thought what I wanted it to do wasn't particularly complicated, so I thought I'd try to learn how to do it myself.    I got lots of help here, or in this forum's precedessor, rather, and found I really enjoyed scripting.

Why not give it a shot?

Share this post


Link to post
Share on other sites

I am indeed giving it a shot.  I enjoy scripting but not building so much.  I've done some pretty cool things so far that I'm particularly proud of.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...