Advertisement
Himitsu_Chan

Untitled

Feb 15th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. CMO = 0 -- Counter Metal Input
  2. CES = 0 -- Counter Empty Smeltery
  3.  
  4. mouseWidth = 0 -- Create MouseWidth Variable
  5. mouseHeight = 0 -- Create MouseHeight Variable
  6. monitor = peripheral.wrap("monitor_1") -- Wrap monitor_0 monitor to "monitor"
  7.  
  8. monitor.setBackgroundColour((colors.black)) -- Return to standart color BEFORE clearing the screen
  9. monitor.clear() -- Clear Monitor
  10. monitor.setCursorPos(1,1) -- Set Cursor to Pos 1,1
  11.  
  12. w,h=monitor.getSize() -- set W to Width of Monitor and H to Height
  13.  
  14. print(w) -- Print Width
  15. print(h) -- Print Height
  16.  
  17. monitor.setBackgroundColour((colours.lime)) -- Set monitor Background Color For button creation
  18.  
  19. monitor.setCursorPos(2,2)
  20. monitor.write(" Iron ")
  21.  
  22. monitor.setCursorPos(2,4)
  23. monitor.write(" Invar ")
  24.  
  25. monitor.setCursorPos(2,6)
  26. monitor.write(" Obsidn")
  27.  
  28. monitor.setCursorPos(2,8)
  29. monitor.write(" Gold ")
  30.  
  31. monitor.setCursorPos(2,10)
  32. monitor.write(" Nickel")
  33.  
  34. monitor.setCursorPos(2,12)
  35. monitor.write(" Alminm")
  36.  
  37. monitor.setCursorPos(2,14)
  38. monitor.write(" Tin ")
  39.  
  40. monitor.setCursorPos(2,16)
  41. monitor.write(" Shiny ")
  42.  
  43. monitor.setCursorPos(11,2) -- Set Cursor postion to (2,2)
  44. monitor.write(" Empty ") -- (Write what ever needs to be 7 characters.)
  45.  
  46. monitor.setCursorPos(11,4)
  47. monitor.write(" Copper")
  48.  
  49. monitor.setCursorPos(11,6)
  50. monitor.write(" Lead ")
  51.  
  52. monitor.setCursorPos(11,8)
  53. monitor.write(" Elctrm")
  54.  
  55. monitor.setCursorPos(11,10)
  56. monitor.write(" Alumte")
  57.  
  58. monitor.setCursorPos(11,12)
  59. monitor.write(" Silver")
  60.  
  61. monitor.setCursorPos(11,14)
  62. monitor.write(" Red A ")
  63.  
  64. monitor.setCursorPos(11,16)
  65. monitor.write(" ResEnd")
  66.  
  67.  
  68. monitor.setBackgroundColour((colours.black)) -- Set Background color to black
  69.  
  70.  
  71. function checkClickPosition()
  72. if mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 2 then
  73. -- button one clicked
  74. if CMO == 0 then
  75. shell.run("Iron") -- Run program IE
  76. monitor.setBackgroundColour((colours.red)) -- Set Background color red
  77. monitor.setCursorPos(2,2) -- set cursor pos to rewrite IE
  78. monitor.write(" Iron ") -- rewrite IE
  79. CMO = 1
  80. elseif CMO == 1 then
  81. shell.run("Stop")
  82. monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  83. monitor.setCursorPos(2,2) -- set cursor pos to rewrite IE
  84. monitor.write(" Iron ") -- rewrite IE
  85. CMO = 0
  86. end
  87. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 4 then
  88.  
  89. if CMO == 0 then
  90. shell.run("Invar")
  91. monitor.setBackgroundColour((colours.red))
  92. monitor.setCursorPos(2,4)
  93. monitor.write(" Invar ")
  94. CMO = 1
  95. elseif CMO == 1 then
  96. shell.run("Stop")
  97. monitor.setBackgroundColour((colours.lime))
  98. monitor.setCursorPos(2,4)
  99. monitor.write(" Invar ")
  100. CMO = 0
  101. end
  102.  
  103. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 6 then
  104.  
  105. if CMO == 0 then
  106. shell.run("Obsidian")
  107. monitor.setBackgroundColour((colours.red))
  108. monitor.setCursorPos(2,6)
  109. monitor.write(" Obsidn")
  110. CMO = 1
  111. elseif CMO == 1 then
  112. shell.run("Stop")
  113. monitor.setBackgroundColour((colours.lime))
  114. monitor.setCursorPos(2,6)
  115. monitor.write(" Obsidn")
  116. CMO = 0
  117. end
  118.  
  119. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 8 then
  120.  
  121. if CMO == 0 then
  122. shell.run("Gold")
  123. monitor.setBackgroundColour((colours.red))
  124. monitor.setCursorPos(2,8)
  125. monitor.write(" Gold ")
  126. CMO = 1
  127. elseif CMO == 1 then
  128. shell.run("Stop")
  129. monitor.setBackgroundColour((colours.lime))
  130. monitor.setCursorPos(2,8)
  131. monitor.write(" Gold ")
  132. CMO = 0
  133. end
  134.  
  135. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 10 then
  136.  
  137. if CMO == 0 then
  138. shell.run("Nickel")
  139. monitor.setBackgroundColour((colours.red))
  140. monitor.setCursorPos(2,10)
  141. monitor.write(" Nickel")
  142. CMO = 1
  143. elseif CMO == 1 then
  144. shell.run("Stop")
  145. monitor.setBackgroundColour((colours.lime))
  146. monitor.setCursorPos(2,10)
  147. monitor.write(" Nickel")
  148. CMO = 0
  149. end
  150.  
  151. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 12 then
  152.  
  153. if CMO == 0 then
  154. shell.run("Aluminum")
  155. monitor.setBackgroundColour((colours.red))
  156. monitor.setCursorPos(2,12)
  157. monitor.write(" Alminm")
  158. CMO = 1
  159. elseif CMO == 1 then
  160. shell.run("Stop")
  161. monitor.setBackgroundColour((colours.lime))
  162. monitor.setCursorPos(2,12)
  163. monitor.write(" Alminm")
  164. CMO = 0
  165. end
  166.  
  167. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 14 then
  168.  
  169. if CMO == 0 then
  170. shell.run("Tin")
  171. monitor.setBackgroundColour((colours.red))
  172. monitor.setCursorPos(2,14)
  173. monitor.write(" Tin ")
  174. CMO = 1
  175. elseif CMO == 1 then
  176. shell.run("Stop")
  177. monitor.setBackgroundColour((colours.lime))
  178. monitor.setCursorPos(2,14)
  179. monitor.write(" Tin ")
  180. CMO = 0
  181. end
  182.  
  183. elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 16 then
  184.  
  185. if CMO == 0 then
  186. shell.run("Shiny")
  187. monitor.setBackgroundColour((colours.red))
  188. monitor.setCursorPos(2,16)
  189. monitor.write(" Shiny ")
  190. CMO = 1
  191. elseif CMO == 1 then
  192. shell.run("Stop")
  193. monitor.setBackgroundColour((colours.lime))
  194. monitor.setCursorPos(2,16)
  195. monitor.write(" Shiny ")
  196. CMO = 0
  197. end
  198.  
  199. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 4 then
  200.  
  201. if CMO == 0 then
  202. shell.run("Copper")
  203. monitor.setBackgroundColour((colours.red))
  204. monitor.setCursorPos(11,4)
  205. monitor.write(" Copper")
  206. CMO = 1
  207. elseif CMO == 1 then
  208. shell.run("Stop")
  209. monitor.setBackgroundColour((colours.lime))
  210. monitor.setCursorPos(11,4)
  211. monitor.write(" Copper")
  212. CMO = 0
  213. end
  214.  
  215. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 6 then
  216.  
  217. if CMO == 0 then
  218. shell.run("Lead")
  219. monitor.setBackgroundColour((colours.red))
  220. monitor.setCursorPos(11,6)
  221. monitor.write(" Lead ")
  222. CMO = 1
  223. elseif CMO == 1 then
  224. shell.run("Stop")
  225. monitor.setBackgroundColour((colours.lime))
  226. monitor.setCursorPos(11,6)
  227. monitor.write(" Lead ")
  228. CMO = 0
  229. end
  230.  
  231. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 8 then
  232.  
  233. if CMO == 0 then
  234. shell.run("Elctrm")
  235. monitor.setBackgroundColour((colours.red))
  236. monitor.setCursorPos(11,8)
  237. monitor.write(" Elctrm")
  238. CMO = 1
  239. elseif CMO == 1 then
  240. shell.run("Stop")
  241. monitor.setBackgroundColour((colours.lime))
  242. monitor.setCursorPos(11,8)
  243. monitor.write(" Elctrm")
  244. CMO = 0
  245. end
  246.  
  247. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 10 then
  248.  
  249. if CMO == 0 then
  250. shell.run("Alumite")
  251. monitor.setBackgroundColour((colours.red))
  252. monitor.setCursorPos(11,10)
  253. monitor.write(" Alumte")
  254. CMO = 1
  255. elseif CMO == 1 then
  256. shell.run("Stop")
  257. monitor.setBackgroundColour((colours.lime))
  258. monitor.setCursorPos(11,10)
  259. monitor.write(" Alumte")
  260. CMO = 0
  261. end
  262.  
  263. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 12 then
  264.  
  265. if CMO == 0 then
  266. shell.run("Silver")
  267. monitor.setBackgroundColour((colours.red))
  268. monitor.setCursorPos(11,12)
  269. monitor.write(" Silver")
  270. CMO = 1
  271. elseif CMO == 1 then
  272. shell.run("Stop")
  273. monitor.setBackgroundColour((colours.lime))
  274. monitor.setCursorPos(11,12)
  275. monitor.write(" Silver")
  276. CMO = 0
  277. end
  278.  
  279. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 14 then
  280.  
  281. if CMO == 0 then
  282. shell.run("Red")
  283. monitor.setBackgroundColour((colours.red))
  284. monitor.setCursorPos(11,14)
  285. monitor.write(" Red A ")
  286. CMO = 1
  287. elseif CMO == 1 then
  288. shell.run("Stop")
  289. monitor.setBackgroundColour((colours.lime))
  290. monitor.setCursorPos(11,14)
  291. monitor.write(" Red A ")
  292. CMO = 0
  293. end
  294.  
  295. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 16 then
  296.  
  297. if CMO == 0 then
  298. shell.run("ResEnd")
  299. monitor.setBackgroundColour((colours.red))
  300. monitor.setCursorPos(11,16)
  301. monitor.write(" ResEnd")
  302. CMO = 1
  303. elseif CMO == 1 then
  304. shell.run("Stop")
  305. monitor.setBackgroundColour((colours.lime))
  306. monitor.setCursorPos(11,16)
  307. monitor.write(" ResEnd")
  308. CMO = 0
  309. end
  310.  
  311. elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 2 then
  312.  
  313. if CES == 0 then
  314. shell.run("Empty")
  315. monitor.setBackgroundColour((colours.red))
  316. monitor.setCursorPos(11,2)
  317. monitor.write(" Empty ")
  318. CES = 1
  319. elseif CES == 1 then
  320. shell.run("Stop")
  321. monitor.setBackgroundColour((colours.lime))
  322. monitor.setCursorPos(11,2)
  323. monitor.write(" Empty ")
  324. CES = 0
  325. end
  326. end -- ends the if loop
  327. end -- ends the function
  328.  
  329. repeat
  330.  
  331.  
  332. event,p1,p2,p3 = os.pullEvent() -- Get Event data. event,p1,p2,p3 from os.pullEvent()
  333.  
  334. if event=="monitor_touch" then -- Event Mouse_touch (right click monitor)
  335.  
  336. mouseWidth = p2 -- sets mouseWidth -- Set Mouse Width to p2
  337. mouseHeight = p3 -- and mouseHeight -- Set Mouse Height to p3
  338. checkClickPosition() -- this runs our function -- Runs the pervious CheckClickPosition Function
  339.  
  340. end -- End the IF statement
  341.  
  342. until event=="char" and p1==("x") -- Until the event "char" position 1 is X (aka when X is pressed) the programm will loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement