Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

controls

Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
09-15-2008 22:12
Hey I'm a bit lost I psated the control part of my script. Here is what I want to do. As you can see I have the start animation in parts of it. But I'm geting a little lost on one part. When I release up and down I want the change the animation. I looked at the wiki and they talked about it a bit but there was a example done. Sorry this is my 1st time dealing with controls.

control(key id, integer held, integer change)

{
integer reverse=1;
vector angular_motor;

vector vel = llGetVel();
float speed = llVecMag(vel);


if(held & CONTROL_FWD)
{
llStartAnimation("AIM";);
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0>;);
reverse=1;
}
if(held & CONTROL_BACK)
{
llStartAnimation("AIM";);
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <reverse_power,0,0>;);
reverse = -1;
}

if(held & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
angular_motor.z -= speed / turning_ratio * reverse;
}

if(held & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
angular_motor.z += speed / turning_ratio * reverse;
}
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
}
Cynebald Ceawlin
Scripting the night away
Join date: 15 Apr 2007
Posts: 30
09-16-2008 09:35
Hi Jenn -- Haven't had time to trace through your code in detail to be sure, but I think you probably need to look into using both the "held" and the "change" parameter in the argument list of the control() handler...

There's a pretty good discussion of this stuff in the LSL wiki entry for the control() event:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=control
with specific examples for detecting various control event scenarios, e.g. button pushed, button held, button released, etc.

Good luck!
_____________________
-----
Cynebald Ceawlin
Proprietor and Chief Scripter
The Mathom House:: Scripted Objects and What-Not
Nimue Isle (SLURL: http://slurl.com/secondlife/Nimue%20Isle/164/119/28)