Guest User

startup

a guest
Apr 2nd, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.64 KB | None | 0 0
  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 1 - 3  ",
  70. "  DEACTIVATE  REACTORS 1 - 3  ",
  71. "  ACTIVATE    REACTORS 4 - 6  ",
  72. "  DEACTIVATE  REACTORS 4 - 6  ",
  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.  
  117.  
  118.   elseif input == 2 then
  119.   c = colors.combine(c, colors.white)
  120.   rs.setBundledOutput("back",c)
  121.   white = not white
  122.  
  123.  
  124.   elseif input == 3 then
  125.   c = colors.subtract(c, colors.black)
  126.   rs.setBundledOutput("back",c)
  127.   black = not black
  128.  
  129.  
  130.   elseif input == 4 then
  131.   c = colors.combine(c, colors.black)
  132.   rs.setBundledOutput("back",c)
  133.   black = not black
  134.  
  135.  
  136.   elseif input == 5 then
  137.   c = colors.subtract(c, colors.red)
  138.   rs.setBundledOutput("back",c)
  139.   red = not red
  140.  
  141.  
  142.   elseif input == 6 then
  143.   c = colors.combine(c, colors.red)
  144.   rs.setBundledOutput("back",c)
  145.   red = not red
  146.  
  147.  
  148.   elseif input == 7 then
  149.   c = colors.subtract(c, colors.green)
  150.   rs.setBundledOutput("back",c)
  151.   green = not green
  152.  
  153.  
  154.   elseif input == 8 then
  155.   c = colors.combine(c, colors.green)
  156.   rs.setBundledOutput("back", c)
  157.   green = not green
  158.  
  159.  
  160.   elseif input == 9 then
  161.   c = colors.combine(colors.green,colors.red,colors.white,colors.black)
  162.   green = false
  163.   red = false
  164.   black = false
  165.   white = false
  166.   rs.setBundledOutput("back", c)
  167.   end
  168.  
  169. end
  170.    end
  171.      end
  172.  
  173.  function main()
  174.     while true do
  175.       cleanScreen()
  176.        drawArt()
  177.      events() --Handles the menu stuff
  178.  end
  179.     end
  180.  
  181.  
  182. main()
Advertisement
Add Comment
Please, Sign In to add comment