Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

turn on and off a listen

Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
04-04-2007 15:55
Hello,
Had a friend as if it was possible to turn on and off a listen. I said no. but then he showed me:
ListenRemove: Removes listen event callback
ListenControl: Makes listen event callback active or inactive
i have never used these so i don't know anything about them.
is it possible to turn off listen?
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
04-04-2007 16:05
From: Robin Peel
Hello,
Had a friend as if it was possible to turn on and off a listen. I said no. but then he showed me:
ListenRemove: Removes listen event callback
ListenControl: Makes listen event callback active or inactive
i have never used these so i don't know anything about them.
is it possible to turn off listen?


Yes your friend told you correctly.
You can find more information at http://www.lslwiki.org/index.php/LlListen
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-04-2007 16:07
You set up a means of identifying the listener e.g. a global called handle:

integer handle;

Then, when calling your listen you assign it to the handler e.g.:

handle=llListen(1001, "", llGetOwner(), "";);

and when you want to turn it off you call its handle:

llListenRemove(handle);

I rarely use llListenControl, but it's the same sort of structure.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Sarah Showboat
Registered User
Join date: 3 Nov 2006
Posts: 13
Listen Remove
04-04-2007 16:13
I usually do a llSetTimerEvent before I set a listener. Then inside the timer() event I put in a ListenRemove, llSetTimerEvent(0), and llSay(0,"Response not recieved";). Your user now has a certain amount of time to say the command before the listen dies.

The downside is they must click on the object, or get a menu to invoke the listener. They can't just walk up to the object and give a command.
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
04-04-2007 16:14
I use lockable windows on my house (saves cutting out door shapes) with the option to switch listening on and off for when I want to add authorized users, selected from a dialog.

Using an integer for chandle and cchan, and m is the received message from the dialog:
CODE
if(m=="Listen on"){
chandle=llListen(cchan,"",llGetOwner(),"");
}else if(m=="Listen off"){
llListenRemove(chandle);
}


There's not much info available on llListenControl, so I don't know whether it removes the listen from the servers list of listeners, or simply stops the triggering of the event. With llListenRemove you know it's been removed from the list so should be easy on the server if you aren't switching it on and off too many times.
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
04-04-2007 16:24
thank you all very much for your replies. they were all helpful.