|
Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
|
08-04-2007 15:25
I have gadget that is controlled by key presses. I would like to limit the operator to be only the owner. However that doesn't seem to work. I did some testing and the key id seems to be the same no matter who is operating the gadget.
I'm wondering why the id key is being returned as being the owner even when the owner is not operating the gadget.
control(key id, integer down, integer new) { llWhisper(0,"id: " + (string)id); llWhisper(0,"Owner: " + (string)llGetOwner()); }
Results when owner presses the key.
id: cf95d37f-9a22-47ba-80e1-34e9e6d9d036 Owner: cf95d37f-9a22-47ba-80e1-34e9e6d9d036
Results when someone else presses the key.
id: cf95a37f-9a22-47ba-80e1-34e9e6d9e036 Owner: cf95a37f-9a22-47ba-80e1-34e9e6d9e036
Any ideas would be appreciated.
Thanks - D
|
|
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
|
08-04-2007 16:22
The id returned in the control event is the id of whichever avatar has given PERMISSION_TAKE_CONTROLS... which should be the same avatar that the llTakeControls function was used on.
Does the script try to get permission-take-control from both the owner and the 2nd avatar? I don't know offhand if it would keep track of both, most vehicles I've seen that have more than one rider, usually are scripted so that only one can drive at a time.
My guess, without knowing how permission was asked etc, is that maybe the script got permission from the owner first, and that permission has never been relinquished, so that's what the control event is capturing.
-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
08-04-2007 16:35
It's because llGetOwner() is only called once (the first time), then saved. To force a script to re-read the owner, do this:
on_rez (integer foo) { llResetScript }
this will force the llGetOwner to execute (for real) each time the object is rezzed. What's happening is that it seems to work fine for the creator, but once transfered to a new owner, the old owner is still "saved" within the script.
|
|
Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
|
08-04-2007 23:20
Thanks for the help. Gives me something to look at.
- D
|