Jump to content

Any Ideas on two prim sensor.


natet2012
 Share

You are about to reply to a thread that has been inactive for 3350 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have two prims, a top and a bottom, i wanna attacht the bottom prim to a openable door, or etc, and when it moves away from the top prim, send a message, i can put it together, and the ideas around the Getpos, etc. just not sure how to compile it all, any help is appreciated. :)  Nathan 

Link to comment
Share on other sites

Well, one reason is, what i am making, is for RP community, and it would require at least two prims, basically the top prim does not move, and does not report anything, the bottom prim is the one that reports when it is moved.  It is basically the same concept as a RL door sensor, two objects, a top then bottom, when the bottom moves away, it triggers the system, etc. :D 

Link to comment
Share on other sites

Yes, but the question is why you need the two extra prims to do that.  After all, you already have a script to make the door move.  Why not just add a line to it that says

llSay(0,"The door moved.");

whenever the door opens?  It doesn't need to sense anything extra to know that it's moved.

Link to comment
Share on other sites

Biggest reason is, because it is a RP community, based on RL, What i got, is an "Alarm Company" and so people in the are will request a system, its not like the Orbs. It is just like a RL one, with sensors etc. People  are gonna wanna use the doors they already have, assuming  they are mod rights, and just attatch the sensor to it. That way if the door itself opens, say the front door, It will send a message on a private channel to the Control panel and let the system know, Door  is open, not ready, when the door is closed, the system would reflect, Ready.. etc. that is the reason why it does have to be a prim, not just a script to drop in the door. It does not feel the same, as actually adding a sensor to it, and lots of people have requested me to make one with door/window sensors. It might sound lame, but it is still cool i think. Security, at a different type of level. 

Link to comment
Share on other sites

OK, then, if people want to see an extra prim that looks like it's doing something the easiest thing to do is to add only one prim and make it a long, skinny "hinge" that you link to the edge of the door where you would normally expect to find a hinge.  The reason for doing that is that you will otherwise have a bear of a time getting the door and its extra prim to rotate together gracefully. (This is one of the reasons why you find very few SL doors with prim doorknobs.)  And you add a script that says

rotation gClosed;integer gSecretChannel = -123456;default{    state_entry()    {        gClosed = llGetRot();//Be sure the door is closed if you reset the script    }    touch_start (integer num)    {        if (llAngleBetween(llGetRot(),gClosed) > 0.1)        {            llSay(gSecretChannel,"Ready");        }        else        {            llSay(gSecretChannel,"Not Ready");        }    }}

 When someone touches the door's root prim, this script should be triggered.  If the door is open at that point, its main script should close it and this script should say "Ready". If it's closed, touching the door should open it and this script should say "Not Ready." Again, the system doesn't need a special sensor to tell it whether the door is opened or closed.

 If you want to waste another prim that you put over the door, put a dummy script in it that does nothing at all.  Then be sure that both scripts are no mod so that people can't peek and see that they are laughably simple.

 

 

Link to comment
Share on other sites

It doesn't report?  That's odd.  It ought to.

And no, it's not stupid.  Any scripting challenge is fun as a puzzle, whether it's truly practical or not.

EDIT:  Ah..  turn the touch_start event into a moving_start event instead ...

rotation gClosed;integer gSecretChannel = -123456;default{    state_entry()    {        gClosed = llGetRot();//Be sure the door is closed if you reset the script    }    moving_start()    {        if (llAngleBetween(llGetRot(),gClosed) > 0.1)        {            llSay(gSecretChannel,"Ready");        }        else        {            llSay(gSecretChannel,"Not Ready");        }    }}

 THAT works.

Link to comment
Share on other sites

I sent you a copy of the DEMO test object that I put together last night.  Check it out in world.  It's not a pretty door (or a pretty door script -- just a quick and dirty keyframed motion rotator), but it works for a demo. The script I posted above is in the yellow child prim.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3350 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...