<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
	<id>http://i.bnu.edu.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=%E8%99%9A%E6%8B%9F%E4%B8%96%E7%95%8C%2F%E8%84%9A%E6%9C%AC%E9%97%B4%E9%80%9A%E4%BF%A1</id>
	<title>虚拟世界/脚本间通信 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://i.bnu.edu.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=%E8%99%9A%E6%8B%9F%E4%B8%96%E7%95%8C%2F%E8%84%9A%E6%9C%AC%E9%97%B4%E9%80%9A%E4%BF%A1"/>
	<link rel="alternate" type="text/html" href="http://i.bnu.edu.cn/wiki/index.php?title=%E8%99%9A%E6%8B%9F%E4%B8%96%E7%95%8C/%E8%84%9A%E6%9C%AC%E9%97%B4%E9%80%9A%E4%BF%A1&amp;action=history"/>
	<updated>2026-06-01T04:42:58Z</updated>
	<subtitle>本wiki的该页面的版本历史</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>http://i.bnu.edu.cn/wiki/index.php?title=%E8%99%9A%E6%8B%9F%E4%B8%96%E7%95%8C/%E8%84%9A%E6%9C%AC%E9%97%B4%E9%80%9A%E4%BF%A1&amp;diff=1825&amp;oldid=prev</id>
		<title>Wyg：创建页面，内容为“{{VWSnav}}  ===llMessageLinked( integer link, integer num, string str, key id )=== 该脚本目的是允许一个物体中脚本之间进行通信。它将触发link…”</title>
		<link rel="alternate" type="text/html" href="http://i.bnu.edu.cn/wiki/index.php?title=%E8%99%9A%E6%8B%9F%E4%B8%96%E7%95%8C/%E8%84%9A%E6%9C%AC%E9%97%B4%E9%80%9A%E4%BF%A1&amp;diff=1825&amp;oldid=prev"/>
		<updated>2024-08-23T08:46:33Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“{{VWSnav}}  ===llMessageLinked( integer link, integer num, string str, key id )=== 该脚本目的是允许一个物体中脚本之间进行通信。它将触发link…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{VWSnav}}&lt;br /&gt;
&lt;br /&gt;
===llMessageLinked( integer link, integer num, string str, key id )===&lt;br /&gt;
该脚本目的是允许一个物体中脚本之间进行通信。它将触发link_message事件，事件相关参数num、str、id相同，捕获到的元件由link参数决定。&lt;br /&gt;
#integer link: Link number (0: unlinked, 1: root prim, &amp;gt;1: child prims and seated avatars) or a LINK_* flag, controls which prim(s) receive the link_message.	&lt;br /&gt;
#integer num: Value of the second parameter of the resulting link_message event.	&lt;br /&gt;
#string	str: Value of the third parameter of the resulting link_message event.	&lt;br /&gt;
#key id: Value of the fourth parameter of the resulting link_message event.	&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LINK_ROOT	1	sends to the root prim in a multi-prim linked set[1]&lt;br /&gt;
LINK_SET	-1	sends to all prims&lt;br /&gt;
LINK_ALL_OTHERS	-2	sends to all other prims&lt;br /&gt;
LINK_ALL_CHILDREN	-3	sends to all children, (everything but the root)&lt;br /&gt;
LINK_THIS	-4	sends to the prim the script is in&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*警告&lt;br /&gt;
#A script can hear its own linked messages if link targets the prim it is in[3]. This creates the possibility of an infinite loop (a bad thing); be very careful about how messages are handled and passed along.&lt;br /&gt;
#Messages sent via llMessageLinked to a script that is sleeping, delayed, or lagged, are queued until the end of the delay. The event queue can hold 64 events.&lt;br /&gt;
##If an event is received and the queue is full the event is silently dropped.&lt;br /&gt;
##Avoid sending link_messages to large numbers of scripts simultaneously as it can cause lag spike. This most often happens when using the multi-prim LINK_* flags and can cause script execution to slow or halts.&lt;br /&gt;
##Avoid sending link_messages to a target faster than they can be handled. Doing so risks filling the event queue and subsequent messages being silently discarded.&lt;br /&gt;
#When a script state changes, all pending events are deleted, including queued link_messages.&lt;br /&gt;
#If link is an invalid link number then the function silently fails.&lt;br /&gt;
#If str &amp;amp; id exceed the available memory of a script that catches the resulting link_message event, that script will crash with a Stack-Heap Collision.&lt;br /&gt;
&lt;br /&gt;
*例子&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    // assumptions  // object name: LSLWiki // script name: _lslwiki&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llMessageLinked(LINK_THIS, 0, llGetScriptName(), &amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    link_message(integer sender_num, integer num, string msg, key id)&lt;br /&gt;
    {&lt;br /&gt;
        llOwnerSay(msg);&lt;br /&gt;
        // the owner of object LSLWiki will hear&lt;br /&gt;
        // LSLWiki:_lslwiki&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
无穷循环，注意只用于测试功能。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Message_Control(integer l, integer n) // Message_Total_Lack_Of_Control&lt;br /&gt;
{&lt;br /&gt;
    integer r = (++n); // Increment the value of n.&lt;br /&gt;
    llMessageLinked( l, r, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;); // Send the result to l&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        Message_Control(LINK_SET, 0); // Tell all the scripts in the object that we have state_entered.&lt;br /&gt;
    }&lt;br /&gt;
    link_message(integer Sender, integer Number, string String, key Key) // This script is in the object too.&lt;br /&gt;
    {&lt;br /&gt;
        Message_Control(Sender, Number); // No filtering condition exists.&lt;br /&gt;
        llOwnerSay(((string)Number)); // Look at all the pretty numbers!&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
有用的代码片段&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    // 在debug窗口输出，捕获link message事件&lt;br /&gt;
    link_message(integer sender_num, integer num, string msg, key id)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(DEBUG_CHANNEL, llList2CSV([sender_num, num, msg, id]));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
// This is just an example script, you shouldn't handle link message within single script this way.&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    // 演示如何传输多个参数，放到list中!&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        list my_list = [1, 2.0, &amp;quot;a string&amp;quot;, &amp;lt;1, 2, 3&amp;gt;, &amp;lt;1, 2, 3, 4&amp;gt;, llGetOwner()];&lt;br /&gt;
        string list_parameter = llDumpList2String(my_list, &amp;quot;|&amp;quot;);    // Convert the list to a string&lt;br /&gt;
        llMessageLinked(LINK_THIS, 0, list_parameter, &amp;quot;&amp;quot;);//发送到物体中所有的脚本&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    link_message(integer sender_num, integer num, string list_argument, key id)&lt;br /&gt;
    {&lt;br /&gt;
        list re_list = llParseString2List(list_argument, [&amp;quot;|&amp;quot;], []);    // Parse the string back to a list&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wyg</name></author>
		
	</entry>
</feed>