llMessageLinked(integer linknum, integer num, string str, key id)
, and id
(the specific prim
in the linked set
can be the link number of the desired prim (use llGetLinkNumber
to get the prim's link number containing the script
) or one of the constants
for linked sets.
| Constant || Value || Description |
| LINK_ROOT || 1 || root prim in linked set (but not in a single prim, which is 0) |
| LINK_SET || -1 || all prims in object |
| LINK_ALL_OTHERS || -2 || all other prims in object besides prim function is in |
| LINK_ALL_CHILDREN || -3 || all child prims in object |
| LINK_THIS || -4 || prim script is in|
In objects with only 1 prim, linknum
. In objects with multiple prims, the linknum
count starts at 1
. (So in a 2-prim object, llGetLinkNumber
would return 1
in the parent
in the child.
can be any valid integer
may be blank, (""
) or as long as desired. str
are only limited by the amount of available memory
- Because id is a key, and keys are just special strings, it can be typecast to a string (see hacks).
- Multiple attachments worn by the same avatar can't communicate using llMessageLinked. (Attachments are still treated as individual objects.) The only way attachments can communicate with each other is via email or chat, chat obviously being the faster and less resource-intensive of the two options. Multiple scripts are still able to communicate within a single attachment, of course.
triggers the link_message event
handler in scripts receiving link messages
Q: I don't get it. Why not just use chat?
A: Aside from the fact that an object can't listen to itself, link messages are much faster than using chat functions as well as being private. They're higher-capacity, avoiding chat's 255-character limitations. Also, if you tend to have memory overflow problems in a single script, you can use link messages to communicate between scripts in the same prim, thus enabling separate storage or even pseudo-multithreading.
Q: What is the length of the penalty on llSay, etc?
A: There is no delay on any of the llMessageLinked, llSay, llWhisper, or llShout functions. The "delay" is in the event queuing for the receiving event, which is affected by the sims performance at that given time. The speed ranges from llMessageLinked being the fastest as it's internal, to llShout being the slowest as it causes the most sim performance hit since it's external to all prims within a 100m range.
Q: Can I use llMessageLinked to send a message within only one script?
A: Yes, though there are better ways to communicate within a single script. Note that your link_message event will trigger on all link messages the prim receives, so your script may end up talking to itself if you're not careful.
Q: Do I need to specify a value for num, str, and id, or can I use a null string or key?
A: No, you can give llMessageLinked empty values of 0, "" and NULL_KEY, respectively.
Q: Can I use link messages to communicate between two attachments, or an attachment and the object the avatar is sitting on?
A: No, they're not truly linked in this case. You'll need to use chat instead.