function fuelfordvtarget { parameter targetRocketDv. parameter rocketisp to 315. set orewiggle to 0.1. set res to gui(200, 100). Set res:x to -40. set res:y to 5. res:show. set reslist to list(). for rs in ship:resources { set l to res:addlabel(). Set l:style:fontsize to 20. reslist:add(l). } on time:seconds { set i to 0. for rs in ship:resources { set reslist[i]:text to rs:name + " " + round(rs:amount,1) + " / " + rs:capacity. set reslist[i]:style:textcolor to rgb(1 - rs:amount/rs:capacity, rs:amount/rs:capacity, 0.3). set i to i + 1. } return res:visible. } radiators on. lock liquidmatched to min(ship:oxidizer * 9 / 11, ship:liquidfuel). lock oxidizermatched to min(ship:oxidizer, ship:liquidfuel * 11 / 9). lock vectordv to Round(rocketisp * 9.81 * ln(ship:mass / (ship:mass - (liquidmatched * 0.005) - (oxidizermatched * 0.005))), 5). print vectordv. set isrs to ship:modulesnamed("ModuleResourceConverter"). set warp to 1. wait 1. set warp to 5. if(vectordv < targetRocketDv and ship:oxidizer * 9 / 11 <= ship:liquidfuel) { print "refilling ox to match liquid". for isr in isrs { if isr:hasaction("start isru [ox]") isr:doaction("start isru [ox]",true).} set warp to 1. wait 1. set warp to 5. wait until ship:oxidizer * 9 / 11 >= ship:liquidfuel or vectordv >= targetRocketDv or ship:ore < orewiggle. } isru off. if(vectordv < targetRocketDv) { print "refilling lf + o to match dv target". for isr in isrs { if isr:hasaction("start isru [lf+ox]") isr:doaction("start isru [lf+ox]",true).} wait until vectordv >= targetRocketDv or ship:ore < orewiggle. } isru off. for isr in isrs { if isr:hasaction("start isru [lqdfuel]") isr:doaction("start isru [lqdfuel]",true).} print "converting remaining ore to liquidfuel". wait until ship:ore < orewiggle. isru off. set warp to 0. radiators off. print "Fuel Converted". res:hide. }