I've made a menu using link messages and every thing works great, but occasionally when I press a button that calls another menu, it will say the button message in chat, the menu will still come up and the new menu will work. It happens on different buttons so I've not been able to figure out which snippet is the culprit.
All menu pages are made the same so I'll just post one of the smaller ones and hope someone sees something that I'm missing.
Thanks Lyndz~
php
//Ammo Menu v.1 for Lyndzmatic Flaming Toast Launcher v2.0
//by Lyndzay Meili
//Sets what's being shot out of the toaster
list FOOD = ["Toast", "Waffles", "Bagels", "Hide", "Show","<==BACK", "CLOSE"]; //Ammo choices
integer channel;
integer listener;
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
+ llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
send_ammo(string ammo) //sends the ammo choice to the gunscript and sculpty ammo
{
llMessageLinked(LINK_THIS,435,(string)ammo,""
;llMessageLinked(LINK_SET,0,(string)ammo,""
;}
send_viz(string viz) // Hide or shows the ammo
{
llMessageLinked(LINK_SET,0,(string)viz,""
;}
send_menu(string menu) //Calls the main menu
{
llMessageLinked(LINK_THIS,772,(string)menu,""
;llSetTimerEvent(0.0);
llListenRemove(listener); //stop listening
}
time_out() //kills listeners if person does not press button
{
llSetTimerEvent(0.0);
llListenRemove(listener); //stop listening
llOwnerSay("time ran out"
;}
close() // kills the listener and makes the window go away
{
llSetTimerEvent(0.0);
llListenRemove(listener); //stop listening
}
dialog() //calls the dialog menu
{
channel=(integer)(llFrand(-1000000000.0));
llDialog(llGetOwner(),"Pick your toasted treat", FOOD,channel);
listener=llListen(channel, "", llGetOwner(), ""
;llSetTimerEvent(60); //gives 60 seconds to click
}
default //menu to select ammo choices
{
link_message(integer sender_num, integer num, string str, key id)
{
if (str =="ammo"

{
dialog();
}
}
listen(integer chan, string name, key id, string msg)
{
if(msg=="Waffles"

{
send_ammo("Waffles"
;send_menu ("main"
;}
else if(msg=="Toast"

{
send_ammo("Toast"
;send_menu ("main"
;}
else if(msg=="Bagels"

{
send_ammo("Bagels"
;send_menu ("main"
; }
else if(msg=="Hide"

{
send_viz("Hide"
;send_menu ("main"
; }
else if(msg=="Show"

{
send_viz("Show"
;send_menu ("main"
; }
else if(msg=="<==BACK"

{
send_menu("main"
; }
else if(msg=="CLOSE"

{
close();
}
}
timer()
{
time_out();
}
}
/php
