Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListenRemove and Dialogs in the Wiki

Lyndzay Meili
Registered User
Join date: 2 Sep 2007
Posts: 28
09-14-2008 18:09
I'm updating a dialog script that I have and am trying to be good and add llListenRemove and Timers so I went to the SL wiki page on Dialog Menus (the example page) and added in those commands as it showed, and it worked alright until I hit the ignore button. After hitting the ignore button, the blue dialog box disappears like it should, then a minute later I get a message that the menu has timed out, then a minute later again, I get the same message, and it continues until I delete the object.

So figuring it was something I did, I copy and pasted the script from the wiki into a prim and get the same thing.

(from the wiki)

PHP


list colourchoices = ["-", "Red", "Green", "Yellow"];
string msg = "Please make a choice.";

key ToucherID;
integer channel_dialog;
integer listen_id;
default{
state_entry() {
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}

touch_start(integer total_number) {
ToucherID = llDetectedKey(0);
llDialog(ToucherID, msg,colourchoices, channel_dialog);
listen_id = llListen( channel_dialog, "", ToucherID, "";);
llSetTimerEvent(60); //HERE WE SET A TIME LIMIT
}


listen(integer channel, string name, key id, string choice) {
if (choice == "-";) {
llDialog(ToucherID, msg,colourchoices, channel_dialog);
}
else if (choice == "Red";) {
//do something
}
else if (choice == "Green";) {
//do something
}
else {
//do something else.
}
llListenRemove(listen_id);
}

timer() { //TIME’S UP!
llListenRemove(listen_id);
llWhisper(0, "Sorry. You snooze; you lose.";);
}
}
/PHP

what is wrong? does it need another llSetTimerEvent(0)?

Thanks for any help
Lyndz
_____________________
"Be who you are and say what you feel, because those who matter don't mind, and those that mind, don't matter."
—Dr. Seuss
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
09-14-2008 18:23
From: Lyndzay Meili
what is wrong? does it need another llSetTimerEvent(0)?


yes
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-14-2008 18:33
CODE

list colourchoices = ["-", "Red", "Green", "Yellow"];
string msg = "Please make a choice.";

key ToucherID;
integer channel_dialog;
integer listen_id;
default{
state_entry() {
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}

touch_start(integer total_number) {
ToucherID = llDetectedKey(0);
llDialog(ToucherID, msg,colourchoices, channel_dialog);
listen_id = llListen( channel_dialog, "", ToucherID, "");
llSetTimerEvent(60); //HERE WE SET A TIME LIMIT
}


listen(integer channel, string name, key id, string choice) {
if (choice == "-") {
llDialog(ToucherID, msg,colourchoices, channel_dialog);
}
else if (choice == "Red") {
//do something
}
else if (choice == "Green") {
//do something
}
else {
//do something else.
}
llSetTimerEvent(0.0);
llListenRemove(listen_id);
}

timer() { //TIME’S UP!
llSetTimerEvent(0.0);
llListenRemove(listen_id);
llWhisper(0, "Sorry. You snooze; you lose.");
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-14-2008 18:37
From: Osgeld Barmy
yes

LMAO A question was asked and you did give the correct answer :p
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum