Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu Help !

Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 08:30
^^ Hello I need some help I am trying to do a Menu (llDialog) that use a channel command (/channel) for call the menu, instead of touching the objet for call the menu, can someone help me.

*Menu Script*

integer CHANNEL = 42;
list MENU_MAIN = ["Armor Color", "Fx Color"];
list MENU_FXCOLOR1 = ["fx black","fx white","fx red","fx yellow","fx green","fx cyan","<<< Back","Next >>>"];
list MENU_FXCOLOR2 = ["fx blue","fx purple","fx orange","fx brown","fx pink","fx grey","<<<< Back"];
list MENU_ARMORCOLOR1 = ["armor black","armor white","armor red","armor yellow","armor green","armor cyan","<<< Back","Next >>>>"];
list MENU_ARMORCOLOR2 = ["armor blue","armor purple","armor orange","armor brown","armor pink","armor grey","<<<<< Back"];

default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, "";);
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL);
}

listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN + MENU_FXCOLOR1 + MENU_ARMORCOLOR1 + MENU_FXCOLOR2 + MENU_ARMORCOLOR2, [message]) != -1)
{
llSay(-20000, message );
if (message == "Fx Color";)
llDialog(id, "Pick an option!", MENU_FXCOLOR1, CHANNEL);
else if (message == "Armor Color";)
llDialog(id, "Pick an option!", MENU_ARMORCOLOR1, CHANNEL);
else if (message == "Next >>>";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR2, CHANNEL);
else if (message == "<<< Back";)
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
else if (message == "Next >>>>";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR2, CHANNEL);
else if (message == "<<<< Back";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR1, CHANNEL);
else if (message == "<<<<< Back";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR1, CHANNEL);
}
}
}


This what I got so far =/ but i cant figure out how to do it right it had a lot of probles like cross listen and call multiples menus, I'll reay tankfull is someone can help me with this.
^-^ thx
Tanith Rosenbaum
Registered User
Join date: 10 Sep 2008
Posts: 42
04-14-2009 08:44
hey :)

I'd modify the listener as follows:

CODE

listen(integer channel, string name, key id, string message)
{
if(message == "menu")
{
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
return;
}
if (llListFindList(MENU_MAIN + MENU_FXCOLOR1 + MENU_ARMORCOLOR1 + MENU_FXCOLOR2 + MENU_ARMORCOLOR2, [message]) != -1)
{
llSay(-20000, message );
if (message == "Fx Color")
llDialog(id, "Pick an option!", MENU_FXCOLOR1, CHANNEL);
else if (message == "Armor Color")
llDialog(id, "Pick an option!", MENU_ARMORCOLOR1, CHANNEL);
else if (message == "Next >>>")
llDialog(id, "What do you want to do?", MENU_FXCOLOR2, CHANNEL);
else if (message == "<<< Back")
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
else if (message == "Next >>>>")
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR2, CHANNEL);
else if (message == "<<<< Back")
llDialog(id, "What do you want to do?", MENU_FXCOLOR1, CHANNEL);
else if (message == "<<<<< Back")
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR1, CHANNEL);
}
}
}


That'll give everyone who says /42menu a menu... :)
You might want to modify it to if(llStringTrim(message, STRING_TRIM) == "menu";) - that way things like /42 menu (with space between channel and menu) will work too...

Let us know if that helps :)

P.S.: What's the llSay(-20000, message ); for?
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 08:56
:D Thx that do the trick , the llSay(-20000, message ); is for pirm that have a listener for change the color, but I'll change it for a linkmessange
Tanith Rosenbaum
Registered User
Join date: 10 Sep 2008
Posts: 42
04-14-2009 09:06
From: Shaden Sura
:D Thx that do the trick , the llSay(-20000, message ); is for pirm that have a listener for change the color, but I'll change it for a linkmessange


you'll have to. scripts inside the same prims can't hear each other, so if the color change script is inside the same prim llMessageLinked is your only option.
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 09:07
=P if no working I test it

integer CHANNEL =42;
list MENU_MAIN = ["Armor Color", "Fx Color"];
list MENU_FXCOLOR1 = ["fx black","fx white","fx red","fx yellow","fx green","fx cyan","<<< Back","Next >>>"];
list MENU_FXCOLOR2 = ["fx blue","fx purple","fx orange","fx brown","fx pink","fx grey","<<<< Back"];
list MENU_ARMORCOLOR1 = ["armor black","armor white","armor red","armor yellow","armor green","armor cyan","<<< Back","Next >>>>"];
list MENU_ARMORCOLOR2 = ["armor blue","armor purple","armor orange","armor brown","armor pink","armor grey","<<<<< Back"];

