Anyone have any idea why this script doesn't work as intended, its nonsensical but its made to highlight my issue, basically after entering state picked, it gets through state_entry() but the dialog never appears and you cannot re-touch it as the option is greyed out?
CODE
integer menu_handler;
integer menu_channel;
list menu_example = [ "yes", "no", "cancel" ];
list submenu_example = [ "yes_0", "no_0", "cancel_0"];
default {
state_entry() {
// do stuff here
state idle;
}
on_rez(integer start_param) {
llResetScript();
}
}
state idle {
timer() {
// do stuff periodically here
}
state_entry() {
llSay(0, "idle...");
}
touch_start(integer total_number) {
state running;
}
}
state running {
state_entry() {
llSay(0, "running...");
}
timer() {
llSetTimerEvent(0.0);
// anyone know how llListenControl() works?
llListenRemove(menu_handler);
}
touch_start(integer total_number) {
menu_channel = -42;
menu_handler = llListen(menu_channel,"","","");
llDialog(llDetectedKey(0), "example menu", menu_example, menu_channel);
llSetTimerEvent(15.0);
}
listen(integer channel, string name, key id, string choice )
{
if (channel == menu_channel) {
llSetTimerEvent(0.0);
// anyone know how llListenControl() works?
llListenRemove(menu_handler);
// is llListFindList() redundant seeing as just testing choice here works?
if (llListFindList(menu_example, [choice]) != -1) {
if (choice == "yes")
state picked;
else if (choice == "no")
state picked;
else { // cancel
llSay(0, "bye");
state idle;
}
} else {
llSay(0, "invalid selection");
state idle;
}
}
}
}
state picked {
state_entry() {
llSay(0, "picked_yes...");
menu_channel = -42;
menu_handler = llListen(menu_channel,"","","");
llDialog(llDetectedKey(0), "example menu", menu_example, menu_channel);
llSetTimerEvent(15.0);
llSay(0, "this prints");
}
timer() {
llSetTimerEvent(0.0);
// anyone know how llListenControl() works?
llListenRemove(menu_handler);
}
listen(integer channel, string name, key id, string choice ) {
// never reached?
if (channel == menu_channel) {
llSetTimerEvent(0.0);
// anyone know how llListenControl() works?
llListenRemove(menu_handler);
// is llListFindList() redundant seeing as just testing choice here works?
if (llListFindList(menu_example, [choice]) != -1) {
if (choice == "yes_0")
llSay(0, "picked yes");
else if (choice == "no_0")
llSay(0, "picked no");
else { // cancel
llSay(0, "bye");
state idle;
}
} else {
llSay(0, "invalid selection");
state idle;
}
//state idle;
}
}
}
