Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llTakeControl problems

Llewelyn Mistral
Registered User
Join date: 5 Oct 2005
Posts: 49
04-16-2008 18:54
I'm running a script for a vehicle which is supposed to take over the movement controls. The part where it takes control is triggering, but the actual keypresses do nothing. I've tested by adding llTriggerSound to the if statements that check for keypress, and get nothing but silence. The relevant bits of code:


run_time_permissions(integer permissions)
{
if (permissions & PERMISSION_TAKE_CONTROLS) {
llTakeControls( CONTROL_FWD |
CONTROL_BACK |
CONTROL_LEFT |
CONTROL_RIGHT |
CONTROL_ROT_LEFT |
CONTROL_ROT_RIGHT |
CONTROL_UP |
CONTROL_DOWN |
CONTROL_ML_LBUTTON,
TRUE, FALSE);

vector current_pos = llGetPos();
llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, current_pos.z);
pos = current_pos;
llSetStatus(STATUS_PHYSICS, TRUE);
llTriggerSound("ccc_hit", 1.0);
}
}

and

control(key name, integer levels, integer edges)
{
if ((edges & levels & CONTROL_UP)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.z += 12.0;
llTriggerSound("welcome_pilot.wav", 1.0);
} else if ((edges & ~levels & CONTROL_UP)) {
linear.z -= 12.0;
llTriggerSound("ccc_hit", 1.0);
}
if ((edges & levels & CONTROL_DOWN)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.z -= 12.0;
} else if ((edges & ~levels & CONTROL_DOWN)) {
linear.z += 12.0;
}

if ((edges & levels & CONTROL_FWD)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.x += 14.0;
llTriggerSound("welcome_pilot.wav", 1.0);
} else if ((edges & ~levels & CONTROL_FWD)) {
linear.x -= 14.0;
llTriggerSound("ccc_hit", 1.0);
}
if ((edges & levels & CONTROL_BACK)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.x -= 14.0;
} else if ((edges & ~levels & CONTROL_BACK)) {
linear.x += 14.0;
}

if ((edges & levels & CONTROL_LEFT)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.y += 8.0;
} else if ((edges & ~levels & CONTROL_LEFT)) {
linear.y -= 8.0;
}
if ((edges & levels & CONTROL_RIGHT)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
linear.y -= 8.0;
} else if ((edges & ~levels & CONTROL_RIGHT)) {
linear.y += 8.0;
}

if ((edges & levels & CONTROL_ROT_LEFT)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
angular.z += (PI / 180) * 55.0;
angular.x -= PI * 4;
} else if ((edges & ~levels & CONTROL_ROT_LEFT)) {
angular.z -= (PI / 180) * 55.0;
angular.x += PI * 4;
}
if ((edges & levels & CONTROL_ROT_RIGHT)) {
llMessageLinked(LINK_SET, 0, "key", NULL_KEY);
angular.z -= (PI / 180) * 55.0;
angular.x += PI * 4;
} else if ((edges & ~levels & CONTROL_ROT_RIGHT)) {
angular.z += (PI / 180) * 55.0;
angular.x -= PI * 4;
}
if ( ( levels & CONTROL_LBUTTON ) && ( edges & CONTROL_LBUTTON ) )
{
llMessageLinked(LINK_SET, 0, "fire", "";);
}
else if ( !( levels & CONTROL_LBUTTON ) && ( edges & CONTROL_LBUTTON ) )
{
llMessageLinked(LINK_SET, 0, "cease fire", "";);
}
}

You can see where I put in the debug sounds. Any idea what's going on?

*edit* Looks lihe scripts can't share controls anymore, the CCC seems to be killing it
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
04-17-2008 00:21
You don't need the CCC trigger script if you have the link messages sent from that script. Just yank it. Keep the main one though.