Advertisement
darearkin

Untitled

Apr 2nd, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. --Screen/Drawing functions
  3. -----------------------------
  4. w,h = term.getSize()
  5. hW = w/2
  6. hH = h/2  
  7. c=colors.combine(colors.red,colors.green,colors.black,colors.white)
  8. white = false
  9. green = false
  10. black = false
  11. red   = false
  12. rs.setBundledOutput("back", c)
  13.  
  14. function centerPrint(y,text)
  15.   term.setCursorPos(w/2 - #text/2, y)
  16.     term.write(text)
  17. end
  18.  
  19. function drawAt(x,y,text)
  20.  term.setCursorPos(x,y)
  21. write(text)
  22. end
  23.  
  24. function cleanScreen()
  25. term.clear()
  26.   term.setCursorPos(1,1)
  27.  end
  28.  
  29.  
  30. input = 1
  31.  
  32.  
  33. function drawArt()
  34.  
  35.   cleanScreen()
  36.   term.setTextColor(colors.lime)
  37.   term.setBackgroundColor(colors.black) --title and title background color
  38.   print[[
  39.  
  40.       VAULT-TEC REACTOR MK 4 CONTROL STATION            
  41.           AUTHORIZED PERSONEL  ONLY!                            
  42.  
  43. ]]
  44.  
  45.  
  46.  for i = 5,19 do
  47.  term.setBackgroundColor(colors.black) -- MAIN BACKGROUND SPAM COLOR
  48.   drawAt(1,i,"                                                   ")
  49.    term.setBackgroundColor(colors.black)
  50.   end
  51.  
  52.   if input == nil then
  53.   input = 1
  54.   end
  55.  
  56.   term.setBackgroundColor(colors.black) -- menu section background
  57.   term.setTextColor(colors.red) -- menu section brackets
  58.    term.setCursorPos(9,(input + 5))
  59.    print("[")
  60.    term.setCursorPos(40,(input + 5))
  61.    print("]")
  62.     term.setBackgroundColor(colors.black)
  63.  
  64.  
  65.  
  66.  
  67.   options = {
  68. "                              ",
  69. "  ACTIVATE    REACTORS 01-06  ",
  70. "  DEACTIVATE  REACTORS 01-06  ",
  71. "  ACTIVATE    REACTORS 07-12  ",
  72. "  DEACTIVATE  REACTORS 07-12  ",
  73. "  ACTIVATE    BREEDER CORE 1  ",
  74. "  DEACTIVATE  BREEDER CORE 1  ",
  75. "  ACTIVATE    BREEDER CORE 2  ",
  76. "  DEACTIVATE  BREEDER CORE 2  ",
  77. "  -EMERGENCY-  CORE SHUTDOWN  ",
  78. "                              ",
  79. }
  80.  
  81.  
  82. for i = 1, #options do
  83. term.setBackgroundColor(colors.black) -- options background color
  84. term.setTextColor(colors.blue) -- options text color
  85.   drawAt(10,i + 4,options[i])
  86.  end
  87.  
  88.  term.setTextColor(colors.red) -- option text color optional
  89.  drawAt(10,14,"  -EMERGENCY-  CORE SHUTDOWN  ")
  90. end
  91.  
  92.  
  93.  
  94.  
  95.    function events()
  96.    evt, but = os.pullEvent()
  97.      if evt == "key" then
  98.  
  99.  if but == 208 then --down arrow
  100.  input = input + 1
  101.  if input > 9 then
  102.  input = 9
  103.  end
  104.  
  105.  elseif but == 200 then --up arrow
  106.  input = input - 1
  107.  if input < 1 then
  108.  input = 1
  109.  end
  110.  
  111.  elseif but == 28 then --Enter
  112.  if input == 1 then
  113.   c = colors.subtract(c, colors.white)
  114.   rs.setBundledOutput("back",c)
  115.   white = not white
  116.   term.clear()
  117.   setCursorPos(9,9)
  118.   print("********************************")
  119.   print("* ACTIVATED     REACTORS 01-06 *")
  120.   print("********************************")
  121.   sleep(3)
  122.  
  123.  
  124.   elseif input == 2 then
  125.   c = colors.combine(c, colors.white)
  126.   rs.setBundledOutput("back",c)
  127.   white = not white
  128.  term.clear()
  129. setCursorPos(9,10)
  130.   print("********************************")
  131.   print("* DEACTIVATED   REACTORS 01-06 *")
  132.   print("********************************")
  133.   sleep(3)
  134.  
  135.   elseif input == 3 then
  136.   c = colors.subtract(c, colors.black)
  137.   rs.setBundledOutput("back",c)
  138.   black = not black
  139.   term.clear()
  140.   setCursorPos(9,10)
  141.   print("********************************")
  142.   print("* ACTIVATED     REACTORS 07-12 *")
  143.   print("********************************")
  144.   sleep(3)
  145.  
  146.   elseif input == 4 then
  147.   c = colors.combine(c, colors.black)
  148.   rs.setBundledOutput("back",c)
  149.   black = not black
  150.   term.clear()
  151.   setCursorPos(9,10)
  152.   print("********************************")
  153.   print("* DEACTIVATED   REACTORS 07-12 *")
  154.   print("********************************")
  155.   sleep(3)
  156.  
  157.   elseif input == 5 then
  158.   c = colors.subtract(c, colors.red)
  159.   rs.setBundledOutput("back",c)
  160.   red = not red
  161.   term.clear()
  162.   setCursorPos(9,10)
  163.   print("********************************")
  164.   print("* ACTIVATED     BREEDER CORE 1* ")
  165.   print("********************************")
  166.   sleep(3)
  167.  
  168.  
  169.   elseif input == 6 then
  170.   c = colors.combine(c, colors.red)
  171.   rs.setBundledOutput("back",c)
  172.   red = not red
  173.   term.clear()
  174.   setCursorPos(9,10)
  175.   print("********************************")
  176.   print("* DEACTIVATED   BREEDER CORE 1 *")
  177.   print("********************************")
  178.   sleep(3)
  179.  
  180.   elseif input == 7 then
  181.   c = colors.subtract(c, colors.green)
  182.   rs.setBundledOutput("back",c)
  183.   green = not green
  184.   term.clear()
  185.   setCursorPos(9,10)
  186.   print("********************************")
  187.   print("* ACTIVATED     BREEDER CORE 2 *")
  188.   print("********************************")
  189.   sleep(3)
  190.  
  191.   elseif input == 8 then
  192.   c = colors.combine(c, colors.green)
  193.   rs.setBundledOutput("back", c)
  194.   green = not green
  195.   term.clear()
  196.   setCursorPos(9,10)
  197.   print("********************************")
  198.   print("* DEACTIVATED   BREEDER CORE 2 *")
  199.   print("********************************")
  200.   sleep(3)
  201.  
  202.   elseif input == 9 then
  203.   c = colors.combine(colors.green,colors.red,colors.white,colors.black)
  204.   green = false
  205.   red = false
  206.   black = false
  207.   white = false
  208.   rs.setBundledOutput("back", c)
  209.   term.clear()
  210.   setCursorPos(9,10)
  211.   print("********************************")
  212.   print("* EMERGENCY SHUTDOWN INITIATED *")
  213.   print("********************************")
  214.   sleep(3
  215.   end
  216.  
  217. end
  218.    end
  219.      end
  220.  
  221.  function main()
  222.     while true do
  223.       cleanScreen()
  224.        drawArt()
  225.      events() --Handles the menu stuff
  226.  end
  227.     end
  228.  
  229.  
  230. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement