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;
}
}