Don't click here unless you want to be banned.

LSL Wiki : llDialog

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
llDialog(key id, string message, list buttons, integer chat_channel)

Shows the user specified by id a popup dialog box (in the upper right corner of their SecondLife window) containing message and buttons (and an "Ignore" button). Selecting any of the buttons will cause the avatar to say the text of that button on channel chat_channel.

Even though the chat will originate with the user's name and key, the chat position will be centered at the object calling llDialog. This ensures the object will be always within listening range of the answer.

Using DEBUG_CHANNEL as the chat_channel will cause avatar to say the button name on the public channel, rather than on the debug channel as one might expect.
Actually, it does go on the debug channel, it's just that when agents chat on the debug channel, clients see it as though it was public chat. LSL objects see it on DEBUG_CHANNEL

Limits to message:

Limits to buttons:

If the user selects "Ignore", the script will not receive an answer, so implement a timeout (recommended) or allow the dialog to be restartable from anywhere.



// when touched, present a dialog with four color choices

integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["Sit", "Stand", "Fly", "Cheat", "Options..."]; // the main menu
list MENU_OPTIONS = ["Cherry", "Blueberry", "Vinegar", "Slime", "Chips", "Salad", "...Back"]; // a submenu

default {
    state_entry() {
        llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
    touch_start(integer total_number) 
        llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL); // present dialog on click
    listen(integer channel, string name, key id, string message) 
        if (llListFindList(MENU_MAIN + MENU_OPTIONS, [message]) != -1)  // verify dialog choice
            llSay(0, name + " picked the option '" + message + "'."); // output the answer
            if (message == "Options...") 
                llDialog(id, "Pick an option!", MENU_OPTIONS, CHANNEL); // present submenu on request
            else if (message == "...Back") 
                llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back
            // here you have the name and key of the user and can easily verify if they have the permission to use that option or not
            else if (message == "Sit") 
                llSay(0, "This is where stuff would happen if this wasn't just an example");
        } else 
            llSay(0, name + " picked invalid option '" + llToLower(message) + "'."); // not a valid dialog choice

//Compact function to put buttons in "correct" human-readable order ~ Redux
list order_buttons(list buttons)
    return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);

//Function that puts buttons in "correct" human-readable order without relying on intelligent higher order list functions ~ Redux
//my bad; fixed 11/25/07
list order_buttons(list buttons)
        integer offset;
        list fixt;
        while((offset = llGetListLength(buttons)))
            fixt += llList2List(buttons, offset = -3 * (offset > 3), -1);
            buttons = llDeleteSubList(buttons, offset, -1);
        return fixt;

// Loop that puts buttons in "correct" human-readable order, no matter the length of the list.
// Designed to work with "<<" and ">>" buttons, allowing easy browsing of 'virtual' dialog pages. ~ Trullo Oh
for (i=0;i<llGetListLength(BUTTON);i+=3) { BUTTON = llListInsertList(llDeleteSubList(BUTTON, -3, -1), llList2List(BUTTON, -3, -1), i); }
default //Paste this script into an object
touch_start(integer x) //Touch the object
llDialog(llDetectedKey(0) , "Text" , ["1" , "2" , "3"] , 0); //Select a number, chats it over channel zero.

Q & A
Q: What is the equivelant range of llDialog (whisper, say, shout, regionsay)?
A: The range seems very long, as i once used a dialog from one sim, to another, where there was a complete sim between it, and yet it still responded perfectly, the answer below is not correct, it seems further then shout, and not limited to the region, more like connected to the sim, is the range.(might require more test, if this still applies)"
Actually, the below answer is correct. It says that the "object were to say llSay", not the avatar; therefore, no matter where your avatar is, the dialog response originates from the object's centre. -- EH
Responding to the dialog will work as if the object were to use llSay(channel,message), where 'channel' is the channel specified by llDialog and 'message' is the text that was on the button choosen. This means the range is a 20-meter radius centered on the object.

Q: Is there a way to extend (or narrow) the range?
Not directly. You could use the listen event trigger a llShout or llRegionSay when it hears a dialog choice, but it doesn't appear to be possible to narrow the range unless you do something equivalent to an if/else and llVecDist.

Q: Do objects recieveing messages from the dialog require a certain command or event specific to dialogs, or is it just the standard llListen command and listen event?
The button text is said on the channel specified, and can be heard through a standard listen event set to that specific channel. In other words, no, nothing fancy has to be done. It's just a normal listen event.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Agent/Avatar | Chat | Communications | User-Interface | Jasa SEO Murah Jasa SEO Jasa Google Adwords Jasa Adwords Google Adwords Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Govr Edo Ziedo Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Penumbuh Rambut Kursus SEO Jam Tangan Casio Grosir Baju Bisnis Online Kerupuk Kulit Social Bookmark Kumpulan Puisi WBC Wonogiri Penumbuh Rambut Jam Tangan Murah Jam Tangan Murah Jam Tangan Casio Penumbuh Rambut Kerupuk Kulit Alat Kantor Belanja Online Grosir Eceran Murah dan Aman Jasa SEO Model Jilbab Fine Tableware Permanent Hair Removal island investment development professional makeup artist bali private villa sewa mobil jakarta murah Jual rumah Jakarta Contact Lens Technology
There are 7 comments on this page. [Display comments/form]