llInstantMessage(key user, string message)

Sends an IM to user containing message and delays the script for 2 seconds. This delay exists to prevent IM spamming.

To message the object owner, llOwnerSay(messsage) is the best option as it does not delay the script.
To send a short message in a popup dialog box, consider using llDialog instead.

Objects can send, but not receive IMs. See communications for methods for communicating with other scripts.

This call does not open a separate tab in the IM window as user-to-user IMs do. Instead, it prints to the chat history but is a private message that other agents within close range do not receive.

If the user has configured their account to send offline IMs to email, (Edit > Preferences > General, check “Send IM to E-mail”) they will get offline messages sent to their email account. When the user logs in, they will recieve the message text. This will be the case regardless of whether or not they have the “Send IM to E-mail” option turned on.

Note: If message exceeds 1023 bytes (excluding null), it will be truncated. String length can be determined with llStringLength.

For a multi-line message, use new lines:
“This is on one line.\nThis is on another line.”
However, bear in mind that this will display as a single line if the chat history window is closed, but will show up appropriately if it’s open.

Example:

// when touched, IM the owner with the name of the touching agent
default {
    touch_start(integer num_detected) {
        llInstantMessage(llGetOwner(), llDetectedName(0) + " touched me.");
    }
}

llInstantMessage has a built-in delay of 2 seconds. If you’re communicating with the object’s owner and the communications can be limited to a single sim, (IE, if it’s an attachment) you can replace llInstantMessage(llGetOwner(),message) with llOwnerSay(message) without any delay. If communicating with other users, you might consider using llMessageLinked in your main script and having a second script actually send the instant messages.  The time penalty can be worked around by using link messages and to send IMs. Cycling through these allows for very short delays, decreasing with the number of scripts in the cycle. However, abusing this for TOS violations can lead to a warning/suspension/banning.

Compare with llOwnerSay, llWhisper, llSay, llShout, and llMessageLinked