Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

menu help

Ehco Klossovsky
Registered User
Join date: 22 Mar 2008
Posts: 10
06-08-2008 20:22
hey , okay im pretty new at scripting and i want to make a menu with some choices but then when you click on one choice i want another menu to come up with more choices.

eg. menu comes up with boat , banana, car. You Click boat --> (new menu comes up with) Sail, Mast, Wheel.

I can get the first menu to come up but i cant seem to get the second menu to come up, this is what i have so far

integer Dahlia = 0;
integer Dahlia2 = 1;
integer channel = -40;
list main_menu = ["Mythic","N'komusume","Lycanthrope","Nocturnal","Demonika","Elven","Machina","Terran","Angeliqu","Drow"];
list Mythic_menu = ["Oracle","Praetorian","Warden"];
list neko_menu = ["Bracer","Feral","Pouncer"];
list Nocturnal_menu = ["Bane","Channeler","Enthraller"];
list Terran_menu = ["Hunter","MedTech","Radical"];
list Angeliqu_menu = ["Devine","protector","purifier"];
list Demokika_menu = ["Corrupter","Sacraficer","Scourge"];
list Drow_menu = ["Cavestalker","Kinslayer","Priest"];
list Elven_menu = ["Champion","Guardian","Shaman"];
list Lycan_menu = ["Beast","Predator","Seer"];
list Machina_menu = ["Centurion","Exterminus","Mender"];


default
{
state_entry()
{
llSay(0, "Race Thing v0.1";);
llListen(channel,"",NULL_KEY,"";);
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "Which Race would you like to know about?", main_menu, channel);
}
listen(integer channel, string name, key id, string message)
{
if (message == "Mythic";)
{
llDialog(llDetectedKey(0), "Which Class would you like to know about?", Mythic_menu, channel);
}

}

}


the first menu will show but i cannot get the second menu to show, any help on this would be greatly appreciated
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-08-2008 21:08
you cannot use detected key in a listen event, use id instead

listen(integer channel, string name, key id, string message)

id = the key it hears
Ehco Klossovsky
Registered User
Join date: 22 Mar 2008
Posts: 10
06-08-2008 21:49
hey thanks for your reply, how would i go about making it listen to the key, could you provide an example or kinda point me in the right direction in the LSL portal? , sorry im really new at this
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-08-2008 22:07
well whenever a listen event is invoked you get 4 variables

channel
user name
user id
and message

you could use the detectedkey in the touch event and setup a dedicated listener to just that key, this would lock the system down to 1 user

or you can just use the id from the listen event to send the message back to whatever user is interacting with the object at that perticular moment (or use a mix of the 2 for security)

ie
if (message == "Mythic";)
{
llDialog(id, "Which Class would you like to know about?", Mythic_menu, channel);
}

this would only return a new / fresh dialog to the user that told the object "Mythic"

course if anyone came up and told the object that they would get the "Mythic" menu

so id use a screwball chat channel (theres like a cupple billion possibilities)

and if you want to improve on that, you can use negitive numbers for chat (ie -1029723) that only responses of llDialog can send, therefore they would have to get a dialog, instead of joe user walkingup and saying random commands
Ehco Klossovsky
Registered User
Join date: 22 Mar 2008
Posts: 10
06-08-2008 22:23
hey, thanks allot this was allot of help ^^ i can make it work now , but im not sure if i fully understand how it all works, if you have time at all it would be great if you could explain you seem to know what your talking about really well ^^
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-08-2008 22:28
im hardly inworld anymore, but be sure to read, read, and play with as much as you can ... thats how i learned

and i couldn't even get a llSay to work when i started