Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help! - Nested llDialog problems

Becca Bayliss
Registered User
Join date: 28 May 2006
Posts: 2
05-28-2006 05:55
Hiya I'm having trouble with llDialog, I'm using it to do two things on an object I've made.

The first menu when you activate it gives you a color menu. On that color menu is an Options button which opens a new Dialog window when you click it, giving you options to customize the size and texture.

The problem is...the way my scripting is going, I can do that...but if I click a color option from Dialog 1, Dialog 2 pops up without me asking for the options menu....if I click the options menu button in Dialog 1....Dialog 2 pops up, but Dialog 1 pops up over it.

Let me see if I can put an example of what I'm doing here so you can see what I'm doing wrong I guess.

CODE

integer CHANNEL = 6;
list MENU_COLORS =
[
//color options menu text here
];
list MENU_OPT =
[
//item options menu text here
];

default {
state_entry()
{
llListen(CHANNEL, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_COLORS, [message]) != -1);
{
//color options here
}
if (message == "OPTIONS");
{
llDialog(llGetOwner(), "OPTIONS", MENU_OPT, CHANNEL);
}
}
if (llListFindList(MENU_OPT, [message]) != -1)
{
//item options
}
llDialog(llGetOwner(), "What Color?", MENU_COLORS, CHANNEL);
}
else if (message == "menu")
{
llDialog(llGetOwner(), "What Color?", MENU_COLORS, CHANNEL);
}
}
}


What am I doing wrong here? I'm really new at this and I've been going through the Wiki and the Forums all morning with no result. :(
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
05-28-2006 08:40
Hey, Becca, I think you have a stray semi-colon:
CODE
            if (message == "OPTIONS"); // <==== closes the if condition
{
llDialog(llGetOwner(), "OPTIONS", MENU_OPT, CHANNEL);
}
...so the "OPTIONS" llDialog becomes unconditional at this point.
Kayla Stonecutter
Scripting Oncalupen
Join date: 9 Sep 2005
Posts: 224
05-28-2006 13:30
You also have a semicolon after the first if(llListFindList()... check.
_____________________
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
05-28-2006 14:16
Try this

CODE

integer CHANNEL = 6;
list MENU_COLORS =
[
//color options menu text here
];
list MENU_OPT =
[
//item options menu text here
];

default {
state_entry()
{
llListen(CHANNEL, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message)
{
//
// Handle the menu calls first
//
if (message == "OPTIONS")
{
llDialog(llGetOwner(), "OPTIONS", MENU_OPT, CHANNEL);
return;
}
if (message == "menu")
{
llDialog(llGetOwner(), "What Color?", MENU_COLORS, CHANNEL);
return;
}
//
// Now see if a menu option has been called
//
if (llListFindList(MENU_COLORS, [message]) != -1)
{
//color options here
return;
}
if (llListFindList(MENU_OPT, [message]) != -1)
{
//item options
llDialog(llGetOwner(), "What Color?", MENU_COLORS, CHANNEL);
return;
}
}
}


It keeps it simple and returns so that processing cannot continue after a selection has been made.