Guest User

Untitled

a guest
Feb 1st, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. white = colors.white
  2. orange = colors.orange
  3. magenta = colors.magenta
  4. lBlue = colors.lightBlue
  5. yellow = colors.yellow
  6. lime = colors.lime
  7. pink = colors.pink
  8. grey = colors.gray
  9. lGrey = colors.lightGray
  10. cyan = colors.cyan
  11. purple = colors.purple
  12. blue = color.blue
  13. brown = colors.brown
  14. green = colors.green
  15. red = colors.red
  16. black = colors.black
  17.  
  18. --[[ Local Variables ]]--
  19.  
  20. local w, h = term.getSize()
  21. local selectedItem = 1
  22. local running = true
  23. howMany = read()
  24.  
  25. --[[ Choice Methods ]]--
  26.  
  27. function hassle()
  28. term.clear()
  29. term.setCursorPos(w/2,3)
  30. print("How Many Materials Would you like?")
  31. term.setCursorPos(w/2, h/2)
  32. end
  33.  
  34. function pulseChoice(itm, value)
  35. for i = 1, value do
  36. sleep(0.5)
  37. rs.setBundledOutput("back", itm)
  38. sleep(0.2)
  39. rs.setBundledOutput("back", 0)
  40. end
  41.  
  42. function Iron()
  43. hassle()
  44. write("Iron: ")
  45. pulseChoice(lime, howMany )
  46. os.reboot()
  47. end
  48.  
  49. function rIron()
  50. hassle()
  51. write("Refined Iron: ")
  52. pulseChoice(white, howMany )
  53. os.reboot()
  54. end
  55.  
  56. function Coal()
  57. hassle()
  58. write("Coal: ")
  59. pulseChoice(orange, howMany)
  60. os.reboot()
  61. end
  62.  
  63. function rStone()
  64. hassle()
  65. write("Redstone: ")
  66. pulseChoice(magenta, howMany)
  67. os.reboot()
  68. end
  69.  
  70. function woodLog()
  71. hassle()
  72. write("Oak Logs: ")
  73. pulseChoice(lBlue, howMany)
  74. os.reboot()
  75. end
  76.  
  77. function woodPlank()
  78. hassle()
  79. write("Wooden Planks: ")
  80. pulseChoice(yellow, howMany)
  81. os.reboot()
  82. end
  83.  
  84. function dMond()
  85. hassle()
  86. write("Diamond: ")
  87. pulseChoice(pink, howMany)
  88. os.reboot()
  89. end
  90.  
  91. function Copper()
  92. hassle()
  93. write("Copper: ")
  94. pulseChoice(grey, howMany)
  95. os.reboot()
  96. end
  97.  
  98. function Tin()
  99. hassle()
  100. write("Tin: ")
  101. pulseChoice(lGrey, howMany)
  102. os.reboot()
  103. end
  104.  
  105. function Gold()
  106. hassle()
  107. write("Gold: ")
  108. pulseChoice(cyan, howMany)
  109. os.rebot()
  110. end
  111.  
  112. function cStone()
  113. hassle()
  114. write("Cobblestone: ")
  115. pulseChoice(purple, howMany)
  116. os.reboot()
  117. end
  118.  
  119. function sStone()
  120. hassle()
  121. write("Stone: ")
  122. pulseChoice(blue, howMany)
  123. os.reboot()
  124. end
  125.  
  126. function cBricks()
  127. hassle()
  128. write("Bricks: ")
  129. pulseChoice(brown, howMany)
  130. os.reboot()
  131. end
  132.  
  133. function rMatter()
  134. hassle()
  135. write("Red Matter: ")
  136. pulseChoice(green, howMany)
  137. os.reboot()
  138. end
  139.  
  140. function dMatter()
  141. hassle()
  142. write("Dark Matter: ")
  143. pulseChoice(red, howMany)
  144. os.reboot()
  145. end
  146.  
  147. function circuit()
  148. hassle()
  149. write("Circuit: ")
  150. pulseChoice(black, howMany)
  151. os.reboot()
  152. end
  153.  
  154. --[[ Choice Definitions ]]--
  155.  
  156. mainChoice = {
  157. [1] = { text = "Iron", handler = Iron() }
  158. [2] = { text = "Refined Iron", handler = rIron() }
  159. [3] = { text = "Coal", handler = Coal() }
  160. [4] = { text = "Redstone", handler = rStone() }
  161. [5] = { text = "Oak Logs", handler = woodLog() }
  162. [6] = { text = "Oak Planks", handler = woodPlank() }
  163. [7] = { text = "Diamond", handler = dMond() }
  164. [8] = { text = "Copper", handler = Copper() }
  165. [9] = { text = "Tin", handler = Tin() }
  166. [10] = { text = "Gold", handler = Gold() }
  167. [11] = { text = "Cobblestone", handler = cStone() }
  168. [12] = { text = "Smooth Stone", handler = sStone() }
  169. [13] = { text = "Bricks", handler = cBricks() }
  170. [14] = { text = "Red Matter", handler = rMatter() }
  171. [15] = { text = "Dark Matter", handler = dMatter() }
  172. [16] = { text = "Circuits", handler = circuit() }
  173. }
  174.  
  175. --[[ Menu Print]]--
  176.  
  177. function printMenu(menu)
  178. for x = 1, #menu do
  179. if x == selectedItem then
  180. print(">> ".. menu[x].text)
  181. else
  182. print(" ".. menu[x].text)
  183. end
  184. end
  185. end
  186.  
  187. --[[Handler Method]]--
  188. function onKeyPressed(key, menu)
  189. if key == keys.enter then
  190. onItemSelected(menu)
  191. elseif key == keys.up then
  192. if selectedItem > 1 then
  193. selectedItem = selectedItem - 1
  194. end
  195. elseif key == keys.down then
  196. if selectedItem > #menu then
  197. selectedItem = selectedItem + 1
  198. end
  199. end
  200. end
  201.  
  202. function onItemSelected(menu)
  203. menu[selectedItem].handler()
  204. end
  205.  
  206. --[[Main Method]]--
  207. function main()
  208. while running do
  209. term.clear()
  210. term.setCursorPos(1,1)
  211. printMenu(mainChoice)
  212. event, key = os.pullevent("key")
  213. onKeyPressed(key,mainChoice)
  214. end
  215. end
  216. main()
Advertisement
Add Comment
Please, Sign In to add comment