Advertisement
sumguytwitches

airplane_tutorial2

Aug 31st, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clearguis().
  2. global tutwnd is gui(550, 200).
  3. set tutwnd:x to -100.
  4. set tutwnd:y to 100.
  5. set state to 0.
  6. set lbl to tutwnd:addlabel().
  7. set lbl:style:fontsize to 26.
  8. tutwnd:show().
  9.  
  10. set title_start to "<b><size=32>".
  11. set title_end to "</size></b>".
  12. set code_start to "<i><b><color=orange>".
  13. set code_end to "</color></b></i>".
  14. set botcmd_start to "<b><color=orange>".
  15. set botcmd_end to "</color></b>".
  16.  
  17. brakes on.
  18. set steeringmanager:rollcontrolanglerange to 180.
  19.  
  20. set lbl:text to title_start + "Welcome to Twitch Plays KSP!" + title_end + "
  21. You can type " + botcmd_start + "!help" + botcmd_end + " or " + botcmd_start + "!commands" + botcmd_end + " at any time.
  22. To launch a plane you need to do four things: lock throttle, lock steering, turn brakes off, and stage.
  23. Commands that start with " + code_start + "/me" + code_end + " are sent to the ship's flight computer and interpreted as KOS code.
  24. To lock throttle, type " + code_start + "/me lock throttle to 1" + code_end.
  25. set thisheading to choose 90 if vang(heading(90,0):vector,ship:facing:vector) < 45 else 0.
  26. when throttle > 0 then {
  27. set lbl:text to "Now you need to lock steering. By convention, we use <b>x</b> for compass heading and <b>p</b> for pitch.
  28. Type " + code_start + "/me set x to " + thisheading + code_end.
  29. set state to 1.
  30. }
  31. when state = 1 and defined x and x:istype("scalar") then {
  32. set lbl:text to "Now set p to control pitch. It's measured in degrees above the horizon.
  33. Type " + code_start + "/me set p to 5" + code_end.
  34. set state to 2.
  35. }
  36. when state = 2 and defined p and p:istype("scalar") then {
  37. set lbl:text to "Now that x and p have been setup, the tutorial program will execute the steering lock for you, in this case " + code_start + "lock steering to heading(x,p)." + code_end + "
  38. Almost ready - now release the brakes.
  39. Type " + code_start + "/me brakes off" + code_end.
  40. lock steering to heading(x, p).
  41. set state to 3.
  42. }
  43. when state = 3 and not brakes then {
  44. set lbl:text to "Finally turn on the engine.
  45. Type " + code_start + "/me stage" + code_end.
  46. set state to 4.
  47. }
  48. when state = 4 and ship:maxthrust > 0 then {
  49. set lbl:text to "Once you are airborne, retract the landing gear.
  50. Type " + code_start + "/me gear off" + code_end.
  51. set state to 5.
  52. }
  53. when state = 5 and not gear then {
  54. set lbl:text to title_start + "Congratulations!" + title_end + "
  55. You can change throttle, x, and p to control the plane as you like.".
  56. set donetime to time:seconds.
  57. set state to 6.
  58. }
  59. when state = 6 and time:seconds > donetime + 20 then {
  60. tutwnd:hide().
  61. tutwnd:dispose().
  62. }
  63. clearscreen.
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement