From Second Life Wiki
Revision as of 23:05, 21 October 2012 by Nelson Jenkins (Talk | contribs)

Jump to: navigation, search


Function: llTextBox( key avatar, string message, integer channel );

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.

• key avatar avatar UUID that is in the same region
• string message message to be displayed in the text box
• integer channel output chat channel, any integer value
Channel Constant Description


  • This function causes the script to sleep for 1.0 seconds.
  • Not supported in official Linden Labs 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.

message limits

  • If it exceeds 7 (Viewer 3) or 8 (Viewer 1) lines a scroll bar will appear.
  • message must be less than or equal to 250 bytes (characters) and not empty. Previously this was 512 bytes, but it was quietly lowered client-side, so presumably the function can accept over 250 bytes server-side if you have a client that isn't limited. If the message is over 512 bytes or empty, it will shout an error on DEBUG_CHANNEL. One easy way to create an empty message is to use a line feed, as in <lsl>llTextBox(avatar_key," \n",dialog_channel);</lsl>
All Issues ~ Search JIRA for related Bugs


<lsl> integer listener;

// this is a user-function, it doesn't have a return type remove_listener() {



default {

   touch_start(integer total_number)
       key id = llDetectedKey(0);
       integer randomChannel = ~(integer)llFrand(1000.0);
       listener = llListen(randomChannel, "", NULL_KEY, "");
       llTextBox(id, "Some info text for the top of the window...", randomChannel);
       // PUBLIC_CHANNEL has the integer value 0
       llSay(PUBLIC_CHANNEL, "You wrote: " + message);

} </lsl> If the user hits "Enter" before clicking the "Submit" button, there will be a final carriage return in the message. This code removes it. <lsl> integer gLisn;

default {

   touch_start(integer num)
       gLisn = llListen(91,"","","");
       llTextBox(llDetectedKey(0),"Type a message and click \"Submit\".",91);
       integer i;
       for (i=0;i<llStringLength(msg);++i)
           if (llGetSubString(msg,i,i) == llUnescapeURL("%0A"))
               if (i == llStringLength(msg) -1) //Ignore carriage returns embedded in the message
                   msg = llGetSubString(msg, 0,-2);
                   llSay(0,"Final carriage return removed."); 




Instead of mouse clicking: "Submit", you can use keyboard keys: press Tab ⇆ and then Enter ↵

See Also


•  listen


•  llDialog
•  llListen
•  llSay
•  llWhisper
•  llShout
•  llRegionSay

Deep Notes


Search JIRA for related Issues


HG:viewer-release - indra/llcommon/lllslconstants.h (please use SourceLink/bitbucket instead, SourceLink is deprecated) <cpp>// llTextBox() magic token string - yes this is a hack. sue me. const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";</cpp>




function void llTextBox( key avatar, string message, integer channel );