1

我正在编写一个附加到一个对象的 LSL 脚本,并且想更改另一个我拥有 UUID 的对象的透明度(存储在一个key变量中)。

我已经阅读了文档,但甚至无法弄清楚如何更改另一个对象的名称/描述,更不用说透明度了。我只能找到修改本地对象的方法。

LSL 是否不支持修改其他对象的属性,即使它们位于同一区域并具有相同的所有者?

4

2 回答 2

2

如果它在同一个区域,那么您只需添加llListen()一个 prim 并llRegionSay()在私人频道上使用另一个。

像这样:

Prim 1 Script(Prim 发送命令)

default
{
    state_entry()
    {
    }

    touch_start(integer total_number)
    {
        llRegionSay(-123456,"1.0"); // Channel -123456 can be anything.  "1.0" will be the transparency setting passed to the 2nd prim
    }
}

Prim 2 Script(Prim 接收命令)

default
{
    state_entry()
    {
        llListen(-123456, "", "", ""); // Make the prim listen
    }
    listen( integer channel, string name, key id, string message )
    {
        if (channel==-123456) {  // Match the same private channel
            llSetAlpha((float)message, ALL_SIDES);  // Convert "message" into an integer and pass to the llSetAlpha() function as the transparency - 0 = invisible  1 = visible
        }
    }
}
于 2013-04-03T01:23:22.577 回答
0

不要使用 llRegionSay,使用 llRegionSayTo 这样您就可以指定接收 prim 的 UUID。此外,在第二个对象的侦听状态下,您应该让它忽略具有不匹配所有者的任何对象

第一行听:

if(llGetOwnerKey(id) != llGetOwner()) return;
于 2014-01-11T17:32:33.893 回答