Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problems with event listen

Gusths Willis
Registered User
Join date: 13 Aug 2008
Posts: 2
09-04-2008 06:56
I made a script that was running normally, ah I entered the second life today and he is no longer running, the script is great then I will play here only what is giving wrong.
Two objects "chatting".

This script is a box when i touch it say "now".
From: someone

//BOX
default
{
state_entry()
{
llListen(0,"ball",NULL_KEY,"";);
}
listen(integer channel, string name, key id, string msg)
{
if(msg == "ok";)
{
llSay(0,"deu certo";);
}
else
{
llSay(0,"Hahhh";);
}
}
touch_start(integer total_number)
{
llSay(0, "now";);
}
}


So this next script is a ball it listen a box and pull to state "tocar", so when i touch it say "ok" and go to state "dois" and waiting a object with name "thisnotexist" say "see".
But script of box listen ball say ok and say "deu certo", i don't know why ball listen box say "deu certo" and continues and say "WHY SCRIPT IS HERE?".
So it made a loop because ball say "WHY SCRIPT IS HERE?", box listen and say "Hahhh" so ball listen and say again "WHY SCRIPT IS HERE?"...



From: someone

//BALL
string text;
default
{
state_entry()
{
llListen(0,"box",NULL_KEY,"";);
}
listen(integer channel, string name, key id, string msg)
{
text = msg;
state tocar;

}
}
state tocar
{
touch_start(integer total_number)
{
if(text == "agora";)
{
llSay(0,"ok";);
state dois;
}
else
{
llSay(0,"deu errado";);
}
}
}
state dois
{
state_entry()
{
llListen(2324,"thisnotexist",NULL_KEY,"see";);
}
listen(integer channel, string name, key id, string msg)
{
llSay(0,"WHY SCRIPT IS HERE?";);

}
}


My Question Is WHY BALL SAY "WHY SCRIPT IS HERE?" if object named "thisnotexist" dont exist and no say nothing...

From: someone

state dois
{
state_entry()
{
llListen(2324,"thisnotexist",NULL_KEY,"see";);
}
listen(integer channel, string name, key id, string msg)
{
llSay(0,"WHY SCRIPT IS HERE?";);

}
}


Sorry for maybe some confusion, my english is bad.. Thank's.
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
09-04-2008 10:54
I'll see if I can duplicate this. It looks like the name parameter to llListen() is being ignored.
Sesshomaru Sims
Registered User
Join date: 8 Sep 2006
Posts: 0
Name to List
09-04-2008 12:43
Ah, I recomend using a global variable for the name, like convert its string into a list then break it down again, sometimes in events like listen, its key or name will be ignored for other functions due to the fact its not a constant variable. because it will change depending on if it hears anything or not, it only becomes something for a brief moment then converts back to null, so try adding it to a list, then just list to string it back where you want it
Gusths Willis
Registered User
Join date: 13 Aug 2008
Posts: 2
09-04-2008 14:07
Yes, but why? :/
Guru Urqhart
Registered User
Join date: 9 Mar 2008
Posts: 16
09-05-2008 09:23
I'm sorry, because I've created another thread about a similar argument (/54/f2/280478/1.html).

I've some listen around and they seems to not filter by message, as I expected and as they worked until the servers upgrade.

My hypothesis was that other listens were still active even on state change, but if I understood your script, it isn't your case.

I'm afraid that the llListen() function on 1.24.4 servers doesn't filter as expected!

Grrrrr!
Guru
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
09-05-2008 11:09
I suspect that this is the known problem about listens not being cancelled on state exit. I bet the message is coming from "box".

I can't recreate the problem with a trivial script:

CODE

default
{
state_entry()
{
llListen(0, "foo", NULL_KEY, "bar");
}
listen(integer chan, string who, key id, string msg) {
llSay(0, who + ":" + msg);
}
}


I get no output, regardless of what I say in chat.
Also fails if I make an object that chats, so it's not av-chat vs. object chat.
If I change "foo" to "", it echoes only if I say "bar".

This is LSL-compiled, using 1.20 client.

I suggest the OP simplify the scripts to find the simplest failure case. You shouldn't need two script: for starters, just use one script (the one that does what it shouldn't), and see if it can fail on channel 0 when you chat yourself. If not, try a positive constant channel and chat on that channel.

Whenever you suspect a bug, try to reduce to the most trivial case that fails.
Also, print all the parameters rather than just a message: you might learn something about what's really going on.
Guru Urqhart
Registered User
Join date: 9 Mar 2008
Posts: 16
09-05-2008 13:30
As *Day Oh* says in the mentioned other thread, the bug is known and open: http://jira.secondlife.com/browse/SVC-2990?

Regards,
Guru
Ralph Doctorow
Registered User
Join date: 16 Oct 2005
Posts: 560
09-14-2008 18:23
This is particularly nasty because when a script dies with "Too Many Listens" it cannot be reset with llResetOtherScript, it has to be done manually and the permissions often don't let anyone but the creator do it.

It broke products for hundreds of my customers alone. I'm not sure how I'm going to fix them all.