Advertisement
darearkin

Untitled

Apr 1st, 2013
77
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.  
  8. function centerPrint(y,text)
  9.   term.setCursorPos(w/2 - #text/2, y)
  10.     term.write(text)
  11. end
  12.  
  13. function drawAt(x,y,text)
  14.  term.setCursorPos(x,y)
  15. write(text)
  16. end
  17.  
  18. function cleanScreen()
  19. term.clear()
  20.   term.setCursorPos(1,1)
  21.  end
  22.  
  23.  
  24. input = 1
  25.  
  26.  
  27. function drawArt()
  28.  
  29. c = colors.combine(colors.red,colors.black,colors.white,colors.green)
  30. white = false
  31. black = false
  32. green = false
  33. red   = false
  34. rs.setBundledOutput("back", c)
  35.  
  36.   cleanScreen()
  37.   term.setTextColor(colors.lime)
  38.   term.setBackgroundColor(colors.black) --title and title background color
  39.   print[[
  40.  
  41.       VAULT-TEC REACTOR MK 4 CONTROL STATION            
  42.           AUTHORIZED PERSONEL  ONLY!                            
  43.  
  44. ]]
  45.  
  46.  
  47.  for i = 5,19 do
  48.  term.setBackgroundColor(colors.black) -- MAIN BACKGROUND SPAM COLOR
  49.   drawAt(1,i,"                                                   ")
  50.    term.setBackgroundColor(colors.black)
  51.   end
  52.  
  53.   if input == nil then
  54.   input = 1
  55.   end
  56.  
  57.   term.setBackgroundColor(colors.black) -- menu section background
  58.   term.setTextColor(colors.red) -- menu section brackets
  59.    term.setCursorPos(11,input + 5)
  60.    print("[")
  61.    term.setCursorPos(42,input + 5)
  62.    print("]")
  63.     term.setBackgroundColor(colors.black)
  64.  
  65.  
  66.  
  67.  
  68.   options = {
  69. "                              ",
  70. "  ACTIVATE    REACTORS 1 - 3  ",
  71. "  DEACTIVATE  REACTORS 1 - 3  ",
  72. "  ACTIVATE    REACTORS 4 - 6  ",
  73. "  DEACTIVATE  REACTORS 4 - 6  ",
  74. "  ACTIVATE    BREEDER CORE 1  ",
  75. "  DEACTIVATE  BREEDER CORE 1  ",
  76. "  ACTIVATE    BREEDER CORE 2  ",
  77. "  DEACTIVATE  BREEDER CORE 2  ",
  78. "  -EMERGENCY-  CORE SHUTDOWN  ",
  79. "                              ",
  80. }
  81.  
  82.  
  83. for i = 1, #options do
  84. term.setBackgroundColor(colors.black) -- options background color
  85. term.setTextColor(colors.blue) -- options text color
  86.   drawAt(12,i + 4,options[i])
  87.  end
  88.  
  89.  term.setTextColor(colors.red) -- option text color optional
  90.  drawAt(12,14,"  -EMERGENCY-  CORE SHUTDOWN  ")
  91. end
  92.  
  93.  
  94.  
  95.  
  96.    function events()
  97.    evt, but = os.pullEvent()
  98.      if evt == "key" then
  99.  
  100.  if but == 208 then --down arrow
  101.  input = input + 1
  102.  if input > 9 then
  103.  input = 9
  104.  end
  105.  
  106.  elseif but == 200 then --up arrow
  107.  input = input - 1
  108.  if input < 1 then
  109.  input = 1
  110.  end
  111.  
  112.  elseif but == 28 then --Enter
  113.  if input == 1 then
  114.   c = colors.subtract(c, colors.white)
  115.   rs.setBundledOutput("back",c)
  116.   white = not white
  117.  
  118.  
  119.   elseif input == 2 then
  120.   c = colors.combine(c, colors.white)
  121.   rs.setBundledOutput("back",c)
  122.   white = not white
  123.  
  124.  
  125.   elseif input == 3 then
  126.   c = colors.subtract(c, colors.black)
  127.   rs.setBundledOutput("back",c)
  128.   black = not black
  129.  
  130.  
  131.   elseif input == 4 then
  132.   c = colors.combine(c, colors.black)
  133.   rs.setBundledOutput("back",c)
  134.   black = not black
  135.  
  136.  
  137.   elseif input == 5 then
  138.   c = colors.subtract(c, colors.red)
  139.   rs.setBundledOutput("back",c)
  140.   red = not red
  141.  
  142.  
  143.   elseif input == 6 then
  144.   c = colors.combine(c, colors.red)
  145.   rs.setBundledOutput("back",c)
  146.   red = not red
  147.  
  148.  
  149.   elseif input == 7 then
  150.   c = colors.subtract(c, colors.green)
  151.   rs.setBundledOutput("back",c)
  152.   green = not green
  153.  
  154.  
  155.   elseif input == 8 then
  156.   c = colors.combine(c, colors.green)
  157.   rs.setBundledOutput("back", c)
  158.   green = not green
  159.  
  160.  
  161.   elseif input == 0 then
  162.   c = colors.combine(colors.green,colors.red,colors.white,colors.black)
  163.   green = false
  164.   red = false
  165.   black = false
  166.   white = false
  167.   rs.setBundledOutput("back", c)
  168.   end
  169.  
  170. end
  171.    end
  172.      end
  173.  
  174.  function main()
  175.     while true do
  176.       cleanScreen()
  177.        drawArt()
  178.      events() --Handles the menu stuff
  179.  end
  180.     end
  181.  
  182.  
  183. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement