Difference between revisions of "LlMessageLinked"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:
|p3_type=string|p3_name=str
|p3_type=string|p3_name=str
|p4_type=key|p4_name=id
|p4_type=key|p4_name=id
|func_desc=Sends '''num''', '''str''', and '''id''' to link '''linknum''' or the group '''linknum'''.
|func_desc=Triggers a {{LSLG|link_message}} event with the parameters '''num''', '''str''', and '''id''' in the group or link '''linknum'''.
|constants={{{!}} {{Prettytable}}
|func_footer
!Flag
|constants={{LSL Constants/Link}}
!Value
!Description
{{!}}-
{{!}} {{LSLG|LINK_ROOT}}
{{!}} 1
{{!}} sends to root task in a linked set
{{!}}-
{{!}} {{LSLG|LINK_SET}}
{{!}} -1
{{!}} sends to all tasks
{{!}}-
{{!}} {{LSLG|LINK_ALL_OTHERS}}
{{!}} -2
{{!}} sends to all other tasks
{{!}}-
{{!}} {{LSLG|LINK_ALL_CHILDREN}}
{{!}} -3
{{!}} sends to all children
{{!}}-
{{!}} {{LSLG|LINK_THIS}}
{{!}} -4
{{!}} sends to the task the script it is in
{{!}}}
|func_footnote
|func_footnote
|return_text
|return_text
Line 58: Line 35:
</pre>
</pre>
|also_header
|also_header
|also_events
|also_events=*{{LSLG|link_message}}
|also_functions
|also_functions
|also_articles
|also_articles
Line 64: Line 41:
|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 infinite loops as mentioned above.
|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 infinite loops as mentioned above.
|cat1=Communications
|cat1=Communications
|cat2=Link
|cat2
|cat3
|cat3
|cat4
|cat4
}}
}}

Revision as of 16:52, 20 February 2007

Summary

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

Triggers a link_message event with the parameters num, str, and id in the group or link linknum.

• integer linknum Link number or a LINK_* flag.
• integer num
• string str
• key id

Flag Description
LINK_ROOT 1 sends to the root prim in a multi-prim linked set[1]
LINK_SET -1 sends to all prims
LINK_ALL_OTHERS -2 sends to all other prims
Flag Description
LINK_ALL_CHILDREN -3 sends to all children, (everything but the root)
LINK_THIS -4 sends to the prim the script is in

Caveats

  • It is possible to create infinite loops based on a script reacting to a linked message by sending a linked message, to which it reacts.
All Issues ~ Search JIRA for related Bugs

Examples

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
    }    
}

Useful Snippets

default
{//Quick and dirty debugging link_messages
    link_message(integer sender_num, integer num, string msg, key id) {
        llSay(DEBUG_CHANNEL, llList2CSV([sender_num, num, msg, id]));
    }
}

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 infinite loops as mentioned above.

See Also

Events

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.

Signature

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