Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListen Best Practice

Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
01-29-2008 07:23
Hi guys,

I am working on a script that will be inside an attachment (a watch) that will listen for a command from the owner (/101Menu), and display a Menu.

I have never really got my head around the potential lag-inducing pitfalls of the llListen command, so I am hoping the forum can advise me of best practice. Is the following perfectly OK or not?

handle = llListen(101, "", llGetOwner(), "Menu";);

TIA

Rock
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
01-29-2008 07:58
From: Rock Ryder
Hi guys,

I am working on a script that will be inside an attachment (a watch) that will listen for a command from the owner (/101Menu), and display a Menu.

I have never really got my head around the potential lag-inducing pitfalls of the llListen command, so I am hoping the forum can advise me of best practice. Is the following perfectly OK or not?

handle = llListen(101, "", llGetOwner(), "Menu";);

TIA

Rock

This is pretty much as specific as you'll ever need to be. Keep in mind, though, that if you're using a llDialog call, that listen won't pick up any commands besides "Menu." Generally people just use a blank message filter with llGetOwner() as the key filter on a non-zero channel like you have, and use if statements or look up the command in a list to perform operations based on the message that comes in the listen event.
_____________________
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
01-29-2008 10:00
And remember to reset the script when it changes owner, so that the key in the listen filter will be updated.
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
01-29-2008 12:11
Thanks guys,

It is just that I was getting confused when I saw sample menu scripts that use llListenRemove, timers and menu timeouts.

Rock
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-30-2008 14:43
'Best' practice, is to make listens as filtered as possible, use low traffic channels if possible, and limit their amount of proccessing (by turning them off) if possible.

sometimes you have to leave them unfiltered (so anyone can use them)
sometimes you need to use crowded channels (like 0, so they can process general chat)
sometimes you need them to be always ready (so you can't close them)

worst case scenario is listening to general chat, all the time, and anyone that speaks

just out of curiousity, does you watch use the touch event? if not you could use that to start the dialog and listen, eliminating the need for an always open listen
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
01-30-2008 17:15
From: Void Singer
just out of curiousity, does you watch use the touch event? if not you could use that to start the dialog and listen, eliminating the need for an always open listen
Sometimes, it can be difficult to click a small attachment to start a dialog - especially while dancing.

As for your listen, Rock, the one downside to hard-coding the command ("Menu";), is that you can't check for the lowercase version ("menu";).
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-30-2008 18:01
I will note though that by worrying about the possible impact your scripts can have on the sim marks the transition from just being a script tinkerer to a full blown scripter.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum