Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Proper Multi message listener format

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
04-01-2007 09:35
Hi all,

I want to write my talker/listeners in a way that is as sim friendly as I can. Might someone please comment on the following structure, and let me know if I am being evil to sims with these methods?

Thanks so much!
(just want do do the right thing for everyone)

The Talker:

touch_start(integer total_number)
{
if (condition == TRUE)
{
llSay(123, "Msg1" );
}
else
{
llSay(123, "Msg2" );
}
}


The Listener:

state_entry()
{
llListen(123,"",NULL_KEY,"Msg1";);
llListen(123,"",NULL_KEY,"Msg2";);
}

listen(integer channel, string name, key id, string message)
{
if (message == "Msg1";)
{
llSay(0, "Msg 1 received.";);
}
else
{
llSay(0, "Msg 2 received.";);
}
}
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
04-01-2007 09:45
From: Ryder Spearmann


The Talker:

touch_start(integer total_number)
{
if (condition == TRUE)
{
llSay(123, "Msg1" );

Depends of the distance - llWhisper is better if distance between talker and listener is 10m or less'
Channel in negative numbers and really big works better because of less chance of chatter from other objects on same channel.

From: someone

The Listener:

llListen(123,"",NULL_KEY,"Msg2";);

In your example this is not needed since you only compare for Msg1

also if you know the object key of the talker object you can use that key instead of NULL_KEY

Someone wrote a tip sheet about listens, I can't seem to find it right now, but maybe someone else have it. But the general ideal is that listens can be very laggy since they have to process all chat within range. It outlined the steps that have to be processed for listens, example: 1) in range 2) on channel etc.

The wiki has some tips:
http://lslwiki.net/lslwiki/wakka.php?wakka=llListen
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
04-01-2007 11:33
Hi Destiny, thanks for the comments!

You say that the second listen is not needed... but I find that it is... if it is not there, for Msg2, then the listen event is not triggered at all... unless I am missing something.

Thanks for the whisper tip... that works fine!

From: Destiny Niles


In your example this is not needed since you only compare for Msg1

also if you know the object key of the talker object you can use that key instead of NULL_KEY

Someone wrote a tip sheet about listens, I can't seem to find it right now, but maybe someone else have it. But the general ideal is that listens can be very laggy since they have to process all chat within range. It outlined the steps that have to be processed for listens, example: 1) in range 2) on channel etc.

The wiki has some tips:
http://lslwiki.net/lslwiki/wakka.php?wakka=llListen
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-01-2007 12:52
If you want to receive more text pattern then just set up an open listen on that channel and filter locally. This is, somewhat paradoxically, more sim friendly than setting up specific Listens. The reason I have heard quoted is that the server is doing less work by routing everything to you than by having to check for just one or two specific strings.
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
04-01-2007 14:02
Keep in mind, that if these are for prims that are linked together, it may be better to use llMessageLinked and link_message() {} instead. :)
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
04-01-2007 16:11
Thx Jopsy...

I wish this was the case... This is for a HUD that talks to a vehicle. Wouldn't it be cool if linked messages could be sent to the things you are sitting on?!!!!

-Ryder-

From: Jopsy Pendragon
Keep in mind, that if these are for prims that are linked together, it may be better to use llMessageLinked and link_message() {} instead. :)
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
04-01-2007 16:11
From: Newgate Ludd
If you want to receive more text pattern then just set up an open listen on that channel and filter locally. This is, somewhat paradoxically, more sim friendly than setting up specific Listens. The reason I have heard quoted is that the server is doing less work by routing everything to you than by having to check for just one or two specific strings.


Oh... super! That is exactly the kind of tip I was looking for :)

-Ryder-