|
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
|
07-02-2007 15:35
I'm working on a chair that rotates when the avatar sitting presses left or right arrow keys. The control event gives me an avatar ID, but that seems to always be the owner ID, and not the ID of the avatar actually pressing the key... is it a bug or a incorrectly documented feature, or could I be doing something wrong?
Lyn
|
|
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
|
07-03-2007 23:43
You might try using llGetPermissionsKey() or llAvatarOnSitTarget() instead of the key sent with the control event, which is undefined in the wiki at the moment, but does seem to be returning the owner's key.
|
|
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
|
07-04-2007 12:14
I've tested it again with a trimmed version of the script, and I can confirm it's a bug in LSL, not in my script. This is the script (quote this msg for a formatted view since we're missing the code view): key gAvatarSitting = NULL_KEY; default { state_entry() { llSitTarget(<0.0, 0.24, -0.1>, llEuler2Rot(<0.0, 0.0, PI_BY_TWO>)); } changed(integer property) { if (property & CHANGED_LINK) { gAvatarSitting = llAvatarOnSitTarget(); if (gAvatarSitting != NULL_KEY) { llRequestPermissions(gAvatarSitting, PERMISSION_TAKE_CONTROLS); } } } run_time_permissions(integer permissions) { if (permissions & PERMISSION_TAKE_CONTROLS && llGetPermissionsKey() == gAvatarSitting) { llTakeControls(CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT, TRUE, FALSE); llForceMouselook(FALSE); } } control(key avatarId, integer controlsHeld, integer controlsChanged) { if (controlsHeld & (CONTROL_LEFT | CONTROL_ROT_LEFT)) { llWhisper(0, llKey2Name(avatarId) + " pressed LEFT"); } if (controlsHeld & (CONTROL_RIGHT | CONTROL_ROT_RIGHT)) { llWhisper(0, llKey2Name(avatarId) + " pressed RIGHT"); } } }
The avatarId passed to the control event is always that of the owner. I've sent a bug report (including an object with this script) to LL.
|
|
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
|
07-04-2007 12:26
Well Lyn, I will agree that does not appear to work as it should, but I would add that since it knows the ID of the AV it took the controls from already, you could make this work just by calling gAvatarSitting.
I've not tested, but I can assume that you cannot take the controls of multiple AV's at the same time. The last person to allow permission being the one that ends up with control. Since you know the ID of the AV in order to take their controls prior to the control event, that extra key is slightly useless imho.
|
|
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
|
07-05-2007 01:37
That is if you assume the person sitting grants permissions. It may be automatic now but you never know what'll change next in SL. I'd rather check to be sure, as usual. Let's hope LL recognizes this as a bug and attempts a fix sometime.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
07-05-2007 07:56
From: Lyn Mimistrobell That is if you assume the person sitting grants permissions. It may be automatic now but you never know what'll change next in SL. I'd rather check to be sure, as usual. Let's hope LL recognizes this as a bug and attempts a fix sometime. Boss's suggested llGetPermissionsKey() should be robust. But always getting the Owner key in the control() event sure does seem like a bug--can you cite the jira you opened?
|
|
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
|
07-06-2007 12:22
I reported it in world, don't know if it's automatically added into Jira, this is what I got back from LL:
Your bug report regarding Bug: E:1479 P:1 O:W V1.17.2.0 (Starfleet Sector001)[Script] "control event parameter avatar key is incorrect" has been received, and assigned an ID of [rt.lindenlab.com #904891].
|