Jump to content

Fox Smith

Members
  • Posts

    5
  • Joined

  • Last visited

Reputation

0 Neutral

Contact Methods

  1. Okay, i now set the initial value of ca to 0, added a "wait 0.5." to the if script that controls the throttle below 20 km. if altitude < 20000 { lock throttle to (throttle+p). when altitude > 20000 then {lock throttle to thr.}. wait 0.5. }. I also changed "e" to "E", now the script freezes right after the last output from the launch sequence. Really strange occurrences on my side...
  2. I don't think thats the problem, because i use it often in the script and if you don't give a second arument it just rounds to a whole number. Also the output is shown correctly in the terminal, it just freezes after the output.
  3. Hello fellow Kerbonauts, while working on this script: //Parameter declaration declare parameter alt. //if you launch the script with scriptname(1000) alt is set to 1000 //General Variables set kr to kerbin:radius. //Radius of Kerbin set km to kerbin:mass. //Mass of Kerbin set kmu to Kerbin:mu. //Gravital parameter of Kerbin (Gravity Constant * Mass) set e to constant():e. //Set e to Eulers number set long to longitude. //Internal Variables lock throttle to thr. //Locks the throttle to thr. lock steering to heading ( 90, 90 ). //Locks the rockets direction up. set thrust to 0.1. //Throttle at lift off where 1 is 100% throttle and 0 is 0% set ttw to (maxthrust/(mass*9.81)). //Setting Thrust to weight ratio set st1 to 0. //Booster status where 0=off, 1=ignited, 2=empty 3=discoupled set st2 to 0. //Stage 1 status where 0=off, 1=ignited, 2=empty 3=discoupled set st3 to 0. //Stage 2 status where 0=off, 1=ignited, 2=empty 3=discoupled set st4 to 0. //And so on and so fourth. If you have more stage add more variables. set vo to 0. //Optimal velocity in dependency of altitude set v to 0. //airspeed set thr to 0.2. //Initial throttle set r to 0. //Determines if roll has occurred set p to 0. //helps setting the speed below 20 km. clearscreen. //Launch Sequence print "Launch Sequence started.". wait 1. //Displays "Launch Sequence started" in the terminal print "T-" + missiontime + 9. wait 1. print "T-" + missiontime + 8. wait 1. print "T-" + missiontime + 7. wait 1. print "T-" + missiontime + 6. wait 1. print "T-" + missiontime + 5. wait 1. print "T-" + missiontime + 4. wait 1. print "T-" + missiontime + 3. wait 1. print "T-" + missiontime + 2. wait 1. print "T-" + missiontime + 1. wait 1. Print "T-" + missiontime + " Lift off". stage. //Launches the first stage. set st1 to 1. set st2 to 1. //Stage decoupling when stage:solidfuel < 1 then {set st1 to 2.}. //Checks booster fuel status when stage:liquidfuel < 1 then {set st2 to 2.}. //Checks stage 1's fuel status when stage:liquidfuel < 1 and st2 = 3 then {set st3 to 2.}. //Checks stage 2's fuel status (if more stage add more of this) when st1 = 2 then {wait 2. stage. set st1 to 3. Print "T+" + round(missiontime) + " Booster separated.".}. //Decouples the boosters if empty when st2 = 2 then {wait 2. stage. set st2 to 3. Print "T+" + round(missiontime) + " Stage 1 separated.". //Decouples stage 1 if empty wait 1. stage. Print "T+" + round(missiontime) + " Stage 2 Ignited.". set st3 to 1. //Ignites stage 2 }. when st3 = 2 then { wait 1. stage. set st3 to 3. Print "T+" + round(missiontime) + " Stage 2 separated.". //You see where this is going wait 1. stage. Print "T+" + round(missiontime) + " Stage 3 Ignited.". set st4 to 1. //Ignites stage 3 }. //Rolls the rocket by 45° when reaching 200m when ca > 200 and r = 0 then { lock steering to up + R(0,0,0). print "T+" + round(missiontime) + " Rolling.". set r to 1. }. if altitude < 20000 { lock throttle to (throttle+p). when altitude > 20000 then {lock throttle to thr.}. }. //Loop below 20km altitude. until altitude > 20000 { set ca to altitude. //Sets ca to altitude (because im to lazy to write altitude all the time) set a1 to altitude/1000. //Sets a1 to altitude/1000 set v to airspeed. //Sets v to current ship velocity set vo to 95.688*(E^(0.096*a1)). //Sets v0 to perfect velocity based on http://bit.ly/15hQOy2 [COLOR=#404040][FONT=arial] print round(vo - v).[/FONT][/COLOR] if v > vo {if throttle > 0 {set p to -0.1.}.} else {if throttle < 1 {set p to 0.1.}.}. //Throttles down if too fast wait 0.5. }. i issued a strange freeze/crash. It froze right after displaying this [COLOR=#404040][FONT=arial]print vo - v.[/FONT][/COLOR] with a correct output in the terminal. I'm quite new to KOS and this is my first attempt in making my completely own script. Could anybody please help me with this?
×
×
  • Create New...