Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetOwner() in different sim

Ina Centaur
IC
Join date: 31 Oct 2006
Posts: 202
01-21-2007 02:48
it appears that llKey2Name(llGetOwner()) doesn't work on an object (created by the owner) if the owner's in a different sim or offline!

is there another way to get the owner of an object, when the owner is in a different sim than the object?

--

testing just a simple script out. having some sandbox guy click the object while i'm gone. when i'm present, the object blurts out my name. when i'm gone, the object doesn't say anything.

CODE

default
{
state_entry()
{
llSay(0, "initializedd!");
}

touch_start(integer total_number)
{
llSay(0,llKey2Name(llGetOwner()));
}
}
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
01-21-2007 03:04
http://lslwiki.com/lslwiki/wakka.php?wakka=llKey2Name
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
01-21-2007 03:08
This behaviour is consistent with: http://www.lslwiki.com/lslwiki/wakka.php?wakka=llKey2Name

The answer is to preserve the Owner's name in the state_entry Event and when a change of owner is detected in the change Event:

CODE
string oName;

default
{
state_entry()
{
oName = llKey2Name(llGetOwner());
llSay(0, "initializedd!");
}

touch_start(integer total_number)
{
llSay(0, oName);
}

changed(integer change)
{
if(change & CHANGED_OWNER)
{
oName = llKey2Name(llGetOwner());
}

}
}
This is probably more efficient too. :D