Jump to content

On/Off values for dialog information in llDialog title?


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

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

Recommended Posts

I am trying to set the my dialog menu here to show whether or not "Hover Text" and "Tell Friends" is on or off. This is currently how the script looks so far, but all I am getting in return, is a blank space inside of the (string)friends and (string)hover when it is show on the dialog menu. I am still learning scripting, so hope my coding isn't too ugly. Any help would be greatly appreciated. Thanks -Mike

P.S. Here is the snippet of the code. It will function just like this, but does not return "On" or "Off" values in the dialog title. =/

 

integer menu_handler;
integer menu_channel;
integer text_hide;
integer tell_friends;
string On;
string Off;
string friends;
string hover;
menu(key user,string title,list buttons)
{
    menu_channel = (integer)(llFrand(99999.0) * -1);
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
}
default
{
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"Please select an option." + "\n" + "\n" +
        "Tell Friends: " + (string)friends + "\n" + //On/Off?
        "Hover Text: " + (string)hover + "\n"       //On/Off?
        ,["-","-","-","Show Text","Hide Text", "-" , "Tell Friends" , "Friends Off" , "-"]);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel)
        {
            if (message == "Hide Text")
            {
                text_hide = TRUE;
                hover = Off;
            }
            if (message == "Show Text")
            {
                text_hide = FALSE;
                hover = On;
            }
            if (message == "Tell Friends")
            {
                tell_friends = TRUE;
                friends = On;
            }
            if (message == "Friends Off")
            {
                tell_friends = FALSE;
                friends = Off;
            }
        }
    }
}

 

Link to comment
Share on other sites

Just follow what happens:

  • script starts - variables are initialized, but still 'empty'
  • touch passes some arguments to the function menu() - there are the variables uin the string title - but these varables are still empty
  • dialog is show with nothing where the variables are
  • in the listen event, the variables hover and tell_friends get set for the first time - they get set- in case of friends, either to the variable on or to te variable off - which are empty as well - that's why it never shows anything

ETA:

This would solve it:

integer menu_handler;integer menu_channel;integer text_hide;integer tell_friends;string On = "On";string Off = "Off";string friends;string hover;menu(key user,string title,list buttons){    menu_channel = (integer)(llFrand(99999.0) * -1);    menu_handler = llListen(menu_channel,"","","");    llDialog(user,title,buttons,menu_channel);}default{    touch_start(integer t)    {        menu(llDetectedKey(0),"Please select an option." + "\n" + "\n" +        "Tell Friends: " + (string)friends + "\n" + //On/Off?        "Hover Text: " + (string)hover + "\n"       //On/Off?        ,["-","-","-","Show Text","Hide Text", "-" , "Tell Friends" , "Friends Off" , "-"]);    }    listen(integer channel,string name,key id,string message)    {        if (channel == menu_channel)        {            if (message == "Hide Text")            {                text_hide = TRUE;                hover = Off;            }            if (message == "Show Text")            {                text_hide = FALSE;                hover = On;            }            if (message == "Tell Friends")            {                tell_friends = TRUE;                friends = On;            }            if (message == "Friends Off")            {                tell_friends = FALSE;                friends = Off;            }        }    }}

 

Link to comment
Share on other sites

 

Your  "On" and "Off" strings need to be in quotes and not listed as Global string variables...

 

 

integer menu_handler;integer menu_channel;integer text_hide;integer tell_friends;string friends;string hover;menu(key user,string title,list buttons){    menu_channel = (integer)(llFrand(99999.0) * -1);    menu_handler = llListen(menu_channel,"","","");    llDialog(user,title,buttons,menu_channel);}default{    touch_start(integer t)    {        menu(llDetectedKey(0),"Please select an option." + "\n" + "\n" +        "Tell Friends: " + friends + "\n"        "Hover Text: "+ hover + "\n"        ,["-","-","-","Show Text","Hide Text", "-" , "Tell Friends" , "Friends Off" , "-"]);    }    listen(integer channel,string name,key id,string message)    {        if (channel == menu_channel)        {            if (message == "Hide Text")            {                text_hide = TRUE;                hover = "Off";            }            if (message == "Show Text")            {                text_hide = FALSE;                hover = "On";            }            if (message == "Tell Friends")            {                tell_friends = TRUE;                friends = "On";            }            if (message == "Friends Off")            {                tell_friends = FALSE;                friends = "Off";            }        }    }}

 

....

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4092 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
 Share

×
×
  • Create New...