Okay, this is a fairly complex set of events, and there are some red-flags for bugs, so I need some clarification before I start scripting. It looks like you want to do this:
- Every frame:
--- if the player is not gliding, sum the absolute value of the player's speed along each axis, and subtract that from both FuelQuantity and ExternalFuel;
--- if the player is gliding, do the same, but summing the speed only on those axes along which the player is actually thrusting;
--- set HUD gauge FuelBar to frame N, where N=( ( 13000 - FuelQuantity ) / 1000 );
--- set HUD gauge ExtFuelBar to frame N, where N=( ( 26000 - FuelQuantity ) / 2000 );
--- set HUD gauge FuelTankViper to frame N, where N=( ( 13000 - ExternalFuel ) / 1000 );
--- set HUD gauge FuelTankRaptor to frame N, where N=( ( 26000 - ExternalFuel ) / 2000 );
- At mission start, if the player has an external fuel tank equipped, set FuelQuantity and ExternalFuel and activate HUD gauges based on the player's ship class.
- Something funky involving the player's secondary ammo and jettisoning fuel tanks that I don't think I understand.