Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Monitoring on Listen

Denrael Leandros
90 Degrees From Everythin
Join date: 21 May 2005
Posts: 103
10-12-2008 21:51
I need to monitor on a listen script for things said by me, or potentially by a HUD I am wearing. I can monitor myself fine. How do I monitor commands issued by the HUD, to insure they come from my hud and not another one nearby?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-12-2008 23:04
You can check llGetOwnerKey() on the speaking object, if you can trust your own objects not to send incorrect messages. Otherwise, you'll have to come up with some more interesting way of deciding which of your objects is the one to listen to. (BTW, llGetOwnerKey(), when passed your key, will also return your key, so it should work for the "me or my objects" criterion.)

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetOwnerKey
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
10-13-2008 07:00
Generally when I do this, I listen for all UUID's. In the listen event I trap something like
if (id == llGetOwner() || llGetOwnerKey(id) == llGetOwner()) ...

But, I've wondered about this, since the listen event would respond intially to all UUID's and rely on the if statement to filter it out. In many cases there is no other way to do this since you don't know the UUID of the object. But suppose we know the UUID of the object. Would it use less resources to set up 2 listen events, one for the owner and one for the object, or is it better to filter them out as above?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-13-2008 09:07
From: Monica Balut
Generally when I do this, I listen for all UUID's. In the listen event I trap something like
if (id == llGetOwner() || llGetOwnerKey(id) == llGetOwner()) ...

But, I've wondered about this, since the listen event would respond intially to all UUID's and rely on the if statement to filter it out. In many cases there is no other way to do this since you don't know the UUID of the object. But suppose we know the UUID of the object. Would it use less resources to set up 2 listen events, one for the owner and one for the object, or is it better to filter them out as above?


Unless you know something specific about the object(s) you will be listening for (key, name, a specific channel different from the one the owner will be using) you will have to use an unfiltered listen anyway, which means the one listen and the logic you quote are better than two listens.

Note that 'id == llGetOwner() || llGetOwnerKey(id) == llGetOwner()' is slightly redundant though, because a resident effectively owns him/her-self. So if 'id == llGetOwner()' then it will always be true that 'llGetOwnerKey(id) == llGetOwner()' (it will even work if the speaker is in a different sim, since then llGetOwnerKey() will always return its argument). Of course, you might feel that including both expressions is more clear to the reader, in which case all power to you. :)