LlDialog
De DigiWiki.
integer channel = 1000; default { state_entry() { llListen(channel,"", "",""); } touch_start(integer count) { llDialog(llDetectedKey(0), "This is a test dialog.\n\nPlease choose one of the below options.", ["Yes", "No", "0", "1"], channel); } listen(integer chan, string name, key id, string mes) { if(id == llGetOwnerKey(id))//won't listen to objects unless they aren't in the region. llSay(0,name + " (" + (string)llGetObjectDetails(id, (list)OBJECT_POS) + ") chose option " + mes); } }
A simple way to alphabetically or numerically arrange the buttons in a "commonly" logical way.
list a_list; key owner; list n_list; default { state_entry() { a_list = ["e", "h", "g", "a", "c", "d", "b", "f", "i"]; // Shows dialog as owner = llGetOwner(); // [a] [b] [c] } // [d] [e] [f] touch_start(integer total_number) // [g] [h] [i] { // (ignore) n_list = llListSort(llListSort(a_list, 1, TRUE), 3, FALSE); llDialog(owner, "\nWha!!?", n_list, 0); } // This will only work for 3, 6, 9 & 12 buttons. Insert spacers to even out if list is not a multiple of 3. }
// Compact function to put buttons in "correct" human-readable order integer channel; list order_buttons(list buttons) { return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10); } default { state_entry() { // Create random channel within range [-1000000000,-2000000000] channel = (integer)(llFrand(-1000000000.0) - 1000000000.0); llListen(channel,"", "",""); } touch_start(integer total_number) { llDialog(llDetectedKey(0),"\nPlease choose an option:\n", order_buttons(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]),channel); } listen(integer _chan, string _name, key _id, string _option) { llSay(0, _name + " chose option " + _option); } }