Difference between revisions of "LlRegionSayTo"

From Second Life Wiki
Jump to navigation Jump to search
(Revert the previous change and fix it the right way)
m (Replaced <source> with <syntaxhighlight> and added several WikiSyntax enhancements)
Line 10: Line 10:
|p2_type=integer|p2_name=channel
|p2_type=integer|p2_name=channel
|p3_type=string|p3_name=msg
|p3_type=string|p3_name=msg
|func_desc=Says the text supplied in string {{LSLP|msg}} on channel supplied in integer {{LSLP|channel}} to the object or avatar specified by {{LSLP|target}}
|func_desc=Says<ref name="send">In this context, ''saying'' or ''speaking'' means that a message is being ''sent'' to the recipient (object or avatar); it's not about audio/voice chat!</ref> the text supplied in string {{LSLP|msg}} on channel supplied in [[integer]] {{LSLP|channel}} to the [[object]] or [[avatar]] specified by {{LSLP|target}}
|return_text
|return_text
|spec
|spec
|caveats=
|caveats=
*Text is spoken directly to the object or avatar within the same region as the script.
*Text is spoken<ref name="send" /> directly to the [[object]] or [[avatar]] within the same [[region]] as the [[script]].
*Scripts in tasks other than {{LSLP|target}} can not listen for and receive these text messages, with an exception for attachments as described below.
*Script in tasks other than {{LSLP|target}} can neither listen for<ref>In this context, this means waiting to ''receive'' a message.</ref>, nor receive these text messages, with an exception for attachments as described below.
*Text can be a maximum of 1024 bytes. This can convey 1024 ASCII-7 characters, or 512 UTF-8 characters such as á
*Text can be a maximum of 1024 bytes. This can convey 1024 ASCII-7 characters, or 512 UTF-8 characters such as á
*A prim cannot hear itself, to prevent problems with recursion.
*A [[prim]] cannot hear itself, to prevent problems with recursion.
*Sending text on {{LSLP|DEBUG_CHANNEL}} is not supported
*Sending text on {{LSLP|DEBUG_CHANNEL}} is not supported.
*Text sent to an avatar's ID on channel zero will be sent to the receiver's viewer.
*Text sent to an avatar's [[UUID|ID]] on channel [[PUBLIC_CHANNEL|zero]] will be sent to the receiver's viewer.
*Text sent to an avatar's ID on non-zero channels can be heard by any attachment on the avatar
*Text sent to an avatar's ID on non-zero channels can be heard<ref>I.e., ''received''</ref> by any attachment on the avatar.
*A quick series of messages sent by llRegionSayTo cannot be relied on to arrive at their destination in the same order as sent.
*A quick series of messages sent by [[llRegionSayTo]] cannot be relied on to arrive at their destination in the same order as sent.
*There is a per-destination throttle of 200 messages sent over 10 seconds on channel zero.  Thereafter, there is also a per-sending-object throttle of 100 messages on channel zero over 300 seconds (5 minutes).  This throttle is relevant only after the first throttle is activated.  Messages sent on channels other than zero do not trigger the throttle but, once it is triggered, the block applies to all channels. The block is region-wide and applies to all objects with the same owner. The block apparently lasts until the region is restarted.
*There is a per-destination throttle of 200 messages sent over 10 seconds on channel [[PUBLIC_CHANNEL|zero]].  Thereafter, there is also a per-sending-object throttle of 100 messages on channel zero over 300 seconds (5 minutes).  This throttle is relevant only after the first throttle is activated.  Messages sent on channels other than zero do not trigger the throttle but, once it is triggered, the block applies to ''all'' channels. The block is region-wide and applies to all objects with the same [[:Category:LSL_Owner|owner]]. The block apparently lasts until the region is restarted.
|examples=
|examples=
<source lang="lsl2">
<syntaxhighlight lang="lsl2">
default
default
{
{
Line 39: Line 39:
     }
     }
}
}
</source>
</syntaxhighlight>
|helpers
|helpers
|also_events=
|also_events=
Line 48: Line 48:
{{!}}-
{{!}}-
{{!}}{{!}}{{!}} style="width:9em;" {{!}}
{{!}}{{!}}{{!}} style="width:9em;" {{!}}
{{LSL DefineRow||[[llListen]]|Ask for listen events}}
{{LSL DefineRow||[[llListen]]|Ask for [[listen]] events}}
{{LSL DefineRow||[[llInstantMessage]]|Sends chat to a specific avatar, inside our outside the current region.}}
{{LSL DefineRow||[[llInstantMessage]]|Sends chat to a specific avatar, inside or outside the current region.}}
{{LSL DefineRow||[[llOwnerSay]]|Sends chat to the owner only to avoid spamming the PUBLIC_CHANNEL}}
{{LSL DefineRow||[[llOwnerSay]]|Sends chat to the owner only to avoid spamming the [[PUBLIC_CHANNEL]]}}
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
Line 58: Line 58:
|also_articles={{LSL DefineRow||[[Hello Avatar]]}}
|also_articles={{LSL DefineRow||[[Hello Avatar]]}}
|notes=
|notes=
* If one object 'says' something to another object (''e.g''., a button that, when touched, turns on a lamp), it is a good idea to use a very negative channel, ''e.g.'',
* If one object 'says'<ref name="send" /> something to another object (''e.g.'', a button that, when touched, turns on a lamp), it is a good idea to use a very negative {{LSLP|channel}}<ref>This should be considered as an idiomatic way of programming in [[LSL]]; scripters will 'know' that negative channels are usually ''not'' meant for ''users'' to type, but only as a way for objects to communicate among themselves.</ref>, ''e.g.'',
<source lang="lsl2">
:<syntaxhighlight lang="lsl2">llRegionSayTo("55499a64-45c3-4b81-8880-8ffb5a7c251b", -5243212, "turn on");</syntaxhighlight>
    llRegionSayTo("55499a64-45c3-4b81-8880-8ffb5a7c251b", -5243212, "turn on");
