Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Disccusion: 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
{
llListenRemove(handler);
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);
llResetTime();
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
Original Thread:
05-13-2005 09:53
/15/27/46115/1.html
_____________________
i've got nothing. ;)
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
01-18-2006 12:46
I have been considering using a menu system to pass out notecards depending upon selections made using the menu, rather than using multiple objects with the standard notecard giver script in it.

The question I have is how does something like this menu script effect sim performance as opposed to the on touch notecard giver script. Is it enough to even care about?

Could "loose" code could make one version of the script worse than another (it seems too basic for that to happen but want to make sure)?

my apologies for the noobness of the questions - lol (oh and the resurrection of a necro post :) )

Catt
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
01-18-2006 15:39
dialog is basicly a listener in the object and a box that pops up, when the user makes a selection your av says the choice out loud on the specfied chat channel

its good becuase you dont have to hassle your users with 50 lines of chat spam listing off many /99 (or whatever) commands.
Set some text, set your options and the user just hits the button

it could be bad becuase its a listen but so is /456 stop
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
01-19-2006 00:57
In this example, though, the listen and timer only start when you touch the object - and they automatically vanish 5 seconds later.

The other 99.99% of the time, this system is about as lag-free as it gets.
Step5 Iceberg
Registered User
Join date: 8 Nov 2006
Posts: 2
06-22-2009 01:04
Hello,

i tried to compile this script, and got an error:

";(4,22 : ERROR : Name not defined within scope)"

CODE

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel ...
{
llListenRemove(handler);
menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use


Am i right, that i have to change

"llListenRemove(handler);"

to

"llListenRemove(menu_handler);" to make this script working?

edit: nevermind, found a working version of this script in my script collection. ^^