Difference between revisions of "LlInstantMessage"

From Second Life Wiki
Jump to navigation Jump to search
(more specific regarding avoiding script delay)
m (<lsl> examples)
Line 9: Line 9:
|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=**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]].
*The message sent can not be longer than 1024 bytes.
*The message sent can not be longer than 1024 bytes.
|examples=
|examples=Tell the owner somebody touched the object:
Tell the owner somebody touched the object:
<lsl>key owner;
<pre>
key owner;
 
default {


default
{
     on_rez(integer start_param)
     on_rez(integer start_param)
     {
     {
Line 24: Line 22:
         llInstantMessage(owner,llKey2Name(owner)+", " + (string)total_num +" Avatar(s) touched me!");
         llInstantMessage(owner,llKey2Name(owner)+", " + (string)total_num +" Avatar(s) touched me!");
     }
     }
}
}</lsl>
</pre>
Send a confirmation to the Avatar that touches an object without spamming other Avatars:
Send a confirmation to the Avatar that touches an object without spamming other Avatars:
<pre>
<lsl>default
 
{
default {
 
     touch_start(integer total_num)
     touch_start(integer total_num)
     {         
     {         
         llInstantMessage(llDetectedKey(0),"You have been registered!");
         llInstantMessage(llDetectedKey(0),"You have been registered!");
     }
     }
}
}</lsl>
</pre>
 
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 18:33, 2 January 2008

Summary

Function: llInstantMessage( key user, string message );

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

• key user
• string message

Caveats

  • This function causes the script to sleep for 2.0 seconds.
    • 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.
  • The message sent can not be longer than 1024 bytes.
All Issues ~ Search JIRA for related Bugs

Examples

Tell the owner somebody touched the object: <lsl>key owner;

default {

   on_rez(integer start_param)
   {
       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!");
   }

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

   touch_start(integer total_num)
   {        
       llInstantMessage(llDetectedKey(0),"You have been registered!");
   }
}</lsl>

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.

See Also

Functions

•  llOwnerSay
•  llRegionSay Sends chat region wide
•  llWhisper Sends chat limited to 10 meters
•  llSay Sends chat limited to 20 meters
•  llShout Sends chat limited to 100 meters

Deep Notes

Search JIRA for related Issues

Signature

function void llInstantMessage( key user, string message );