:Negative channels are popular for script communications because, before September 2016, the standard Second Life Viewer was unable to chat directly on those channels (<kbd>/-xxxx message</kbd> wouldn't chat {{mono|message}} on {{LSLPT|channel}} {{mono|-xxxx}}).  
</source>
* Messages sent on channel zero via [[llRegionSayTo]]() are blocked after 200 messages on to the same destination in a 10 second period.  After this throttle is activated, there is a further throttle, on objects belonging to the owner of the object that triggered the first throttle, of 100 messages per object over 5 minutes (see {{Jira|BUG-5457}}). The block is region-wide and applies to all objects belonging to the owner, so if a script triggers the throttle, all objects in the same region belonging to the same owner will also be blocked. Messages sent on channels other than zero do not trigger the throttles.  The throttles apparently reset only when the region is restarted.  
Negative channels are popular for script communications because, before September 2016, the standard Second Life client was unable to chat directly on those channels ("/-xxxx message" wouldn't chat "message" on channel "-xxxx").  
* Messages sent on channel zero via LLRegionSayTo() are blocked after 200 messages on to the same destination in a 10 second period.  After this throttle is activated, there is a further throttle, on objects belonging to the owner of the object that triggered the first throttle, of 100 messages per object over 5 minutes (see https://jira.secondlife.com/browse/BUG-5457). The block is region-wide and applies to all objects belonging to the owner, so if a script triggers the throttle, all objects in the same region belonging to the same owner will also be blocked. Messages sent on channels other than zero do not trigger the throttles.  The throttles apparently reset only when the region is restarted.  


Therefore, llRegionSayTo() is unsuitable for (say) verbose script debugging, and even moderate use can break users' content completely unrelated to the script for an indeterminate (and potentially very long) period of time.  Consider using llOwnerSay() for debugging instead or, if this not appropriate, try llRegionSayTo(avatar, non-zero-channel, message) and have an attachment relay the message using llOwnerSay().  
Therefore, [[llRegionSayTo]]() is unsuitable for (say) verbose script debugging, and even moderate use can break users' content completely unrelated to the script for an indeterminate (and potentially very long) period of time.  Consider using [[llOwnerSay]]() for debugging instead or, if this is not appropriate, try {{mono|llRegionSayTo(avatar, non-zero-channel, message)}} and have an attachment relay the message using [[llOwnerSay]]().  
|cat1
|cat1
|cat2
|cat2

Revision as of 10:25, 3 February 2023

Summary

Function: llRegionSayTo( key target, integer channel, string msg );
0.0 Forced Delay
10.0 Energy

Says[1] the text supplied in string msg on channel supplied in integer channel to the object or avatar specified by target

• key target avatar or prim UUID that is in the same region
• integer channel
• string msg

Caveats

  • Text is spoken[1] directly to the object or avatar within the same region as the script.
  • Script in tasks other than target can neither listen for[2], nor receive these text messages, with an exception for attachments as described below.
  • Text can be a maximum of 1024 bytes. This can convey 1024 ASCII-7 characters, or 512 UTF-8 characters such as á
  • A prim cannot hear itself, to prevent problems with recursion.
  • Sending text on DEBUG_CHANNEL is not supported.
  • Text sent to an avatar's ID on channel zero will be sent to the receiver's viewer.
  • Text sent to an avatar's ID on non-zero channels can be heard[3] by any attachment on the avatar.
  • A quick series of messages sent by llRegionSayTo cannot be relied on to arrive at their destination in the same order as sent.
  • There is a per-destination throttle of 200 messages sent over 10 seconds on channel zero. Thereafter, there is also a per-sending-object throttle of 100 messages on channel zero over 300 seconds (5 minutes). This throttle is relevant only after the first throttle is activated. Messages sent on channels other than zero do not trigger the throttle but, once it is triggered, the block applies to all channels. The block is region-wide and applies to all objects with the same owner. The block apparently lasts until the region is restarted.

Examples

default
{
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);

        // send a message to the chat window of the avatar touching
        llRegionSayTo(id, 0, "You touched this!");

        // send a message to the attachments of the avatar touching
        // example channel: -12345
        llRegionSayTo(id, -12345, "Hello there attachments!");
    }
}

Notes

  • If one object 'says'[1] something to another object (e.g., a button that, when touched, turns on a lamp), it is a good idea to use a very negative channel[4], e.g.,
llRegionSayTo("55499a64-45c3-4b81-8880-8ffb5a7c251b", -5243212, "turn on");
Negative channels are popular for script communications because, before September 2016, the standard Second Life Viewer was unable to chat directly on those channels (/-xxxx message wouldn't chat message on channel -xxxx).
  • Messages sent on channel zero via llRegionSayTo() are blocked after 200 messages on to the same destination in a 10 second period. After this throttle is activated, there is a further throttle, on objects belonging to the owner of the object that triggered the first throttle, of 100 messages per object over 5 minutes (see BUG-5457). The block is region-wide and applies to all objects belonging to the owner, so if a script triggers the throttle, all objects in the same region belonging to the same owner will also be blocked. Messages sent on channels other than zero do not trigger the throttles. The throttles apparently reset only when the region is restarted.

Therefore, llRegionSayTo() is unsuitable for (say) verbose script debugging, and even moderate use can break users' content completely unrelated to the script for an indeterminate (and potentially very long) period of time. Consider using llOwnerSay() for debugging instead or, if this is not appropriate, try llRegionSayTo(avatar, non-zero-channel, message) and have an attachment relay the message using llOwnerSay().

See Also

Events

•  listen Receives chat

Functions

•  llListen Ask for listen events
•  llInstantMessage Sends chat to a specific avatar, inside or outside the current region.
•  llOwnerSay Sends chat to the owner only to avoid spamming the PUBLIC_CHANNEL
•  llRegionSay Sends chat region wide
•  llSay Sends chat limited to 20 meters
•  llShout Sends chat limited to 100 meters
•  llWhisper Sends chat limited to 10 meters

Articles

•  Hello Avatar

Deep Notes

History

Date of Release 26/04/2011

Signature

function void llRegionSayTo( key target, integer channel, string msg );
  1. 1.0 1.1 1.2 In this context, saying or speaking means that a message is being sent to the recipient (object or avatar); it's not about audio/voice chat!
  2. In this context, this means waiting to receive a message.
  3. I.e., received
  4. This should be considered as an idiomatic way of programming in LSL; scripters will 'know' that negative channels are usually not meant for users to type, but only as a way for objects to communicate among themselves.