Difference between revisions of "LlDialog"

From Second Life Wiki
Jump to navigation Jump to search
m (Copy editing)
Line 1: Line 1:
{{LSL_Function|sort=Dialog|func_id=247|func_sleep=1.0|func_energy=10.0|func=llDialog
{{LSL_Function/avatar|avatar}}{{LSL_Function|sort=Dialog|func_id=247|func_sleep=1.0|func_energy=10.0|func=llDialog
|p1_type=key|p1_name=avatar|p1_desc
|p1_type=key|p1_name=avatar|p1_desc
|p2_type=string|p2_name=message|p2_desc
|p2_type=string|p2_name=message|p2_desc
Line 5: Line 5:
|p4_type=integer|p4_name=chat_channel|p4_desc
|p4_type=integer|p4_name=chat_channel|p4_desc
|func_desc=Shows a dialog box on the '''avatar''' screen with '''message''' and '''buttons'''.
|func_desc=Shows a dialog box on the '''avatar''' screen with '''message''' and '''buttons'''.
|func_footnote=When a button is pressed, the '''avatar''' chats the button text on '''chat_channel'''.
|func_footnote=When a button is pressed, the '''avatar''' chats the button text on '''chat_channel'''.<br/>The position of the chat is where the prim was when the dialog box was created.
|constants=
{{{!}}
{{!}}- valign="top"
{{!}}
{{{!}}{{Prettytable}}
{{!}}-{{Hl2}}
! colspan="4" {{!}} Button Order
{{!}}-
{{!}}9&nbsp;&nbsp;
{{!}}10
{{!}}11
{{!}}-
{{!}}6
{{!}}7
{{!}}8&nbsp;&nbsp;
{{!}}-
{{!}}3
{{!}}4
{{!}}5
{{!}}-
{{!}}0
{{!}}1
{{!}}2
{{!}}}
{{!}}
{{LSL Constants/Chat}}
{{!}}}
|spec
|spec
|caveats=
|caveats=
Line 39: Line 12:
*There is no way to distinguish the input from a dialog box and regular chat made by the same user.
*There is no way to distinguish the input from a dialog box and regular chat made by the same user.
**It is important to expect that the response may not be one of the buttons.
**It is important to expect that the response may not be one of the buttons.
*If the prim moves out of shout range of where the dialog was created it will not be able to hear the response.
**This limitation effects attachments too if the wearer moves out of shout range of where the dialog box was created.


===message limits===
===message limits===
*If it exceeds 8 lines a scroll bar will appear.
*If it exceeds 8 lines a scroll bar will appear.
*'''message''' must be less than 512 bytes and not empty. Otherwise it will shout an error on {{LSLG|DEBUG_CHANNEL}}.
*'''message''' must be less than 512 bytes and not empty. Otherwise it will shout an error on [[DEBUG_CHANNEL]].


===buttons limits===
===buttons limits===
*If '''buttons''' is an empty list, it will default to as if it were ["OK"].
*If '''buttons''' is an empty list, it will default to as if it were ["OK"].
*No more than 12 buttons can be requested and they must all be strings. Otherwise it will shout an error on {{LSLG|DEBUG_CHANNEL}}.
*No more than 12 buttons can be requested and they must all be strings. Otherwise it will shout an error on [[DEBUG_CHANNEL]].
*Button text cannot be longer than 24 bytes per button. Otherwise it will shout an error on {{LSLG|DEBUG_CHANNEL}}.
*Button text cannot be longer than 24 bytes per button. Otherwise it will shout an error on [[DEBUG_CHANNEL]].
|examples=<pre>integer channel = 1000;
|examples=<pre>integer channel = 1000;
default
default
Line 66: Line 41:
     }
     }
}</pre>
}</pre>
|constants=
{{{!}}
{{!}}- valign="top"
{{!}}
{{{!}}{{Prettytable}}
{{!}}-{{Hl2}}
! colspan="4" {{!}} Button Order
{{!}}-
{{!}}9&nbsp;&nbsp;
{{!}}10
{{!}}11
{{!}}-
{{!}}6
{{!}}7
{{!}}8&nbsp;&nbsp;
{{!}}-
{{!}}3
{{!}}4
{{!}}5
{{!}}-
{{!}}0
{{!}}1
{{!}}2
{{!}}}
{{!}}
{{LSL Constants/Chat}}
{{!}}}
|helpers|related|notes
|helpers|related|notes
|cat1=Chat
|cat1=Chat

Revision as of 07:23, 28 July 2007

Summary

Function: llDialog( key avatar, string message, list buttons, integer chat_channel );

Shows a dialog box on the avatar screen with message and buttons.

• key avatar avatar UUID
• string message
• list buttons
• integer chat_channel

When a button is pressed, the avatar chats the button text on chat_channel.
The position of the chat is where the prim was when the dialog box was created.

Button Order
9   10 11
6 7 8  
3 4 5
0 1 2
Channel Constant Description
DEBUG_CHANNEL 0x7FFFFFFF Chat channel reserved for script debugging and error messages, broadcasts to all nearby users.
PUBLIC_CHANNEL 0x0 Chat channel that broadcasts to all nearby users. This channel is sometimes referred to as: open chat, local chat and public chat.

Caveats

  • This function causes the script to sleep for 1.0 seconds.
  • There is no way by script to kill a dialog box.
  • There is no way for the script to detect if the user clicked the small "ignore" button (no chat is generated as a result of pressing this button).
  • There is no way to distinguish the input from a dialog box and regular chat made by the same user.
    • It is important to expect that the response may not be one of the buttons.
  • If the prim moves out of shout range of where the dialog was created it will not be able to hear the response.
    • This limitation effects attachments too if the wearer moves out of shout range of where the dialog box was created.

message limits

  • If it exceeds 8 lines a scroll bar will appear.
  • message must be less than 512 bytes and not empty. Otherwise it will shout an error on DEBUG_CHANNEL.

buttons limits

  • If buttons is an empty list, it will default to as if it were ["OK"].
  • No more than 12 buttons can be requested and they must all be strings. Otherwise it will shout an error on DEBUG_CHANNEL.
  • Button text cannot be longer than 24 bytes per button. Otherwise it will shout an error on DEBUG_CHANNEL.
All Issues ~ Search JIRA for related Bugs

Examples

integer channel = 1000;
default
{
    state_entry()
    {
        llListen(channel,"", "","");
    }

    touch_start(integer total_number)
    {
        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)
    {
        llSay(0,name + " (" + (string)llDetectedPos(0) + ") chose option " + mes);
    }
}

Deep Notes

Search JIRA for related Issues

Signature

function void llDialog( key avatar, string message, list buttons, integer chat_channel );