This one builds a menu from a list and then depending on your selection, performs other actions in a list. This could be modified to accept a list of bots passed in from the generate bots list script and then choose actions for them to perform from a list.
list main_menu = ["Blue", "Red"];
list blue_menu = ["Blue Stuff 1", "Blue Stuff 2", "Back"];
list red_menu = ["Red Stuff 1", "Red Stuff 2", "Back"];
integer submenu = FALSE;
integer listen_channel = 1;
default
{
state_entry()
{
llListen(listen_channel,"",llGetOwner(),"");
//llSay(0, "Hello, Avatar!");
llSetText("Sample menu using LLDialog", <1,0,0>, 1.0);
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
llDialog(llDetectedKey(0),"Try a selection...", main_menu, listen_channel);
}
listen(integer channel, string name, key id, string message)
{
if (submenu == FALSE)
{
// Use a main menu verification
if (message == "Blue")
{
llSay(0,"Thanks for picking " + message);
llDialog(id,message + " Dialog", blue_menu, listen_channel);
}
if (message == "Red")
{
llSay(0,"Thanks for picking " + message);
llDialog(id,message + " Dialog", red_menu, listen_channel);
}
submenu = TRUE;
llSetTimerEvent(20.0);
}
else
{
// Use a sub menu verification
llSetTimerEvent(20.0);
if (message == "Back")
{
llDialog(id,message + " Dialog", main_menu, listen_channel);
submenu = FALSE;
}
else
{
llSay(0,"You picked " + message);
//might want to verify which sub-menu was being used to redisplay here, etc
submenu = FALSE;
}
}
}
timer()
{
llSetTimerEvent(0.0);
llSay(0,"You waited too long to pick, resetting menu.");
submenu = FALSE;
}
}
No comments:
Post a Comment