Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDialog Flow problems...

Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
10-16-2005 09:48
Can anyone tell me what might be wrong in this block of code? The initial portion is in "state use" (the touch_start event)...the rest is in state remove.

The script is a mass distribution mailing list. I am able to join the list and send/receive items just fine through the object. The problem comes when I try to remove myself from the list (it claims to remove me) and rejoin (it only offers to remove me again). Apparently there is something either a) not letting me break out of the remove state or b)not working with the llDeleteSubList so that I am always registered and therefore automatically trigger the "remove" state when I try to re-join.




CODE

touch_start(integer number)
{
getkey = llDetectedKey(0);
sendtonumber = llGetListLength(sendto);
for(x = 0; x < sendtonumber; x++)
{
if((string)getkey == llList2String(sendto,x))
{
state remove;
}
}
llDialog(getkey, "You are about to add yourself to the " + listname + " mailing list. Please confirm that you wish to do so.", joinlist, 13);
}
}

state remove
{
state_entry()
{
llListen(13, "", NULL_KEY, "");
llDialog(getkey, "You are about to remove yourself from the " + listname + " mailing list. Please confirm that you wish to do so.", removelist, 13);
llSetTimerEvent(15);
}
listen(integer channel, string name, key id, string message)
{
getkey = id;

if(channel == 13)
{
if(message == "Remove")
{
sendtonumber = llGetListLength(sendto);
for(x = 0; x < sendtonumber; x++)
{
if((string)getkey == llList2String(sendto,x))
{
llDeleteSubList(sendto, x,x);
llSay(0, "You have been removed from the list.");
llSetTimerEvent(0);
if(remote == "on")
{
llEmail(receiver, "outlist", getkey);
}
state use;
}
}
llSay(0, "Your name was not found on the list, no action was taken.");
llSetTimerEvent(0);
state use;
}
else
{
llSetTimerEvent(0);
state use;
}
}
}
timer()
{
llSetTimerEvent(0);
llSay(0, "Dialog timed out, no changes made.");
state use;
}
}
Xantor Welesa
Registered User
Join date: 16 Jun 2005
Posts: 18
10-16-2005 09:53
replace

llDeleteSubList(sendto, x,x);

with

sendto=llDeleteSubList(sendto, x,x);

You didn't store the result :) llDeleteSubList doesn't affect the original list.

*X*
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
10-16-2005 09:57
WOAHHHH...lol...I'm a genius! Hey, thanks for pickin' that out!