BeastmodeJD

Race_Controller

Apr 7th, 2020
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.80 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("Press 'S' to start a race or 'P' to start a practice. Please note that for races there is a 3 minute yellow light lap")
  4. input = read()
  5. if (input == "s" or input == "S") then
  6.     time = 180
  7.     term.clear()
  8.     print("Running pre-race practice...")
  9.     while (time > 8) do
  10.         term.setCursorPos(1,2)
  11.         term.write(time.." Seconds till race")
  12.         rs.setBundledOutput("top", colors.white)
  13.         sleep(1)
  14.         rs.setBundledOutput("top", colors.yellow)
  15.         term.clearLine()
  16.         time = time - 1
  17.     end
  18.     sleep(3)
  19.     rs.setBundledOutput("top", colors.red)
  20.     sleep(1)
  21.     rs.setBundledOutput("top", colors.combine(colors.red + colors.blue))
  22.     sleep(1)
  23.     rs.setBundledOutput("top", colors.combine(colors.red, colors.blue, colros.purple))
  24.     sleep(1)
  25.     rs.setBundledOutput("top", colors.combine(colors.red, colors.blue, colors.purple, colors.black))
  26.     sleep(1)
  27.     rs.setBundledOutput("top", colors.combine(colors.red, colors.blue, colors.purple, colors.black, colors.brown))
  28.     sleep(1)
  29.     rs.setBundledOutput("top", colors.green)
  30.     term.clear()
  31.     term.setCursorPos(1,1)
  32.     print("Press 'E' to end the race, 'Y' to put the race into yellow, or 'R' to put the race into red")
  33.     while not (input2 == "E" or input2 == "e") do
  34.         if (input2 == "Y" or input2 == "y") then
  35.             time = 180
  36.             while (time > 0) do
  37.                 term.clear()
  38.                 term.setCursorPos(1,2)
  39.                 term.write(time.." seconds left of yellow time")
  40.                 rs.setBundledOutput("top", colors.white)
  41.                 sleep(1)
  42.                 rs.setBundledOutput("top", colors.yellow)
  43.                 term.clearLine()
  44.                 time = time - 1
  45.             end
  46.         end
  47.         if (input2 == "R" or input2 == "r") then
  48.             term.clear()
  49.             term.setCursorPos(1,1)
  50.             print("Race is in red. To restart race please reboot computer by pressing any key.")
  51.             rs.setBundledOutput("top", colors.combine(colors.red, colors.blue, colors.purple, colors.black, colors.brown))
  52.             os.pullEvent("key")
  53.             os.reboot()
  54.         end
  55.         term.clear()
  56.         term.setCursorPos(1,1)
  57.         print("Press 'E' to end the race, 'Y' to put the race into yellow, or 'R' to put the race into red")
  58.         input2 = read()
  59.     end
  60. elseif (input == "P" or input == "p") then
  61.     time = 300
  62.     term.clear()
  63.     print("Running Practice...")
  64.     while (time > 0) do
  65.         term.setCursorPos(1,1)
  66.         term.write(time.." seconds left")
  67.         rs.setBundledOutput("top", colors.white)
  68.         sleep(1)
  69.         rs.setBundledOutput("top", colors.yellow)
  70.         term.clearLine()
  71.         time = time - 1
  72.     end
  73. else
  74.     os.reboot()
  75. end
  76. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment