Difference between revisions of "LlInstantMessage"

From Second Life Wiki
Jump to navigation Jump to search
m (merged translator's notes which was in Japanese page)
(Replaced <source> with <syntaxhighlight>, added haiku, removed warning (it was nine years old!) and placed it on footnotes instead, fixed a few links...)
 
(27 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{LSL_Function/avatar|user}}{{LSL_Function
{{LSL_Function
|inject-2={{Issues/SVC-92}}{{LSL_Function/avatar|user}}{{LSL_Function/chat||message}}
|func_id=118|func_sleep=2.0|func_energy=10.0
|func_id=118|func_sleep=2.0|func_energy=10.0
|func=llInstantMessage
|func=llInstantMessage
|p1_type=key|p1_name=user|p1_desc
|p1_type=key|p1_name=user|p1_desc
|p2_type=string|p2_name=message|p2_desc
|p2_type=string|p2_name=message|p2_desc
|func_desc=Sends an Instant Message specified in the string '''message''' to the user specified by '''key'''.
|func_desc=Sends an Instant Message specified in the [[string]] {{LSLP|message}} to the user specified by {{LSLP|user}}.
|func_footer=To send a message directly to an [[object]], use [[llRegionSayTo]].
|return_text
|return_text
|spec
|spec
|caveats=**For applications where this is problematic, it's possible to place the call to llInstantMessage in a child script and pass the information to that script via [[llMessageLinked]].
|caveats=
*The message sent can not be longer than 1024 bytes. It will be truncated if it is greater than that.
* All [[object]] IMs are throttled at a maximum of 2500 per 30mins, per owner, per [[region]], in a rolling window. This includes IMs sent after the throttle is in place.
*The message shows up in the chat window. The message is not logged as part of the InstantMessage logging facility.  
** Throttled IMs are dropped. for implementation see [[llInstantMessage#Notes|notes]] below.
|examples=Tell the owner somebody touched the object:
* Messages longer than 1023 bytes will be truncated to 1023 bytes{{Footnote|As of Feb 26th, 2013, in all sims, instant messages are now truncated to 1023 bytes to prevent certain types of delivery failure. (See [https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/13#13.02.15.270481 Release Notes for Second Life Server 13.02.15.270481]).}}. This can convey 1023 ASCII characters, or fewer{{Footnote|Around 512 UTF-8 characters such as '''á'''.}} if non-ASCII characters are present.
<lsl>// This particular example is for demonstration only.
// Use llOwnerSay() for the same functionality, in case the owner is known to be the same Region.


key owner;
*If the specified user is logged in, {{LSLP|message}} will appear in the chat window and will not logged by the InstantMessage logging facility.
*If the specified user is not signed in, the messages will be delivered to their email just like a regular instant message, if the user has enabled email for their account.
** If messages are sent to the same user by the same object within about 65 seconds, they will be bundled together in a single email.


|examples=Tell the owner somebody touched the object:
<syntaxhighlight lang="lsl2">
default
default
{
{
    on_rez(integer start_param)
     touch_start( integer total_num )
    {
        owner=llGetOwner();  // get the key of the objects owner.
    }
     touch_start(integer total_num)
     {         
     {         
         llInstantMessage(owner,llKey2Name(owner)+", " + (string)total_num +" Avatar(s) touched me!");
         llInstantMessage( llGetOwner(), "Someone touched me" );
     }
     }
}</lsl>
}</syntaxhighlight>
Send a confirmation to the Avatar that touches an object without spamming other Avatars:
Send an IM to a detected avatar only
<lsl>default
<syntaxhighlight lang="lsl2">
default
{
{
     touch_start(integer total_num)
     touch_start( integer total_num )
     {      
     {
         llInstantMessage(llDetectedKey(0),"You have been registered!");
         llInstantMessage( llDetectedKey(0), "Hands Off!");
     }
     }
}</lsl>
}
</syntaxhighlight>
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llOwnerSay]]|}}
{{LSL DefineRow||[[llOwnerSay]]|Sends chat region wide to owner}}
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
{{LSL DefineRow||[[llRegionSayTo]]|Sends chat region wide to a specific prim/avatar}}
{{LSL DefineRow||[[llWhisper]]|Sends chat limited to 10 meters}}
{{LSL DefineRow||[[llWhisper]]|Sends chat limited to 10 meters}}
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
Line 45: Line 48:
|also_articles
|also_articles
|also_events
|also_events
|notes=Instant Messaging has the benefit of allowing communication from an object to an avatar anywhere in the Grid. The downside is that an object cannot receive an Instant Message, therefore an avatar cannot send an Instant Message to an object. It's a one-way communication avenue. Also, the two-second script delay can be considered a downside in some applications.
|notes=
* [[llRegionSayTo]] may be a better choice if the target is in the same region as the object sending the message, as it has no built-in delay and can communicate directly with objects, as well as with avatars and their attachments.
* Instant Messaging allows communication from an object to an avatar anywhere on the Grid. However, an object cannot receive an Instant Message.
* Using [[llInstantMessage]] from one or more child scripts will avoid delays in the main script. Child scripts will still be subject to delays, [[LSL Event Queue|message queue]] limits, and region throttles.
* Throttling Implementation (Kelly Linden):
** The throttle is on all IMs from the object owner. It does not disable all IMs in the region, but does disable all IMs from the owner of the object.
** The throttle is not per object, but per owner. Splitting the spamming object into multiple objects will not help unless owned by different people. This also means that owning multiple almost too spammy objects will cause you to hit the limit.
** 2500 IMs in 30 minutes will trigger the block.
** IMs that are blocked continue to count against the throttle. The IM count must drop below 2500 before any IMs will be delivered.
** The IM count of the previous window is used to approximate the rolling window. If it is 20% into the current window the IM count will be the current count + 80% of the previous count. This allows us to approximate a rolling average, however it has the behavior that a flood of IMs can have an effect on the throttle for double the window length. This is why in practice the throttle behaves more like 5k in 1hr than 2.5k in 30min.
 
|haiku={{Haiku|Laggy neighborhood|An urgent, swift message sent|by the avatar}}
|cat1=Communications
|cat1=Communications
|cat2=Instant Message
|cat2=Instant Message

Latest revision as of 11:52, 30 April 2022

Summary

Function: llInstantMessage( key user, string message );
2.0 Forced Delay
10.0 Energy

Sends an Instant Message specified in the string message to the user specified by user.

• key user avatar UUID
• string message message to be transmitted

To send a message directly to an object, use llRegionSayTo.

Caveats

  • This function causes the script to sleep for 2.0 seconds.
  • All object IMs are throttled at a maximum of 2500 per 30mins, per owner, per region, in a rolling window. This includes IMs sent after the throttle is in place.
    • Throttled IMs are dropped. for implementation see notes below.
  • Messages longer than 1023 bytes will be truncated to 1023 bytes[1]. This can convey 1023 ASCII characters, or fewer[2] if non-ASCII characters are present.
  • If the specified user is logged in, message will appear in the chat window and will not logged by the InstantMessage logging facility.
  • If the specified user is not signed in, the messages will be delivered to their email just like a regular instant message, if the user has enabled email for their account.
    • If messages are sent to the same user by the same object within about 65 seconds, they will be bundled together in a single email.

Examples

Tell the owner somebody touched the object:

default
{
    touch_start( integer total_num )
    {        
        llInstantMessage( llGetOwner(), "Someone touched me" );
    }
}

Send an IM to a detected avatar only

default
{
    touch_start( integer total_num )
    {
        llInstantMessage( llDetectedKey(0), "Hands Off!");
    }
}

Notes

  • llRegionSayTo may be a better choice if the target is in the same region as the object sending the message, as it has no built-in delay and can communicate directly with objects, as well as with avatars and their attachments.
  • Instant Messaging allows communication from an object to an avatar anywhere on the Grid. However, an object cannot receive an Instant Message.
  • Using llInstantMessage from one or more child scripts will avoid delays in the main script. Child scripts will still be subject to delays, message queue limits, and region throttles.
  • Throttling Implementation (Kelly Linden):
    • The throttle is on all IMs from the object owner. It does not disable all IMs in the region, but does disable all IMs from the owner of the object.
    • The throttle is not per object, but per owner. Splitting the spamming object into multiple objects will not help unless owned by different people. This also means that owning multiple almost too spammy objects will cause you to hit the limit.
    • 2500 IMs in 30 minutes will trigger the block.
    • IMs that are blocked continue to count against the throttle. The IM count must drop below 2500 before any IMs will be delivered.
    • The IM count of the previous window is used to approximate the rolling window. If it is 20% into the current window the IM count will be the current count + 80% of the previous count. This allows us to approximate a rolling average, however it has the behavior that a flood of IMs can have an effect on the throttle for double the window length. This is why in practice the throttle behaves more like 5k in 1hr than 2.5k in 30min.

See Also

Functions

•  llOwnerSay Sends chat region wide to owner
•  llRegionSay Sends chat region wide
•  llRegionSayTo Sends chat region wide to a specific prim/avatar
•  llWhisper Sends chat limited to 10 meters
•  llSay Sends chat limited to 20 meters
•  llShout Sends chat limited to 100 meters

Deep Notes

Footnotes

  1. ^ As of Feb 26th, 2013, in all sims, instant messages are now truncated to 1023 bytes to prevent certain types of delivery failure. (See Release Notes for Second Life Server 13.02.15.270481).
  2. ^ Around 512 UTF-8 characters such as á.

Signature

function void llInstantMessage( key user, string message );

Haiku

Laggy neighborhood
An urgent, swift message sent
by the avatar