Join us in Outworldz at or follow us:

[Table of Contents]

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Description: Creator:
Menu Button-Abstraction-Layer.lsl
Menu General Menu Engine // This is a library that allows LSL programmers to easily create dialog-based objects (instead of the laggy listen-based ones). It communicates with link messages with your script (in the same prim). It is somewhat in the similar domain as DialogModule, but it's quite a bit different. // This is the first version of my script, so feel free to comment on it, and I might enhance it in the future! // // The theory is that you need to 'define' your hierarchic menu system (in a "menudefs" notecard), then you can use just easy 'doMenu("THEMENUNAME");' calls to start a menu, and you get the result with a link message. // // The library opens listens for 60 seconds maximum (timeout) or only as long as is needed (until user presses a choice), so it should generate as less lag as possible. // // The menudefs notecard goes like this: // // MENU DEFAULT // TEXT ~ Main Menu ~\nSelect a function // TOMENU SETTITLE Set title // OPTION Start vote // TOMENU CLITEM Clear Item // OPTIONASK Reset // // // Where: // * MENU -- defines the menu ID, that you can later pass to the doMenu() function, also returned in the results // * TEXT -- the text displayed in the menu // * TOMENU -- the users sees 'ButtonText' on a button, upon pressing, s/he'll get to the menu with ID of MenuID. You can call that a submenu. // * OPTION -- An option, upon press, the MenuID and the ButtonText gets returned // * OPTIONASK -- Same as option, but will ask Yes/No before returning the result // // The result, returned in the 'string' part of a linkmessage (number: LM_OPTIONDATA) looks like this: // * MENUID|ButtonText // // // A MenuEngine-enhanced script and object contains: // * MenuEngine script - the library, used with link messages // * menudefs - notecard defining the menus // * your custom script - using the library with link messages, and containing the 'interface' code for easiness // // If you want to create a menu-enhanced object // * Have your script in the object, and copy & paste the interface code from the start of Menu demo included below // * Put my MenuEngine script in the object // * Create your menudefs notecard, and put it in the object (or update it) // * IMPORTANT: RESET the MenuEngine script - it will (re)read the menudefs, that takes a few seconds (5-10) // // The inteface library provides these functions: // * resetMenu() -- resets and reloads the menu notecard // * doMenu( key user, string menuname ) -- show MENUNAME ID menu to user USER, and get the response with linkMessages // * readString( key user, string var, string prompt ) -- show a PROMPT to user and read a string from chat // * customMenu( key user, string menuname, string message, list buttons ) -- make a dialog for user USER, with a pseudo menuid MENUNAME, the dialog will say message and have BUTTONS for buttons // // Also: another example for using this library: General Menu Engine Example 1 // // Issues: // * Concurrency: only one person can really use the dialogs at a time. The last popped-up dialog handling will clear the listen to the previous user. Most of the time, this is not really a problem, though, but be aware of it. // // History: // 1.0.2: custom menu function added
Menu The "menudefs" notecard:
Menu // A "MenuDemo" script:
Menu reload key is censored.

Back to the Best Free Tools in Second Life and OpenSim.