Jump to content
Sign in to follow this  
ChaosRaine

llListen and Getowner question

Recommended Posts

I was just looking through the forums and came upon this one http://community.secondlife.com/t5/LSL-Scripting/llGetOwner-breaks-my-tiny-script/td-p/2720976 (I've never posted a link in here sorry if it doesn't work) it was titled "llGetOwner breaks my tiny script". It made me start thinking about a possible revision to an older script I did.

If I use a script like theirs

key owner;//placeholder for the owner's uuid
default
{
	state_entry()
	{
		owner = llGetOwner();//get the owner's uuid
		llListen(1234, "", NULL_KEY, ""); //listen to messages from anyone on 1234
	}

	changed(integer change)
	{
		if (change & CHANGED_OWNER){//if the owner changes
			owner = llGetOwner();//get the new owner's uuid
		}
	}
	listen(integer channel, string name, key id, string message)
	{
		if (llGetOwnerKey(id) == owner){ // if the message is from an object belonging to my owner, or from my owner,
			if (message == "tex3") llSetTexture("xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", ALL_SIDES);
		}
	}
}

 only instead of the owner talking I want it to listen for a message from another object can I replace the llGetOwner with the an object's or script's uuid or someway to get it to identify a spacific object giving the command rather then just the owner?

Kinda like having a remote control nearby that is not attached to the prim that is changing textures.

 

Share this post


Link to post
Share on other sites

Hi Chaos,

 

Not quite sure what your question exaclt is. Theid paramete in the listen gives you the key from which the message is initiating, and could be a prim or Avatar. The way the code you have provided is written, it will only respond to messages that come from objects (prims) that are owned by the owner of the script .

What is the specific conditionyou are trying to test for?

 

Wanda

Share this post


Link to post
Share on other sites

Sorry the question was poorly written. I selling an object that rezzes other objects. When it rezzes on I use llSay to send a message on a predettermend channel and when the rezzed object hears the message it deletes. This works great the only problem would be if a customer has two of the same item next to each other. Rezzing an object from one would cause both rezzed objects to delete sence they would both be listening to the same channel. I'm trying to figure out a way around this so they can work independantly.

Share this post


Link to post
Share on other sites

When a rezzed object is made an event will happen in the rezzing object
When that happens the event handler: object_rez will give you the UUID of the rezzed object
Use that UUID with llRegionSayTo() to target the specific object

:smileysurprised::):smileyvery-happy:

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...