Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

dialog menus!

Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
05-13-2005 02:54
ok here is a little code i made for my dialog menus that work like a function and close the listeners automatically, i hope peoples will like the design

CODE


integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
menu_handler = llListen(menu_channel,"","","");
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default
{
touch_start(integer t)
{
menu(llDetectedKey(0),"hello world",["yes","no"]);
}
timer() //so the menu timeout and close its listener
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
if(message == "yes")
{
//do stuffs
}
else if(message == "no")
{
//do other stuffs
}
}
}
}

_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread:
05-13-2005 09:53
/54/b6/46156/1.html
_____________________
i've got nothing. ;)