Jump to content
  • 0

How to stop script executing if object is being sat on?


Aerikah Xeltentat
 Share

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

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

Question

I've made an object that rezzes an item when clicked & when clicked again deletes that rezzed item to rez a new one. So only one object can be rezzed at a time. I'd like to change it so that when the rezzed item is currently being sat on then the delete script will not execute. If the object is not currently being sat on then I want it to delete when the rezzer is clicked as normal.

How would I go about doing this?

 

Scripts I'm using:

 

In rezzer:

default
{
     touch_start(integer num)  //  If someone touches me ...
     {
          llRegionSay(-59,"die!");  // ... send the message "die!"
     }
}

 

In rezzed objects:

default
{
     state_entry()
     {
          llListen(-59,"","",""); // Listen for a message ...
     }
     listen(integer channel, string name, key id, string msg)
     {
          if (llToLower(msg) == "die!") // ... If the message is "die!" ...
          {
               llDie(); // .... then delete.
          }
     }
}
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi again, Aerikah,

Though there are a few here in Answers that have some scripting knowledge, that's not really what this area is about. We usually handle questions about how SL does or doesn't work.

You'll have better luck (and perhaps better answers) over in the LSL Scripting forum...

https://community.secondlife.com/t5/LSL-Scripting/bd-p/LSLScripting

And don't be surprised if most of us make you work a little to get your answers. We want you to learn LSL the hard way, which is the only way!

That said, read these...

;-).

Link to comment
Share on other sites

  • 0

When you sit on an object, you become a link in the object's linkset.  Specifically, you become the last link. So, look at the last link to see if it is an avatar.  There are several ways to do that.  Perhaps the easiest is to use the old trick:

key UUID_of_suspected_agent = llGetLinkKey(llGetNumberOfPrims());if (llGetAgentSize(UUID_of_suspected_agent) != ZERO_VECTOR){    llSay(0,"Someone named " + llKey2Name(UUID_of_suspected_agent) + " is sitting on me.");}

l

  • Like 2
Link to comment
Share on other sites

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