The function llCustomDialog works similar to llDialog function but allows creating more modern and fancy dialogs.
key llCustomDialog(key avatar,
string message, list buttons, integer channel,
list options);
The return value is not used at time. It can be used in future to identify open dialogs (and for example to let the viewer close it).
The options parameter allows the scripter to control rendering and behavior of the dialog. I organized it in 3 categories.
1. Dialog symbol options
A dialog symbol is a large symbol shown at the side of the text. The actual position and size of this symbol is up to the viewer.
This option defines static dialog symbol:
[CUSTOM_DIALOG_TYPE, key symbol]
The symbol parameter is a key of the image to show as the dialog symbol. Additionally we can define key constants using pre-defined dialog symbols:
CUSTOM_DIALOG_TYPE_CONFIRMATION,
_INFORMATION, _ERROR, _WARNING, _OPEN, _TRANSFER.
The types OPEN and TRANSFER are used to confirm opening of product boxes or transferring items to someone else (usual operations for vendors and product boxes).
To animate a user-defined dialog symbol we use this option block:
[CUSTOM_DIALOG_TYPE_ANIM,
integer mode, integer sizex, integer sizey, float start,
float length, float rate]
The parameters are quite similar to the llSetTextureAnim so that we not need to describe them. When no CUSTOM_DIALOG_TYPE option is set, the dialog will show no symbol. When a predefined dialog symbol is used, the animation option is ignored.
2. Tab-stop option
When I create dialogs I mostly want to provide some information and I'd like to make it look like a table. This option aims to acheive this:
[CUSTOM_DIALOG_COLUMNS, string columns, integer softbreaks]
The parameter columns is a comma-separated string of column definitions, as "<size><alignment><margin>".
  • The size and margin are given either in pixels or in ratio to the size of the text area.
  • When size is omitted, it dynamically adaptes to fit the content.
  • The alignment is one of 'L', 'C', 'R' and is mandatory.
Example:
[CUSTOM_DIALOG_COLUMNS, "50 L, 0.75 L 5, C", FALSE]
Here we define three columns and forbid softbreaks. How the dialog renders the text?
  • When a text line contains "\t" characters, these segmentate the text line into columns.
  • When a text segment is too large for staticly defined column, it continues in the next column.
  • When softbreaks parameter is TRUE, a text segment which is too large for a column is broken in lines which remains in the same column.
  • When softbreaks is FALSE, the dialog shows a horizontal scroll bar when the text is too wide.
3. Metaoptions
These options define the behavior of the dialog and it's lifetime.
[CUSTOM_DIALOG_LIFE, integer time]
When time is positive, the viewer should clean the dialog away after the given time. The viewer may display the remaining time in the dialog window to warn the user.
[CUSTOM_DIALOG_REPLACE, string response]
When a dialog is replaced by an other dialog sent from the same device then the viewer should send the response string on the dialog channel to report this.
[CUSTOM_DIALOG_IGNORE_BUTTON, integer hide, string response]
This option allows to handle the ignore button.
  • When hide = TRUE, then the ignore button is hidden, the response parameter is then ignored.
  • When hide = FALSE, then the response parameter defines a string to be sent when the user presses the ignore button.
This option allows scripts to recognize pressing of the ignore button or hide it when it uses a menu button for same purpose.
4. Button symbols
This part is controlled by button names. The Idea: I'd like to show certain symbols together with the buttons text. Like this: "🔧 settings".
One can do this by using Unicode characters in the button text but I'd suggest to define the symbols logically: The button name should start with the symbol enclosed into curly bracket:
"{symbol}button name"
The symbol name can be a
  • Unicode character, e.g. "{🔧}settings",
  • Texture key to use,
  • Logical symbol name, e.g. "{CONFIG}settings".
It is up to the viewer to choose the symbol, its size, position, and the distance to the button text.
Note: When a button is pressed, the viewer will only send the button name but exclude the symbol definition. For example when button "{CONFIG}settings" is pressed, only "settings" is sent. This enforces the scripters to use button names the user will recognize even if the viewer not knows how to show the button symbols.
Following symbol names should be defined:
OK, CANCEL, ABORT, STOP, YES, NO, IGNORE, UNDO, REDO, RETRY, HELP, INFO, OPTIONS, CONFIG, WHITELIST, BLACKLIST, CLOSE, EXIT.
The symbol names are strings, only known to the viewer. The server will not parse the button names for them. This list can be extended in future.