Difference between revisions of "LlMessageLinked"

From Second Life Wiki
Jump to navigation Jump to search
 
(added example and note cautioning about do loops)
Line 1: Line 1:
{{LSLFunctionAll|func_id=164|func_sleep=0.0|func_energy=10.0|func=llMessageLinked|p1_type=integer|p1_name=linknum|p2_type=integer|p2_name=num|p3_type=string|p3_name=str|p4_type=key|p4_name=id|func_footnote=Sends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,<br />LINK_SET sends to all tasks,<br />LINK_ALL_OTHERS to all other tasks,<br />LINK_ALL_CHILDREN to all children,<br />LINK_THIS to the task the script it is in)|return_text|spec|caveats|examples|helpers|related|also|notes}}[[Category:LSL_Functions]][[Category:LSL_Stub]]
{{LSLFunctionAll
|func_id=164
|func_sleep=0.0
|func_energy=10.0
|func=llMessageLinked
|p1_type=integer
|p1_name=linknum
|p2_type=integer
|p2_name=num
|p3_type=string
|p3_name=str
|p4_type=key
|p4_name=id
|func_footnote=Sends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,<br/>LINK_SET sends to all tasks,<br />LINK_ALL_OTHERS to all other tasks,<br/>LINK_ALL_CHILDREN to all children,<br />LINK_THIS to the task the script it is in)|return_text
|spec
|caveats
|examples=<lsl>
default{ // assumptions  // object name: LSLWiki // script name: _lslwiki
    state_entry() {
      llMessageLinked(LINK_THIS,0,llGetScriptName(),NULL_KEY)
    }
 
    link_message(integer sender_num, integer num, string msg, key id) {
      llOwnerSay(msg);
      // the owner of object LSLWiki will hear
      // LSLWiki:_lslwiki
    }   
}
</lsl>
|helpers
|related
|also
|notes=
<pre>
Using llMessageLinked in a single prim object allows developers to mitigate some LSL limits by,
breaking up functionality between cooperating scripts and synchronizing actions.
When you do this, be extremely careful not to create infite loops based a script reacting to a
linked message by sending a linked message, to which it reacts.
</pre>
}}
[[Category:LSL_Functions]]
[[Category:LSL_Stub]]

Revision as of 21:49, 11 February 2007

   Outdated templated used

Please change the template from 'LSLFunctionAll' to 'LSL_Function' (just replace 'LSLFunctionAll' with 'LSL_Function', do this after fixing any other erorr messages.

  Either 'func_desc' or 'return_type' & 'return_text' must be defined

(Please use 'return_text' & 'return_type' or 'func_desc' to summarize the functions actions.)

Summary

Function: llMessageLinked( integer linknum, integer num, string str, key id );
• integer linknum
• integer num
• string str
• key id

Sends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,
LINK_SET sends to all tasks,
LINK_ALL_OTHERS to all other tasks,
LINK_ALL_CHILDREN to all children,
LINK_THIS to the task the script it is in)

Examples

<lsl> default{ // assumptions // object name: LSLWiki // script name: _lslwiki

    state_entry() {
      llMessageLinked(LINK_THIS,0,llGetScriptName(),NULL_KEY)
    }
    link_message(integer sender_num, integer num, string msg, key id) {
      llOwnerSay(msg);
      // the owner of object LSLWiki will hear
      // LSLWiki:_lslwiki
    }    

}

</lsl>

Notes

Using llMessageLinked in a single prim object allows developers to mitigate some LSL limits by, 
breaking up functionality between cooperating scripts and synchronizing actions. 
When you do this, be extremely careful not to create infite loops based a script reacting to a 
linked message by sending a linked message, to which it reacts.

Deep Notes

Search JIRA for related Issues

Signature

function void llMessageLinked( integer linknum, integer num, string str, key id );