Jump to content

What am I Doing Wrong Here


TrinityReclusive
 Share

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

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

Recommended Posts

Well this script does what it should but i can not seem to get it for owner only.

The script runs fine but still anyone can use it.

Do I have something in the Dialog listen area wrong or left out?

ist buttons = ["-", "Red", "White", "Blue"];
string dialogInfo = "\nPlease make a choice.";
 
key ToucherID;
key ToucherOwner;
integer dialogChannel;
integer listenHandle;
 
default
{
    state_entry()
    {
        dialogChannel = 2 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
    }
 
    touch_start(integer num_detected)
    {
        ToucherID = llDetectedKey(0);
        ToucherOwner = llGetOwner();
        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 == "-")
        {
            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            return;
        }
 
        llListenRemove(listenHandle);
        //  stop timer since the menu was clicked
        llSetTimerEvent(0);
 
        if (message == "Red")
        {
           llSay(2,"Red");
 // process Red here
        }
        else if (message == "White")
        {
          llSay(2,"White");
            // process Green here
        }
        else
        {
            llSay(2,"Blue");
            // do any other action here
        }
    }
 
    timer()
    {
    //  stop timer
        llSetTimerEvent(0);
 
        llListenRemove(listenHandle);
        llWhisper(0, "Sorry. You snooze; you lose.");
    }
}

 

I hope some one can notice what i have wrong of missed. Thank you for your help

Link to comment
Share on other sites

Ok i changed it to this still runs but not for owner only. So i must have it still not correct.


list buttons = ["-", "Red", "White", "Blue"];
string dialogInfo = "\nPlease make a choice.";
 
key ToucherID;
key ToucherOwner;
integer dialogChannel;
integer listenHandle;
 
default
{
    state_entry()
    {
        dialogChannel = 2 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
    }
 
    touch_start(integer num_detected)
    {if (ToucherID == ToucherOwner)
{
   //open the dialog
}

        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 == "-")
        {
            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            return;
        }
 
        llListenRemove(listenHandle);
        //  stop timer since the menu was clicked
        llSetTimerEvent(0);
 
        if (message == "Red")
        {
           llSay(2,"Red");
 // process Red here
        }
        else if (message == "White")
        {
          llSay(2,"White");
            // process Green here
        }
        else
        {
            llSay(2,"Blue");
            // 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

2 minutes ago, TrinityReclusive said:

    touch_start(integer num_detected)
    {if (ToucherID == ToucherOwner)
{
   //open the dialog
}

        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
    }

touch_start(integer num_detected)
{
    ToucherID = llDetectedKey(0);
    ToucherOwner = llGetOwner();
    if (ToucherID == ToucherOwner)
    {
        llListenRemove(listenHandle);
        listenHandle = llListen(dialogChannel, "", ToucherID, "");
        llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
        llSetTimerEvent(60.0); // Here we set a time limit for responses
    }
}

Link to comment
Share on other sites

That's because you left two extra curly brackets in.. Get rid of them:

    touch_start(integer num_detected)
    {
        if (ToucherID == ToucherOwner)
        {
          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
        }
    }

 

Link to comment
Share on other sites

  • 3 years later...
You are about to reply to a thread that has been inactive for 396 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...