Advertisement
darearkin

Untitled

Apr 2nd, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 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 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. term.setCursorPos(9,9)
  118. print("********************************")
  119. term.setCursorPos(9,10)
  120. print("* ACTIVATED REACTORS 01-06 *")
  121. term.setCursorPos(9,11)
  122. print("********************************")
  123. sleep(3)
  124.  
  125.  
  126. elseif input == 2 then
  127. c = colors.combine(c, colors.white)
  128. rs.setBundledOutput("back",c)
  129. white = not white
  130. term.clear()
  131. term.setCursorPos(9,9)
  132. print("********************************")
  133. term.setCursorPos(9,10)
  134. print("* DEACTIVATED REACTORS 01-06 *")
  135. term.setCursorPos(9,11)
  136. print("********************************")
  137. sleep(3)
  138.  
  139. elseif input == 3 then
  140. c = colors.subtract(c, colors.black)
  141. rs.setBundledOutput("back",c)
  142. black = not black
  143. term.clear()
  144. term.setCursorPos(9,9)
  145. print("********************************")
  146. term.setCursorPos(9,10)
  147. print("* ACTIVATED REACTORS 07-12 *")
  148. term.setCursorPos(9,11)
  149. print("********************************")
  150. sleep(3)
  151.  
  152. elseif input == 4 then
  153. c = colors.combine(c, colors.black)
  154. rs.setBundledOutput("back",c)
  155. black = not black
  156. term.clear()
  157. term.setCursorPos(9,9)
  158. print("********************************")
  159. term.setCursorPos(9,10)
  160. print("* ACTIVATED REACTORS 07-12 *")
  161. term.setCursorPos(9,11)
  162. print("********************************")
  163. sleep(3)
  164.  
  165. elseif input == 5 then
  166. c = colors.subtract(c, colors.red)
  167. rs.setBundledOutput("back",c)
  168. red = not red
  169. term.clear()
  170. term.setCursorPos(9,9)
  171. print("********************************")
  172. term.setCursorPos(9,10)
  173. print("* ACTIVATED BREEDER CORE 1* ")
  174. term.setCursorPos(9,11)
  175. print("********************************")
  176. sleep(3)
  177.  
  178.  
  179. elseif input == 6 then
  180. c = colors.combine(c, colors.red)
  181. rs.setBundledOutput("back",c)
  182. red = not red
  183. term.clear()
  184. term.setCursorPos(9,9)
  185. print("********************************")
  186. term.setCursorPos(9,10)
  187. print("* DEACTIVATED BREEDER CORE 1 *")
  188. term.setCursorPos(9,11)
  189. print("********************************")
  190. sleep(3)
  191.  
  192. elseif input == 7 then
  193. c = colors.subtract(c, colors.green)
  194. rs.setBundledOutput("back",c)
  195. green = not green
  196. term.clear()
  197. term.setCursorPos(9,9)
  198. print("********************************")
  199. term.setCursorPos(9,10)
  200. print("* ACTIVATED BREEDER CORE 2 *")
  201. term.setCursorPos(9,11)
  202. print("********************************")
  203. sleep(3)
  204.  
  205. elseif input == 8 then
  206. c = colors.combine(c, colors.green)
  207. rs.setBundledOutput("back", c)
  208. green = not green
  209. term.clear()
  210. term.setCursorPos(9,9)
  211. print("********************************")
  212. term.setCursorPos(9,10)
  213. print("* DEACTIVATED BREEDER CORE 2 *")
  214. term.setCursorPos(9,11)
  215. print("********************************")
  216. sleep(3)
  217.  
  218. elseif input == 9 then
  219. c = colors.combine(colors.green,colors.red,colors.white,colors.black)
  220. green = false
  221. red = false
  222. black = false
  223. white = false
  224. rs.setBundledOutput("back", c)
  225. term.clear()
  226. term.setCursorPos(9,9)
  227. print("********************************")
  228. term.setCursorPos(9,10)
  229. print("* EMERGENCY SHUTDOWN INITIATED *")
  230. term.setCursorPos(9,11)
  231. print("********************************")
  232. sleep(3)
  233. end
  234.  
  235. end
  236. end
  237. end
  238.  
  239. function main()
  240. while true do
  241. cleanScreen()
  242. drawArt()
  243. events() --Handles the menu stuff
  244. end
  245. end
  246.  
  247.  
  248. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement