Jump to content

What am I Doing Wrong Here


You are about to reply to a thread that has been inactive for 480 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 post
Share on other sites

In the touch_start event you're collecting two ids, that of the toucher and that of the owner. So to make things owner only you should check that the toucher is the owner before going on to open the dialog.

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

Link to post
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 post
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 post
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 post
Share on other sites
You are about to reply to a thread that has been inactive for 480 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...