Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetOwner()

RaH Wollongong
Registered User
Join date: 11 Jul 2006
Posts: 19
12-20-2006 20:09
I am making a menu and have run into an issue with llGetOwner()
From reading the Wiki I inferred that the script gets the UUID of the owner of the object the script is inside. Yet on several occasions I have used this function only to have my script fail due to it not getting the proper owner of the object.

Here is a section:
CODE

string Creator = llKey2Name(llGetCreator());
string Owner = llKey2Name(llGetOwner());

llSay(0, Creator);
llSay(0, Owner);


The output should be
<object name>: CREATORS NAME
<object name>: ONWERS NAME

Yet it outputs the creators name at both instances no matter who owns the object.
Am I wrong in my usage of this function?
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
12-20-2006 20:18
Is this happening when you give the object to a new person?

Likely you've stored the owner key in a variable, and this variable doesn't get reset for the new person (so it "remembers" the previous owner, which happens to be the creator.)

If so, put something like this in your code:

CODE

on_rez(integer start_param)
{
llResetScript();
}


That code forces the script to reset (and re-initialize all of its variables) everytime the object is rezzed. You could also handle the changed event if you wish, but the code above should be sufficient for your needs.

-peekay
RaH Wollongong
Registered User
Join date: 11 Jul 2006
Posts: 19
12-20-2006 20:19
Nice ty thats exactly what I was doing.
Imp Xi
Registered User
Join date: 6 Oct 2006
Posts: 15
12-20-2006 21:58
I ALWAYS reset on rez, unless for some reason I require the use of start_param. Just to prevent headaches.

Just like how I ALWAYS llRemoveListener first thing into the listen() event, and then (if necessary) do a new llListen at the end. This prevents the listener from overloading and crashing (which used to happen quite a bit).
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-20-2006 23:11
You should be aware that llKey2Name will only return the names of users in the sim or a neighboring sim.

Please consult the wiki for more information.
http://lslwiki.com/lslwiki/wakka.php?wakka=llKey2Name
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey