Don't click here unless you want to be banned.

LSL Wiki : llMessageLinked

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llMessageLinked(integer linknum, integer num, string str, key id)

Sends num, str, and id to linknum (the specific prim in the linked set).

The value for linknum 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.

Constants

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 is 0. In objects with multiple prims, the linknum count starts at 1. (So in a 2-prim object, llGetLinkNumber would return 1 in the parent and 2 in the child.

num can be any valid integer. str and id may be blank, ("") or as long as desired. str and id are only limited by the amount of available memory.

Notes:

llMessageLinked triggers the link_message event handler in scripts receiving link messages.

Example:
See ExampleLinkMessage.

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. -- SiRiSAsturias

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.


Functions | Communications | Link
There are 13 comments on this page. [Display comments/form]