llMessageLinked

From Second Life Wiki
Revision as of 15:24, 14 February 2007 by Anthony Reisman (talk | contribs)
Jump to navigation Jump to search

Summary

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

Sends num, str, and id to link linknum or the group linknum.

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

Flag Value Description
LINK_ROOT 1 sends to root task in a linked set
LINK_SET -1 sends to all tasks
LINK_ALL_OTHERS -2 sends to all other tasks
LINK_ALL_CHILDREN -3 sends to all children
LINK_THIS -4 sends to the task the script it 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.

Deep Notes

Search JIRA for related Issues

Signature

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