Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Listen to owner or owner's objects only

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
02-18-2006 02:25
Would someone help me to figure out a script filter to accept chat commands from an script within object of the owner as well as directly from the owner?

Thanks, Mod
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-18-2006 03:27
You can't do it 100% really.

One filter would be llListen(0, "Eloise Pasteur", "", "";); or a suitable other channel of course.

And then in the objects that are going to speak have llSetObjectName("Eloise Pasteur";); before they speak and a reset of the name afterwards.

You might also want to check in the listen event if either the key of the speaker is the key of the owner, or if not if GetOwnerKey is my key.

Something like:

CODE
listen(integer chan, string name, key id, string msg)
{
if(id==llGetOwner() || llGetOwnerKey(id)==llGetOwner)
{
//Do your stuff
}
}


NB: There are obviously much, much neater ways to do that with a constant for llGetOwner() etc. but you should get the idea I hope.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Thanks
02-18-2006 03:59
I appreciate the help, will try your suggestions out.

Mod
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-18-2006 13:26
Hope it works - let us know please?
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
It work perfectly
02-19-2006 04:43
Eloise,
the " if(id==llGetOwner() || llGetOwnerKey(id)==llGetOwner)" did the job and cleaned up my script considerably. Thank you so much, Mod
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-19-2006 05:27
change to
CODE

listen(integer chan, string name, key id, string msg)
{
if(llGetOwner()==llGetOwnerKey(id))
{
//Do your stuff
}
}

As the result of llGetOwnerKey of an avatar key is the avatar key. This will be faster.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-19-2006 07:44
Ah, thanks for the positive feedback Mod, and thanks for that Strife - the wiki doesn't suggest it works for avies, but it does make things faster.