Don't click here unless you want to be banned.

LSL Wiki : llListenRemove

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llListenRemove(integer number)

Removes the listen event callback with the handle number. The handle is the value returned when calling llListen.

Invalid handles are ignored, which means the following example works fine:
integer Channel;
integer Handle;

Init() {
    llListenRemove(Handle);
    Handle = llListen(Channel, "", NULL_KEY, "");
}

default {
    state_entry() {
        Channel = 2; // first we listen on channel 2
        Init();
    }

    touch_start(integer total_number) {
        Channel = 4; // after a touch we listen on channel 4 instead
        Init();
    }
    
    listen(integer channel, string name, key id, string message) {
        llSay(0, llList2CSV([channel, name, message]));
    }
}

Remember, listeners are automatically removed when exiting a state. This means that llListenRemove is only necessary when removing a listen inside a state. If your script design permits it, using multiple states instead of a llListenRemove may be more convenient.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Chat | Communication | llListen | listen
Comments [Hide comments/form]
llListenRemove() appears to have a delay. If you're doing a lot of removes at one time, add in a 0.3 sleep, which from my own use seems to work out fine (else with no sleep not all my listens, apparently, get removed).
-- BosozokuKato (2004-08-01 01:33:18)
Ignore my comment, I'm an idiot. I forgot to assign my listens to an int, in 1/2 the calls anyway, so I had 6 listens but 3 never got removed when I thought they had, haha -- it's not easy being stoopid.
-- BosozokuKato (2004-08-01 02:08:42)
I use this command to put an llDialog listen script to sleep that then wakes up when I touch it.
-- LasivianLeandros (2005-12-17 17:34:28)
Does first removing the listen then attaching it prevent another object listening to the same channel?
-- cust251-dsl56.idnet.net (2007-05-29 14:33:37)
How many objets can listen and speak on the same channel at the same time? I am building a machine with 20 prims, and these prims should communicate with each other through 1 channel. I think not all chatted messages are recorded in time by the listen event if too many llListens and listen() events are evoked on the same channel by different prims ....
-- rt9bb146-89-130.sollie-dsl.nl (2007-09-23 18:56:06)
Don't do that, the person who commented above me.. That'll create lots of lag. Use linked_message. Much faster.
-- AniamIngmann (2007-09-27 03:04:06)
I've seen llListenRemove used this way (without a handle):
llListen(3, , llGetOwner(), );
llListenRemove(llListen(3, , llGetOwner(), ));
It seems to work - does anyone know if there is any disadvantage to doing it this way?
-- BopeteYossarian (2007-12-22 14:31:16)
Attach a comment to this page: