Jump to content

Scripting Door to open when another prim is clicked


blippy Dash
 Share

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

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

Recommended Posts

Hi fellow second life residents,

 

I have made and scripted a door that opens and closes when clicked.  Does anyone know how i could script it so the door opens when another prim is clicked???

 

ps. I am new to linden script so go easy on me :)

Thanks

 

Link to comment
Share on other sites

If the door is a child prim in the link set, then clicking on the root prim or any other child prim should activate the door. It may depend on how your script is written, however.  If your door is not linked to the prim that you want to act as a switch, then the easiest thing to do is have the switch send a message to the door on a private channel by llSay or llRegionSayTo.

Link to comment
Share on other sites

three ways,(some already mentioned

  1. send a message from the clicked prim script to the door prim script... the door triggers from that instead of a touch as already mentioned
    • link messages (must be linked), chat (must be in range), even http(rather complicated) and other formats will work
  2. put the whole script in the button, and target the door with llSetLink* type commands (assumes it is linked)
  3. put the whole script in the root, detect which prim is clicked, and target the door as above (assumes it is linked
    • draw back: the entire link set will have a touch icon when hovered over
Link to comment
Share on other sites

Have used somt of the ideas suggested but am having trouble getting the scripts to work.  If anyone could let me know what i am doing wrong that would be great.

Script on switch:

default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        llRegionSayTo("10e457cf-c631-cc69-2cb8-cd384541aca4",-524,"Rotate");
    }
}


Script on door:

float rotateBy = 0.8;

default
{
    state_entry()
    {
      
        llListen(-524,"Switch","fac317ac-dc0f-c394-ad48-1b9a0644e9c4","rotate");
    }
   
    listen(integer channel, string name, key id, string message)
    {
        if (llToLower(message) == "rotate")
        {
           llSay(0, "Door opened");
             llSetLocalRot(llEuler2Rot(<0,0,rotateBy*PI_BY_TWO>)*llGetLocalRot());
         
        }
    }
}

Link to comment
Share on other sites

llRegionSayTo("10e457cf-c631-cc69-2cb8-cd384541aca4",-524,"Rotate");
llListen(-524,"Switch","fac317ac-dc0f-c394-ad48-1b9a0644e9c4","rotate");

new game... spot the bug.... if you specify text in the listen, it has to match EXACTLY =)

ps
you don't need to lowercase or check it if you do specify the text though, because it will only fire for an exact match

pps
you may not want to use exact keys unless you have a way to discover them, because they change each time the object is rezzed (but just for rezzes, not for things like region restarts)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4721 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...