Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PERMISSION_TAKE_CONTROLS bug

Eata Kitty
Registered User
Join date: 21 Jan 2005
Posts: 387
06-21-2006 11:57
There seems to be a bug with multiple attachments requesting PERMISSION_TAKE_CONTROLS. If two attachments have this permission then one is detached you will lose functionality in the remaining one despite it reporting it still has the permissions granted through llGetPermissions.

Easy test, make two cubes one called L and one called R with this script inside and attach one to each hand, then detach one. The remaining attachment will lose the release keys/mouselook button and no longer respond to controls when in mouselook but still report that it has permissions.

CODE

integer have_permissions = FALSE;

default
{
state_entry()
{
if (llGetAttached())
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
llSetTimerEvent(10);
}

attach(key id)
{
if (id != NULL_KEY)
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
else
{
if (have_permissions)
{
llReleaseControls();
have_permissions = FALSE;
}
}
}

run_time_permissions(integer permissions)
{
llOwnerSay((string)permissions);
if (permissions == PERMISSION_TAKE_CONTROLS)
{
have_permissions = TRUE;
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
}
else
llOwnerSay("Error - Failed run_time_permissions");
}

control(key name, integer level, integer edge)
{
if((level & edge & CONTROL_ML_LBUTTON))
{
llOwnerSay("Clicked");
}
}

timer()
{
llOwnerSay((string)llGetPermissions());
}
}
Gerami Fizz
That Guy
Join date: 15 Jun 2005
Posts: 88
06-21-2006 12:40
I have noticed this phenomenon before, but I never got an answer from the forums...

That said, I've done a bit more research and testing. It seems that it only happens with scripts that don't allow passthrough input.

Example: I wrote a flight booster that activates whenever I'm flying. When I stop flying, the script releases the controls it was using. The flight booster allows passthrough input (if it for some reason doesn't activate, my movement controls still work.)

Next, let's say I attach a gun to my right hand. The gun takes the control ML_LBUTTON (or whatever the mouselook click is) and does NOT allow passthrough. I wouldn't want to be accidentally dragging things when I'm clicking to shoot them.

Here's where it gets interesting. I start flying with the gun in my hand, and as soon as the flight booster activates, the mouselook button disappears from my screen and my gun won't fire until I reattach it. This seems to agree with Eata's experience.

HOWEVER: If I attach another object that allows passthrough, like a sword with the "pillow fighter" freebie script (needs passthrough because you need to be able to move AND select directional strikes), it functions correctly regardless of my flight booster.

Allowing passthrough on all attachments obviously isn't an ideal answer, but as someone suffering from the same issue, I wanted to share all the information I have. Hope it was useful!
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-21-2006 21:31
OK, It might be a bug. But I found a solution.
You know that PERMISSION_TAKE_CONTROLS has been released automatically when it lose s a proper id since ver1.9. So I deleted the llReleaseControls() section, that is, the whole "else" block under attach event. Anyway it worked. hmm... anyway. :D
_____________________
:) Seagel Neville :)
Eata Kitty
Registered User
Join date: 21 Jan 2005
Posts: 387
06-22-2006 13:30
As the else condition will be triggered for both detach and drop I think that could cause problems if anyone drops the attachment, I will test it though.
Eata Kitty
Registered User
Join date: 21 Jan 2005
Posts: 387
06-22-2006 15:08
I just tried it and it made no difference, controls were lost even with the entire else block removed.

Edit-

I've found this also applies to PERMISSION_TAKE_ANIMATIONS. This is more difficult to test as you need two animations that act on different parts of the body, two animations that only have arm keyframes are probably easiest. If one is detached or dropped the other will cease to animate. This is without an else section, the animations are not stopped.

Even weirder it seems with this that you have to remove the object you attached first for this to happen, removing the second one does not cause this behaviour.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-22-2006 15:48
Sorry, I made sure it was not stable. hmm...

[Edit]Eata.. You knew much... :D
_____________________
:) Seagel Neville :)
Eyana Yohkoh
Registered User
Join date: 30 Nov 2006
Posts: 33
04-24-2007 18:02
I just ran into this problem while working on a grappling hook. I'm somewhat new at scripting anything that takes controls and I don't quite understand what you mean by "passthrough." I can't find any info on the wiki about passthrough. Did I miss something simple?
Eyana Yohkoh
Registered User
Join date: 30 Nov 2006
Posts: 33
04-24-2007 18:09
Nevermind. I did miss something simple.
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Passthrough, sounds interesting.
04-26-2007 17:59
yeah, I was just about to say, "Yes, simply missed something". when I realized I'm not sure how to set a script to be passthrough or not. I understand what it means to set a program does when it collects input and passes the input on untouched.

I'm Feeling numb myself. Because I'm not sure how to do that myself in LSL.

Sorry, I had two doctor appointments in three days. One left me so I couldn't use my eyes to use my computer for that day. And after a 2 hour trip one way, I was too tired to answer Email.

-InuYasha Meiji
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
04-26-2007 18:19
Somewhere in state entry of a script in the child prim:

CODE

llPassTouches (TRUE);