// when touched, present a dialog with four color choices
integer CHANNEL = -42; // dialog channel
list MENU_MAIN = ["Effects", "Texture/s", "Theme"]; // the main menu
list MENU_EFFECTS = ["Laser", "Strobe", "Mist", "...Back"]; // a submenu
list MENU_TEXTURES = ["Moon", "Glass", "Flat", "...Back"]; // a submenu
list MENU_THEMES = ["Slow", "Normal", "Fast", "Hip Hop", "Rave", "Smooth", "...Back"]; // a submenu
menuStart(){
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL); // present dialog on click
}
default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, ""
; // listen for dialog answers (from multiple users)}
touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner())
{
menuStart();
}else{
//jump animate;
}
}
listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN + MENU_EFFECTS + MENU_TEXTURES + MENU_THEMES, [message]) != -1) // verify dialog choice
{
llSay(0, name + " picked the option '" + message + "'."
; // output the answerif (message == "Effects"
llDialog(id, "Pick an option!", MENU_EFFECTS, CHANNEL); // present submenu on request
else if (message == "Texture/s"
llDialog(id, "Pick an option!", MENU_TEXTURES, CHANNEL); // present submenu on request
else if (message == "Theme"
llDialog(id, "Pick an option!", MENU_THEMES, CHANNEL); // present submenu on request
else if (message == "...Back"
menuStart(); // present main menu on request to go back
} else
llSay(0, name + " picked invalid option '" + llToLower(message) + "'."
; // not a valid dialog choice}
}
This is basically copied from the Wiki and modified a little by me. What I'm having trouble with is the "Back" option at the bottom of the script. I created the menuStart function in order to save space and time. The initial call to the function at the beginning of the script works fine, but when it is called from the elseIf section it does not load.
What I can't understand is the fact that if I use the llDialog code from the function itself, in place of the function call it works fine. I am a newcomer to LSL scripting so it maybe that I have made a rookie mistake.
Many thanks to anyone who can point out where I may be going wrong.
