Skip to content
lsl.devlsl.devLSL Dev

llTextBox

function
Function syntax
llTextBox(
  1. key agent,// UUID of the agent in the same region.
  2. string msg,// Text message to display in the text box.
  3. integer channel// Output chat channel (any 32-bit signed integer value) where the input text is chatted. Values: Channel
);
Energy
10

Opens an input text box dialog displaying msg to the agent. Submitting text chats the input string on channel as if said by the agent. The chat originates at the object's position, but uses the agent's name and UUID, so it can be heard as long as the agent is still in the region.

Shows a dialog box on avatar’s screen with the text message. It contains a text box for input, any text that is entered is said by avatar on channel when the “Submit” button is clicked.

How to use
llTextBox(NULL_KEY, "", 0);
  • Not supported in official Linden Lab viewers prior to version 2.4, and some TPVs may not support it. Unsupported viewers will display a dialog box with a single option of ”!!llTextBox!!”.
  • There is no way by script to kill a text 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).
  • If the listening prim is out of the 20 meter range of the sending prim when the “Submit” button is pressed, it will not be able to hear the response.
  • This limitation affects attachments too if the wearer moves more than 20 meters from where the listener is located.
  • The textbox input is limited to 250 bytes (characters). This can be a problem for larger text input; if the input can be over 250 characters, you will have to accept it through chat.
  • There is an undocumented throttle on llTextBox requests. Exceeding it will shout an error on DEBUG_CHANNEL until the “average” falls.
  • If it exceeds 7 (Viewer 3) or 8 (Viewer 1) 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. One easy way to create an empty message is to use a line feed, as in

    llTextBox(avatar_key," \n",dialog_channel);
Example 1
7 collapsed lines
integer gListener;
default
{
touch_start(integer total_number)
{
// See 'discussion' page for more comments on choosing a channel and possible left-open listener
integer channel = -13572468;
// "" saves byte-code over NULL_KEY
gListener = llListen( channel, "", "", "");
llTextBox(llDetectedKey(0), "Some info text for the top of the window...", channel);
}
listen(integer channel, string name, key id, string message)
5 collapsed lines
{
llListenRemove(gListener);
llSay(0, "You wrote: " + message);
}
}
If the user hits Enter before clicking the "Submit" button, there will be a final carriage return in the message. In the rare event that this could be a problem, it is easily removed:
message = llStringTrim(message,STRING_TRIM);

Introduced in SVN:568 r88085 Trunk Wednesday, 21 May 2008

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.