Jump to content

Dialog Menu close event


GloriaGlitter
 Share

You are about to reply to a thread that has been inactive for 1539 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am staring a project using a dialog menu and I'm starting with a basic script taken from LSL library. There is a timer event to close the menu after a period of time as well as a Close button.  For some reason the menu doesn't close on timeout although the closing message is displayed and the event uses the same line of code as the Close button.  It is not crucial to my project but I'd like to know if there is a bug in the script. Here is the script:

list buttons = [ "Green", "Red", "CLOSE", "Yellow"];
string dialogInfo = "\nPlease make a choice.";
 
key ToucherID;
integer dialogChannel;
integer listenHandle;
 
default
{
    state_entry()
    {
        dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
    }
 
    touch_start(integer num_detected)
    {
        ToucherID = llDetectedKey(0);
        llListenRemove(listenHandle);
        listenHandle = llListen(dialogChannel, "", ToucherID, "");
        llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
        llSetTimerEvent(60.0); // Here we set a time limit for responses
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if (message == "CLOSE")
        {
            llSetTimerEvent(0);
            llListenRemove(listenHandle);
            return;
        }
 
        llListenRemove(listenHandle);
        //  stop timer since the menu was clicked
        llSetTimerEvent(0);
 
        if (message == "Red")
        {
            // process Red here
        }
        else if (message == "Green")
        {
            // process Green here
        }
        else
        {
            // do any other action here
        }
    }
 
    timer()
    {
    //  stop timer
        llSetTimerEvent(0);
 
        llListenRemove(listenHandle);
        llWhisper(0, "Sorry. You snooze; you lose.");
    }
}

Link to comment
Share on other sites

If you mean that the dialog box itself does not disappear, that's expected behavior. You cannot force a dialog box to vanish.  You can replace it with another box that says "Please close this box" and has an OK button, but that's just annoying. SL residents just learn to close boxes when they are no longer useful.

Link to comment
Share on other sites

Would be nice to get dialog reform and include the ability for dialog generation to have their own UUID which can be used by a function llCloseDialog(key dialog_key); to cleanup timed out dialogs, especially it is unknown what viewer options someone is using in regards to dialog stacking/replacing.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1539 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...