|
Tarquin Quasimodo
Registered User
Join date: 8 Nov 2005
Posts: 38
|
07-08-2006 03:30
I am listening for avatars to say commands on channel 1.
Unfortunately I am getting a lot of background noise from other nearby objects also transmitting on this channel.
Is there a way to tell llListen to only listen to avatars, ignoring any objects that may be transmitting?
|
|
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
|
07-08-2006 05:42
listen( integer ch, string nm, key id, string mess ) { if ( llGetOwnerKey( id ) != id ) { // its an object } else { // its an avatar } }
That should work An object has an owner - An avatar owns itself
|
|
Jesse Malthus
OMG HAX!
Join date: 21 Apr 2006
Posts: 649
|
07-08-2006 10:55
That is spiffy-cool. Props to you.
|
|
Tarquin Quasimodo
Registered User
Join date: 8 Nov 2005
Posts: 38
|
07-08-2006 13:21
Sneaky but brilliant. Thank you.
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
07-08-2006 14:12
llGetOwnerKey(id) returns id if the key is to an agent or if the key is to an object in a different sim. llGetAgentSize() has a similar restriction. I don't think there is any zero-time way to know if a key belongs to an agent unless you restrict yourself to agents in the same sim.
You could use llRequestAgentData() and process the command in the dataserver() event handler. You would need to store the keys (the agent key and the query key) and the command in a list so that the dataserver event handler knows what to do.
|