Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llList2Float car gearing?

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
03-30-2008 09:14
im having alot of crazy trouble in theory this should work, im using a list to create a gearing system for my car. it works good except it dosent stop at the last set of gears but it will stop at first gear anyone have any ideas?

gears will go 1-2-3-4-5-6-7 and so on then 7-6-5-4-3-2-1 will stop at first gear

CODE

list ForwardPowerGears = [12, 13, 16, 20, 30];
integer Gear = 0;
integer NumGears;
float ForwardPower;

//------------------------------------------------------\\

if((edge & level & CONTROL_UP))
{
if((Gear + 1) != NumGears)
{
++Gear;
llWhisper(0, "Gear " + (string)(Gear + 1));
ForwardPower = llList2Float(ForwardPowerGears, Gear);
}
}
else if((edge & level & CONTROL_DOWN))
{
if((Gear - 1) != -1)
{
--Gear;
llWhisper(0, "Gear " + (string)(Gear + 1));
ForwardPower = llList2Float(ForwardPowerGears, Gear);
}
}
if(level & CONTROL_FWD)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <ForwardPower,0,0> );
}

Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
03-30-2008 11:27
Setting a value for NumGears may help :)
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
03-30-2008 11:44
OMFG it worked :O