Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

multiple listen help

Codswallop Cassidy
Registered User
Join date: 30 Dec 2003
Posts: 53
07-08-2004 23:37
Hi everyone.

I'm having issues with a script that needs to process listen from a listener that listens from two different sources, the 0 (public) chan and it listens on a specific channel for llDialog, my problem is that the llDialog input works but I cant catch anytihng from the public channel. I know that havign multiple llListen()'s dont work since they will get passed to the same listen() event so I just call llListen() at different states to change what channel listener is picking up from.

it should be listening on channel 0 all the time, and then only change to listenning on CHANNEL only when the object is touched and a dialog pops up. That part works far enough, its channel 0 that is the problem. Here is the code, any ideas?

I have also tried listening to (0, "", NULL_KEY, "";), same issue

integer CHANNEL = 65535;
integer TIMEOUT = 10;
integer listenhandle; // comm channel
default
{
state_entry()
{
.....
listenhandle = llListen(0, llKey2Name(llGetOwner()), llGetOwner(), "bla" );
}

touch_start(integer total_number) {

.....
if(llGetOwner() == llDetectedKey(0))
{ //gUser = llDetectedKey(0);
llDialog( // etc etc); // ask a question
state input;
}
.....

}
}

state input {
state_entry() {
listenhandle = llListen(CHANNEL, "", llGetOwner(), "";); // listen for the dialog answer

llSetTimerEvent(TIMEOUT); // set a timeout
}


timer() {
llSay(0, "User didn't answer within 10 seconds.";);
state default;
}

state_exit() {
llSetTimerEvent(0.0); // remove timeout
}

listen(integer channel, string name, key id, string message)
{
if (channel == 0 && message == "'bla";)
{
// this is what's not happening, even if I remove the check on channel, the script never hits this point
}

if ((channel == CHANNEL) && (message == "'whoopdeedoo";))
{
// this is from the dialog channel, this works perfectly
}
....
.....
// the rest works

}

}
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
07-08-2004 23:42
1) Listens get reset whenever the script changes state.
2) Multiple listens on different channels works just fine.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
Codswallop Cassidy
Registered User
Join date: 30 Dec 2003
Posts: 53
07-08-2004 23:45
yup I do that, note I switch back to the default state which will set the listener back to channel 0, even before I touch the object, the listener on channel 0 doesnt seem to be picking up anything.
Codswallop Cassidy
Registered User
Join date: 30 Dec 2003
Posts: 53
07-08-2004 23:57
problem solved!

I only had a listen event in the input state, not my default state so there really was no input handler while I was in the default state.

was thinkign of the listen event as a global one, DOH! (my listen just happened to be palced inside my input state)