Difference between revisions of "LlInstantMessage"

From Second Life Wiki
Jump to navigation Jump to search
m (Clarify use of child script for delay avoidance)
m (~caveats ~examples)
Line 9: Line 9:
|return_text
|return_text
|spec
|spec
|caveats=**For applications where this is problematic, [[llRegionSayTo]] can message the targeted agent directly with no delay, provided they are in the same region as the scripted object. For cross-region applications, the call to llInstantMessage can be placed in a child script, with information passed to that script via [[llMessageLinked]]. Then the script instigating the communication suffers no delay, only the slave child script is subjected to the 2 second delay.
|caveats=
** Using [[llInstantMessage]] from one or more child scripts will prevent delays in the main script.
*** Child scripts will still be subject to delays, message queue limits, and region throttles.
* All object IM's are throttled at >2500 per 30mins, per owner, per region in a rolling window. this includes IM's sent after the throttle is in place
* All object IM's are throttled at >2500 per 30mins, per owner, per region in a rolling window. this includes IM's sent after the throttle is in place
** Throttled IM's are dropped. for implementation see [[llInstantMessage#notes|notes]] below
** Throttled IM's are dropped. for implementation see [[llInstantMessage#notes|notes]] below
*{{LSLP|message}} will be truncated if it exceeds 1199 bytes.
*{{LSLP|message}} will be truncated if it exceeds 1199 bytes.
*{{LSLP|message}} will appear in the chat window and will not logged by the InstantMessage logging facility. (If a the specified user is not signed it, the messages will be delivered to their email just like a regular instant message, if the user has enabled email for their account.)
*{{LSLP|message}} will appear in the chat window and will not logged by the InstantMessage logging facility. (If a the specified user is not signed it, the messages will be delivered to their email just like a regular instant message, if the user has enabled email for their account.)
{{LSL Tip| If target avatars will be in the script obejcts region, use [[llRegionSayTo]] instead, to prevent script delays.}}
|examples=Tell the owner somebody touched the object:
|examples=Tell the owner somebody touched the object:
<lsl>
<lsl>
default
default
{
{
     touch_start(integer total_num)
     touch_end( integer total_num )
     {         
     {         
         llInstantMessage(llGetOwner(), (string)total_num + " Avatar(s) touched me simultaneously!");
         llInstantMessage( llGetOwner(), (string)total_num + " Avatar(s) touched me!" );
     }
     }
}</lsl>
}</lsl>
Line 26: Line 29:
<lsl>default
<lsl>default
{
{
     touch_start(integer total_num)
     touch_end( integer total_num )
     {      
     {
         llInstantMessage(llDetectedKey(0), "You have been registered!");
         do
        {
            llInstantMessage( llDetectedKey( --total_num ), "You have been registered!" );
        }
        while (total_num);
     }
     }
}</lsl>
}</lsl>

Revision as of 09:39, 5 January 2013

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.
    • Using llInstantMessage from one or more child scripts will prevent delays in the main script.
      • Child scripts will still be subject to delays, message queue limits, and region throttles.
  • All object IM's are throttled at >2500 per 30mins, per owner, per region in a rolling window. this includes IM's sent after the throttle is in place
    • Throttled IM's are dropped. for implementation see notes below
  • message will be truncated if it exceeds 1199 bytes.
  • message will appear in the chat window and will not logged by the InstantMessage logging facility. (If a the specified user is not signed it, the messages will be delivered to their email just like a regular instant message, if the user has enabled email for their account.)
KBcaution.png Important: If target avatars will be in the script obejcts region, use llRegionSayTo instead, to prevent script delays.

Examples

Tell the owner somebody touched the object: <lsl> default {

   touch_end( integer total_num )
   {        
       llInstantMessage( llGetOwner(), (string)total_num + " Avatar(s) touched me!" );
   }

}</lsl> Send a confirmation to the Avatar that touches an object without spamming other Avatars: <lsl>default {

   touch_end( integer total_num )
   {
       do
       {
           llInstantMessage( llDetectedKey( --total_num ), "You have been registered!" );
       }
       while (total_num);
   }
}</lsl>

Notes

  • For many applications llRegionSayTo may be a better choice, as it has no built-in delay and can communicate directly with objects as well as avatars. The only notable limitation is that it requires the target to be in the same region as the scripted object.
  • 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.
  • 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

Signature

function void llInstantMessage( key user, string message );