Difference between revisions of "LlTextBox"

From Second Life Wiki
Jump to navigation Jump to search
Line 2: Line 2:
|func_id=335|func_sleep=1.0|func_energy=10.0
|func_id=335|func_sleep=1.0|func_energy=10.0
|func=llTextBox
|func=llTextBox
|mode=pre-release
 
|p1_type=key|p1_name=avatar|p1_desc
|p1_type=key|p1_name=avatar|p1_desc
|p2_type=string|p2_name=message|p2_desc=message to be displayed in the text box
|p2_type=string|p2_name=message|p2_desc=message to be displayed in the text box
Line 10: Line 10:
|func_desc=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 [[llSay|said]] on '''chat_channel''' when the "OK" button is clicked.
|func_desc=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 [[llSay|said]] on '''chat_channel''' when the "OK" button is clicked.
|func_footnote
|func_footnote
|caveats=* There is no way by script to kill a text box.
|caveats=* Not supported in official Linden Labs viewers prior to version 2.4, and some [[Third_Party_Viewer_Directory|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).
* 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 "OK" button is pressed, it will not be able to hear the response.
* If the listening prim is out of the 20 meter range of the sending prim when the "OK" button is pressed, it will not be able to hear the response.

Revision as of 19:46, 16 December 2010

Summary

Function: llTextBox( key avatar, string message, integer chat_channel );
1.0 Forced Delay
10.0 Energy

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 on chat_channel when the "OK" button is clicked.

• key avatar avatar UUID
• string message message to be displayed in the text box
• integer chat_channel output chat channel, any integer value
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.
  • Messages sent on channel zero[1] and DEBUG_CHANNEL are throttled to a rate of <200/10sec, per region, per owner/user.
    • Once the rate is exceeded, all following messages on channel zero or DEBUG_CHANNEL will be dropped until the send rate is again below 200/10sec for the previous 10 sec. Dropped messages, despite being dropped still count against the limit.
  • 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 "OK" 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 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.

Examples

<lsl>integer listener;

default {

   touch_start(integer total_number)
   {
       llListenRemove(listener);//A previous user may not have responded. Make sure we don't leak!
       integer channel = ~(integer)llFrand(1000.0);
       listener = llListen(channel,"","","");
       llTextBox(llDetectedKey(0),"Write something here...",channel);
   }
   
   listen(integer channel, string name, key id, string message)
   {
       llSay(0,"You wrote: " + message);
       llListenRemove(listener);
   }
}</lsl>

See Also

Events

•  listen

Functions

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

Deep Notes

History

Source

viewer - indra/llcommon/lllslconstants.h <cpp>// llTextBox() magic token string - yes this is a hack. sue me. const std::string TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";</cpp>

Footnotes

  1. ^ Channel zero is also known as: PUBLIC_CHANNEL, open chat, local chat and public chat

Signature

function void llTextBox( key avatar, string message, integer chat_channel );
<lsl></lsl>