Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Behaviour of llGetOwner()?

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
11-23-2005 08:41
This is an oddity I've experienced, but what is the actual behaviour of llGetOwner()?
It's just that I've made a door which by default can only be opened by its owner, which works fine.
However, I gave a door to someone which they can open fine, but in addition, I can still open it.

My door doesn't store it's owner's ID anywhere, it calls llGetOwner() each time.
Does a script have to be reset before the result of llGetOwner() will actually change?
Eata Kitty
Registered User
Join date: 21 Jan 2005
Posts: 387
11-23-2005 08:50
Yes basically. Anytime you use llGetOwner it's usually good to have a llResetScript inside an on_rez event.
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
11-23-2005 09:02
llGetOwner() will always return the current owner. You can verify this by having an object set it's text to llGetOwner() when it is touched or rezzed. It sounds like you might have overlooked an error in your script, if you post the relevant part someone will probably be able to spot it. For instance, if you are using listeners, maybe you are setting up a new listener in on_rez without removing the old one first. If the door can be configured to open for anyone, you might have your owner-only-mode check backwards.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
11-23-2005 22:56
I always add this Catherine's event handler on this thread into my scripts without any thinking. :D
_____________________
:) Seagel Neville :)
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
11-24-2005 04:34
From: Masakazu Kojima
llGetOwner() will always return the current owner. You can verify this by having an object set it's text to llGetOwner() when it is touched or rezzed. It sounds like you might have overlooked an error in your script, if you post the relevant part someone will probably be able to spot it. For instance, if you are using listeners, maybe you are setting up a new listener in on_rez without removing the old one first. If the door can be configured to open for anyone, you might have your owner-only-mode check backwards.


None of my listens filter what they listen for, as the owner isn't the only person who can open the door (it can be configured to allow group, or even extra users via its settings notecard).
By simple reversal of the logic in the auth functions of the script (ie the parts that check if you can open and/or lock/unlock the door) I can verify that it does in fact stop other users.
People have tried to get into my home that are not configured to enter, and it uses the exact same code for its doors, they were all denied, while myself and a few others listed can enter/exit just fine.

I can't really post the code for this thing, it's massive, even the chunks that are most relevant aren't the simplest things in the world. All I know is that the doors work fine when I rez them, but when I give them to someone else they still count me as the owner IN ADDITION to their actual owner; ie - I can lock the door, yet both of us can still get through.

I've changed the code to include:
CODE
on_rez(integer x) { llResetScript(); }
changed(integer x) { if (x & 128) llResetScript(); }


I'm going to give them an updated version and see if this makes a difference at all.