Advertisement
darearkin

Untitled

Apr 1st, 2013
178
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. if input == 1 then
  58. selected = "[1] ACTIVATE REACTORS 1 - 3 "
  59.  
  60. elseif input == 2 then
  61. selected = " [2] DEACTIVATE REACTORS 1 - 3 "
  62.  
  63. elseif input == 3 then
  64. selected = " [3] ACTIVATE REACTORS 4 - 6 "
  65.  
  66. elseif input == 4 then
  67. selected = " [4] DEACTIVATE REACTORS 4 - 6 "
  68.  
  69. elseif input == 5 then
  70. selected = " [5] ACTIVATE BREEDER CORE 1 "
  71.  
  72. elseif input == 6 then
  73. selected = " [6] DEACTIVATE BREEDER CORE 1 "
  74.  
  75. elseif input == 7 then
  76. selected = " [7] ACTIVATE BREEDER CORE 2 "
  77.  
  78. elseif input == 8 then
  79. selected = " [8] DEACTIVATE BREEDER CORE 2 "
  80.  
  81. elseif input == 9 then
  82. selected = " [0] -EMERGENCY- CORE SHUTDOWN "
  83. end
  84.  
  85. term.setBackgroundColor(colors.black) --selection cover?
  86. drawAt(7,13," ")
  87.  
  88. term.setBackgroundColor(colors.black) -- menu section background
  89. term.setTextColor(colors.red) -- menu section brackets
  90. term.setCursorPos(10,input + 3)
  91. print("[")
  92. term.setCursorPos(40,input + 3)
  93. print("]")
  94. term.setBackgroundColor(colors.black)
  95.  
  96.  
  97.  
  98.  
  99. options = {
  100. " ",
  101. " [1] ACTIVATE REACTORS 1 - 3",
  102. " [2] DEACTIVATE REACTORS 1 - 3 ",
  103. " [3] ACTIVATE REACTORS 4 - 6",
  104. " [4] DEACTIVATE REACTORS 4 - 6 ",
  105. " [5] ACTIVATE BREEDER CORE 1",
  106. " [6] DEACTIVATE BREEDER CORE 1 ",
  107. " [7] ACTIVATE BREEDER CORE 2",
  108. " [8] DEACTIVATE BREEDER CORE 2 ",
  109. " [0] -EMERGENCY- CORE SHUTDOWN ",
  110. " ",
  111. }
  112.  
  113.  
  114. for i = 1, #options do
  115. term.setBackgroundColor(colors.black) -- options background color
  116. term.setTextColor(colors.blue) -- options text color
  117. drawAt(10,i + 4,options[i])
  118. end
  119.  
  120. term.setTextColor(colors.red) -- option text color optional
  121. drawAt(10,14," [0] -EMERGENCY- CORE SHUTDOWN")
  122. end
  123.  
  124.  
  125.  
  126.  
  127. function events()
  128. evt, but = os.pullEvent()
  129. if evt == "key" then
  130.  
  131. if but == 208 then --down arrow
  132. input = input + 1
  133. if input > 9 then
  134. input = 9
  135. end
  136.  
  137. elseif but == 200 then --up arrow
  138. input = input - 1
  139. if input < 1 then
  140. input = 1
  141. end
  142.  
  143. elseif but == 28 then --Enter
  144. if input == 1 then
  145. c = colors.subtract(c, colors.white)
  146. rs.setBundledOutput("back",c)
  147. white = not white
  148.  
  149.  
  150. elseif input == 2 then
  151. c = colors.combine(c, colors.white)
  152. rs.setBundledOutput("back",c)
  153. white = not white
  154.  
  155.  
  156. elseif input == 3 then
  157. c = colors.subtract(c, colors.black)
  158. rs.setBundledOutput("back",c)
  159. black = not black
  160.  
  161.  
  162. elseif input == 4 then
  163. c = colors.combine(c, colors.black)
  164. rs.setBundledOutput("back",c)
  165. black = not black
  166.  
  167.  
  168. elseif input == 5 then
  169. c = colors.subtract(c, colors.red)
  170. rs.setBundledOutput("back",c)
  171. red = not red
  172.  
  173.  
  174. elseif input == 6 then
  175. c = colors.combine(c, colors.red)
  176. rs.setBundledOutput("back",c)
  177. red = not red
  178.  
  179.  
  180. elseif input == 7 then
  181. c = colors.subtract(c, colors.green)
  182. rs.setBundledOutput("back",c)
  183. green = not green
  184.  
  185.  
  186. elseif input == 8 then
  187. c = colors.combine(c, colors.green)
  188. rs.setBundledOutput("back", c)
  189. green = not green
  190.  
  191.  
  192. elseif input == 0 then
  193. c = colors.combine(colors.green,colors.red,colors.white,colors.black)
  194. green = false
  195. red = false
  196. black = false
  197. white = false
  198. rs.setBundledOutput("back", c)
  199. end
  200.  
  201. end
  202. end
  203. end
  204.  
  205. function main()
  206. while true do
  207. cleanScreen()
  208. drawArt()
  209. events() --Handles the menu stuff
  210. end
  211. end
  212.  
  213.  
  214. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement