1

I'm writing an LSL script attached to an object, and would like to change the transparency of another object which I have the UUID of (stored in a key variable).

I've read the documentation but can't even work out how to change the name/description of another object, let alone the transparency. I can only find methods for modifying the local object.

Does LSL not support modification of the properties of other objects, even when they're in the same region and have the same owner?

Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408
Matt
  • 11,157
  • 26
  • 81
  • 110

2 Answers2

2

If it's in the same region then you could just add llListen() in one prim and use llRegionSay() in the other on a private channel.

Like this:

Prim 1 Script (Prim sending the command)

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 receiving the command)

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
        }
    }
}
Havelock
  • 6,913
  • 4
  • 34
  • 42
seanbreeden
  • 6,104
  • 5
  • 36
  • 45
  • Good idea, didn't think of that. I suppose the fact that we can't edit objects directly is something to do with security? – Matt Apr 03 '13 at 14:12
  • Probably so. If the objects are linked then its no problem. It is now possible to pass scripts between remote objects as well.. which seems like a larger security concern than this :) – seanbreeden Apr 03 '13 at 14:16
0

Don't use llRegionSay, use llRegionSayTo so you can specify the UUID of the receiving prim. Also, in the listen state of the second object you should have it ignore any objects with nonmatching owners

1st line of listen:

if(llGetOwnerKey(id) != llGetOwner()) return;
redux
  • 1,157
  • 10
  • 21