default {
listen(integer channel, string name, key id, string message)
{
if(message == "menu";)
{
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
return;
}
if (llListFindList(MENU_MAIN + MENU_FXCOLOR1 + MENU_ARMORCOLOR1 + MENU_FXCOLOR2 + MENU_ARMORCOLOR2, [message]) != -1)
{
llSay(-20000, message );
if (message == "Fx Color";)
llDialog(id, "Pick an option!", MENU_FXCOLOR1, CHANNEL);
else if (message == "Armor Color";)
llDialog(id, "Pick an option!", MENU_ARMORCOLOR1, CHANNEL);
else if (message == "Next >>>";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR2, CHANNEL);
else if (message == "<<< Back";)
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
else if (message == "Next >>>>";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR2, CHANNEL);
else if (message == "<<<< Back";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR1, CHANNEL);
else if (message == "<<<<< Back";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR1, CHANNEL);
}
}
}

I type /42menu and /42 menu and nothing happen
Ultralite Soleil
Registered User
Join date: 31 Aug 2006
Posts: 108
04-14-2009 09:28
Where is the call to llListen?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-14-2009 09:34
You forgot to include a listen handler. Put it in a state_entry event like so ....

CODE

state_entry()
{
llListen(42, "",NULL_KEY,"menu");
}


If you filter for the word "menu" in the handler, as I did here, then you don't have to test for it with an if statement in the listen event, the way you do, either. :)
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 09:39
X3 OMG I am such a noob you are right complete forget add the listen start jejejeje thx ^^
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 09:59
=/ I got other problem when I type /42 menu now the menu show but when I pick a option, example Armor, nothing happens no other optios show, anyone have a idea for that?

*actual Script Format*

integer CHANNEL =42;
list MENU_MAIN = ["Armor Color", "Fx Color"];
list MENU_FXCOLOR1 = ["fx black","fx white","fx red","fx yellow","fx green","fx cyan","<<< Back","Next >>>"];
list MENU_FXCOLOR2 = ["fx blue","fx purple","fx orange","fx brown","fx pink","fx grey","<<<< Back"];
list MENU_ARMORCOLOR1 = ["armor black","armor white","armor red","armor yellow","armor green","armor cyan","<<< Back","Next >>>>"];
list MENU_ARMORCOLOR2 = ["armor blue","armor purple","armor orange","armor brown","armor pink","armor grey","<<<<< Back"];

default {
state_entry()
{
llListen(CHANNEL, "",NULL_KEY,"menu";);
}
listen(integer channel, string name, key id, string message)
{
if(message == "menu";)
{
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
return;
}
if (llListFindList(MENU_MAIN + MENU_FXCOLOR1 + MENU_ARMORCOLOR1 + MENU_FXCOLOR2 + MENU_ARMORCOLOR2, [message]) != -1)
{
llSay(-20000, message );
if (message == "Fx Color";)
llDialog(id, "Pick an option!", MENU_FXCOLOR1, CHANNEL);
else if (message == "Armor Color";)
llDialog(id, "Pick an option!", MENU_ARMORCOLOR1, CHANNEL);
else if (message == "Next >>>";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR2, CHANNEL);
else if (message == "<<< Back";)
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
else if (message == "Next >>>>";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR2, CHANNEL);
else if (message == "<<<< Back";)
llDialog(id, "What do you want to do?", MENU_FXCOLOR1, CHANNEL);
else if (message == "<<<<< Back";)
llDialog(id, "What do you want to do?", MENU_ARMORCOLOR1, CHANNEL);
}
}
}
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 11:00
^^ nvm I found the problem need to remove the "menu" from llListen(CHANNEL, "",NULL_KEY,"menu";);
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-14-2009 11:07
Ah, .....well, this one is partly my fault. I didn't notice that you're using the same channel for your initial trigger and for your later dialog calls. The way I suggested filtering, the only message that will ever get through on CHANNEL is "menu," so you'll never hear anything that the Dialog says later. Just replace the last parameter in the llListen statement ("menu";) with an empty space ("";).

Edit: I see you got it already. Sorry about that. :o
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
04-14-2009 12:50
^^ no worry thx for the help =D