Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Taking Control

Prognastat Vellhi
Registered User
Join date: 30 Apr 2007
Posts: 16
11-26-2007 16:37
I want a script to take control of only 3 all of the time, however when one of these keys that are taken control of are held I want alot more controls to be taken untill that key is released in which case I want it back to the original three controls.
Does anyone know a good way of doing this? If needed I can post what i have so far.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-26-2007 16:41
From: Prognastat Vellhi
If needed I can post what i have so far.

That is usually the best way to start. We think in code here and sometimes descriptions or words just get in the way:)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Prognastat Vellhi
Registered User
Join date: 30 Apr 2007
Posts: 16
11-26-2007 16:57
this is what I have:
[PHP]
string guardanim = "Guard";
string specialanim = "special";
string kickanim = "";
string forwardslashanim = "";
string rightslashanim = "";
string leftslashanim = "";



default
{
state_entry()
{
if ( llGetAttached() )
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION|PERMISSION_TAKE_CONTROLS);
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION)
{
llTakeControls( CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON , TRUE, FALSE);
}

}

control(key id, integer held, integer change)
{
integer pressed = held & change;
integer down = held & ~change;
integer released = ~held & change;
integer inactive = ~held & ~change;
if (held & CONTROL_LBUTTON)
{
llStartAnimation("";);
if (pressed & CONTROL_LEFT)
{
llStartAnimation(leftslashanim);
}
if (pressed & CONTROL_RIGHT)
{
llStartAnimation(rightslashanim);
}
if (pressed & CONTROL_FWD)
{
llStartAnimation(forwardslashanim);
}
if (pressed & CONTROL_BACK)
{
llStartAnimation(kickanim);
}
if (pressed & CONTROL_UP)
{
llStartAnimation(specialanim);
}
if (pressed & CONTROL_ROT_RIGHT)
{
llStartAnimation(rightslashanim);
}
if (pressed & CONTROL_ROT_LEFT)
{
llStartAnimation(leftslashanim);
}
}
if (change & CONTROL_LBUTTON)
{
llStopAnimation("";);
}
if (held & CONTROL_DOWN)
{
llStartAnimation(guardanim);

}
if (change & CONTROL_DOWN)
{
llStopAnimation(guardanim);

}
}
}
[/PHP]
Prognastat Vellhi
Registered User
Join date: 30 Apr 2007
Posts: 16
11-27-2007 06:24
ok I have been checking around and I think maybe it would be better if I do it like an AO using:

llTakeControls( CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON | CONTROL_FWD | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_BACK | CONTROL_UP | CONTROL_ROT_RIGHT| CONTROL_ROT_LEFT , TRUE, TRUE);

However I dont want the avatar to move at all when the left mouse button is held. which would mean the above script would have to become:

llTakeControls( CONTROL_DOWN | CONTROL_LBUTTON | CONTROL_ML_LBUTTON | CONTROL_FWD | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_BACK | CONTROL_UP | CONTROL_ROT_RIGHT| CONTROL_ROT_LEFT , TRUE, FALSE);

How could I accomplish this? Could making the last TRUE/FALSE a string that on mouse hold becomes FALSE and on mouse release becomes TRUE?