Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListenOnce please?

Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
07-29-2004 05:32
I find that more often than not I use llListen to get a single command from the user, and then immediately remove it to avoid adding to the lag.
Thing is, what with Cory's love of verbosity, and having to type llListenRemove 1000 times too many, on top of all the variables needed to store the listener IDs, I'm on the verge of getting RSI :D
Plus I'm just lazy. Can't I just get an llListenOnce command that acts like llListen but automatically removes itself when the listen event handler is fired?
It would be a lot more useful.
I mean, you have both llSensor and llSensorRepeat. It seems only logical.
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
07-29-2004 05:39
When I started reading that I thought 'why?. But the more I think about it, the more useful it sounds.

So I'm with ya on that one. Being lazy, I mean.

Oh. And the listener thingy whatsit idea. Thats good too. We should have those.
_____________________
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
07-29-2004 08:32
Try using states...

CODE

default
{
state_entry()
{
state running;
}

}

state running
{
touch_start(integer total_number)
{
state listening;
}
}

state listening
{
state_entry()
{
llListen(0, "", NULL_KEY, "");
}

listen(integer channel, string name, key id, string message)
{
llSay(0, "You said: " + message);
state running;
}
}
_____________________
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
07-29-2004 09:04
From: someone
Originally posted by Hank Ramos
Try using states...


We do, Hank.

Thats why I was originally hesitating and wondering why it was necessary. Now take a script that is 10 to 20 times more complex than yours below with multiple listeners, and I'm sure you'll see that it'd still be useful. So no harm in it, eh?
_____________________
Ryen Jade
This is a takeover!
Join date: 21 Jun 2003
Posts: 1,329
07-29-2004 09:17
errr....
state_entry()
{
llListen(0,"","","";);
}
listen(integer c, string n, key id, string m)
{
if(m)
{
llListenRemove();
}
}
}
_____________________
From: Korg Stygian
Between you, Ryen the twerp and Ardith, there's little to change my opinion here.. rather you have reinforced it each in your own ways


IM A TWERP, IM A TWERP! :D

Whats a twerp? :confused:
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
07-29-2004 09:23
From: someone
Originally posted by Kris Ritter
We do, Hank.

Thats why I was originally hesitating and wondering why it was necessary. Now take a script that is 10 to 20 times more complex than yours below with multiple listeners, and I'm sure you'll see that it'd still be useful. So no harm in it, eh?


No, no harm at all. I think it would be a nice addition to LSL. :D

Just pointing out another way if people didn't know about states, and how they *can* help in this situation.
_____________________
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
07-29-2004 09:24
From: someone
Originally posted by Ryen Jade
CODE
errr....
state_entry()
{
llListen(0,"","","");
}
listen(integer c, string n, key id, string m)
{
if(m)
{
llListenRemove();
}
}


That definately won't compile. :D
_____________________
Ryen Jade
This is a takeover!
Join date: 21 Jun 2003
Posts: 1,329
07-29-2004 11:22
I know, I put it together in about 2 seconds :P
_____________________
From: Korg Stygian
Between you, Ryen the twerp and Ardith, there's little to change my opinion here.. rather you have reinforced it each in your own ways


IM A TWERP, IM A TWERP! :D

Whats a twerp? :confused:
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
07-30-2004 03:19
Lol. I guess I miss the old fgets and stuff. It's amazing how much we manage to ignore the sheer wackiness of LSL when compared with real programming languages.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
08-01-2004 23:17
I support this in full.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
08-02-2004 02:39
This would be useful, if only for the sake of completeness. For most tasks, I would still want to use llListen/conditional llListenRemove, though. That's not to say that llListenOnce wouldn't have its place though.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog