Difference between revisions of "Link Messages"
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
</lsl></pre> | </lsl></pre> | ||
=====Script to | =====Script to Receive the Message ([[LSL_llSetText|llSetText]])===== | ||
<pre><lsl> | <pre><lsl> | ||
default | default | ||
Line 20: | Line 20: | ||
link_message(integer Sender, Integer Number, string Text, key ID) | link_message(integer Sender, Integer Number, string Text, key ID) | ||
{ | { | ||
llOwnerSay("Message received from prim number " + (string)Sender + " within this linkset. The Message is the number " + (string)Number + ", the message " + Text + ", and the key of the avatar " + llKey2Name(ID) "."); | llOwnerSay("Message received from prim number " + (string)Sender + " within this linkset. The Message is the number " + (string)Number + ", the message " + Text + ", and the key of the avatar " + llKey2Name(ID) "."); //When this prim receives a message, say to the owner what it received. | ||
} | } | ||
} | } | ||
</lsl></pre> | </lsl></pre> |
Revision as of 12:15, 12 February 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Link Messages
Link Messages are used to communicate between 2(or more) prims in the same linkset, or even between 2 (or more) scripts within the same prim. This is just a brief example of how to use them
Script to Send a Message (llSetText)
<lsl> default { touch_start(integer touched) { llMessageLinked(LINK_SET, 0, "touched", llDetectedKey(0)); //When someone touches this, send the message "touched", the number 0 and the avatar who touched this prim's key to all scripts in this linkset. } } </lsl>
Script to Receive the Message (llSetText)
<lsl> default { link_message(integer Sender, Integer Number, string Text, key ID) { llOwnerSay("Message received from prim number " + (string)Sender + " within this linkset. The Message is the number " + (string)Number + ", the message " + Text + ", and the key of the avatar " + llKey2Name(ID) "."); //When this prim receives a message, say to the owner what it received. } } </lsl>