Advertisement
Himitsu_Chan

Untitled

Feb 13th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.39 KB | None | 0 0
  1. CIE = 0 -- Counter Ingot Engine
  2. CBE = 0 -- Counter Block Engine
  3. CLI = 0 -- Counter Liquid Input
  4. CLO = 0 -- Counter Liquid Output
  5. CIN = 0 -- Counter Ingot Number
  6. CIC = 0 -- Counter Ingot Crafting (how many ingots are made.)
  7. CBN = 0 -- Counter Block Number
  8. CBC = 0 -- Counter Block Crafting (how many Blocks are made.)
  9.  
  10. mouseWidth = 0 -- Create MouseWidth Variable
  11. mouseHeight = 0 -- Create MouseHeight Variable
  12. monitor = peripheral.wrap("monitor_0") -- Wrap monitor_0 monitor to "monitor"
  13.  
  14. monitor.setBackgroundColour((colors.black)) -- Return to standart color BEFORE clearing the screen
  15. monitor.clear() -- Clear Monitor
  16. monitor.setCursorPos(1,1) -- Set Cursor to Pos 1,1
  17.  
  18. w,h=monitor.getSize() -- set W to Width of Monitor and H to Height
  19.  
  20. print(w) -- Print Width
  21. print(h) -- Print Height
  22.  
  23. monitor.setCursorPos(1,1)
  24. monitor.write("Ingot Engines:")
  25.  
  26. monitor.setCursorPos(1,3)
  27. monitor.write("Block Engines:")
  28.  
  29. monitor.setCursorPos(16,1)
  30. monitor.write("Filling Buffer Smeltery:")
  31.  
  32. monitor.setCursorPos(16,3)
  33. monitor.write("Empying Buffer Smeltery:")
  34.  
  35. monitor.setCursorPos(1, 7)
  36. monitor.write("Ingot Casting:")
  37.  
  38. monitor.setCursorPos(1, 10)
  39. monitor.write("Block Casting:")
  40.  
  41. monitor.setBackgroundColour((colours.lime)) -- Set monitor Background Color For button creation
  42.  
  43. monitor.setCursorPos(4,2) -- Set Cursor postion to (2,2)
  44. monitor.write(" OFF ") -- (Write what ever needs to be 5 characters.)
  45.  
  46. monitor.setCursorPos(4,4)
  47. monitor.write(" OFF ")
  48.  
  49. monitor.setCursorPos(24,2)
  50. monitor.write(" OFF ")
  51.  
  52. monitor.setCursorPos(24,4)
  53. monitor.write(" OFF ")
  54.  
  55. monitor.setCursorPos(4,8)
  56. monitor.write("SELECT")
  57.  
  58. monitor.setCursorPos(4,11)
  59. monitor.write("SELECT")
  60.  
  61. monitor.setBackgroundColour((colors.gray))
  62.  
  63. monitor.setCursorPos(2,8)
  64. monitor.write("<-")
  65.  
  66. monitor.setCursorPos(10,8)
  67. monitor.write("->")
  68.  
  69. monitor.setCursorPos(2,11)
  70. monitor.write("<-")
  71.  
  72. monitor.setCursorPos(10,11)
  73. monitor.write("->")
  74.  
  75.  
  76. monitor.setBackgroundColour((colours.black)) -- Set Background color to black
  77.  
  78.  
  79. function checkClickPosition()
  80. if mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 2 then
  81. -- button one clicked
  82. if CIE == 0 then
  83. shell.run("IE") -- Run program IE
  84. monitor.setBackgroundColour((colours.red)) -- Set Background color red
  85. monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  86. monitor.write(" ON ") -- rewrite IE
  87. CIE = 1
  88. elseif CIE == 1 then
  89. shell.run("SIE")
  90. monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  91. monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  92. monitor.write(" OFF ") -- rewrite IE
  93. CIE = 0
  94. end
  95.  
  96. elseif mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 4 then
  97. if CBE == 0 then
  98. shell.run("BE") -- Run program BE
  99. monitor.setBackgroundColour((colours.red)) -- Set Background color red
  100. monitor.setCursorPos(4,4) -- set cursor pos to rewrite IE
  101. monitor.write(" ON ") -- rewrite ON
  102. CBE = 1
  103. elseif CBE == 1 then
  104. shell.run("SBE") -- Run program SBE
  105. monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  106. monitor.setCursorPos(4,4) -- set cursor pos to rewrite BE
  107. monitor.write(" OFF ") -- rewrite OFF
  108. CBE = 0
  109. end
  110.  
  111. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 2 then
  112. if CLI == 0 then
  113. shell.run("LI") -- Run program LI
  114. monitor.setBackgroundColour((colours.red)) -- Set Background color red
  115. monitor.setCursorPos(24,2) -- set cursor pos to rewrite ON
  116. monitor.write(" ON ") -- rewrite ON
  117. CLI = 1
  118. elseif CLI == 1 then
  119. shell.run("SLI") -- Run program SLI
  120. monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  121. monitor.setCursorPos(24,2) -- set cursor pos to rewrite OFF
  122. monitor.write(" OFF ") -- rewrite OFF
  123. CLI = 0
  124. end
  125.  
  126. elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 4 then
  127. if CLO == 0 then
  128. shell.run("LO") -- Run program LO
  129. monitor.setBackgroundColour((colours.red)) -- Set Background color red
  130. monitor.setCursorPos(24,4) -- set cursor pos to rewrite ON
  131. monitor.write(" ON ") -- rewrite ON
  132. CLO = 1
  133. elseif CLO == 1 then
  134. shell.run("SLO") -- Run program SLO
  135. monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  136. monitor.setCursorPos(24,4) -- set cursor pos to rewrite OFF
  137. monitor.write(" OFF ") -- rewrite OFF
  138. CLO = 0
  139. end
  140.  
  141. elseif mouseWidth > 1 and mouseWidth < 3 and mouseHeight == 8 then
  142. if CIN > 0 then -- if the page counter is over 0
  143. CIN = CIN - 1 -- then subtract 1 from it
  144. else
  145. CIN = 0 -- If the page counter is at 0 make it 0
  146. end
  147. if CIN == 0 then -- When the Page counter is on 0
  148. monitor.setCursorPos(4,8)
  149. monitor.setBackgroundColour((colours.lime))
  150. monitor.write(" 1I ")
  151. CIC = 1
  152.  
  153. elseif CIN == 1 then -- When the page counter is on 1
  154. monitor.setCursorPos(4,8)
  155. monitor.setBackgroundColour((colours.lime))
  156. monitor.write(" 3I ")
  157. CIC = 3
  158.  
  159. elseif CIN == 2 then
  160. monitor.setCursorPos(4,8)
  161. monitor.setBackgroundColour((colours.lime))
  162. monitor.write(" 9I ")
  163. CIC = 9
  164.  
  165. elseif CIN == 3 then
  166. monitor.setCursorPos(4,8)
  167. monitor.setBackgroundColour((colours.lime))
  168. monitor.write(" 15I ")
  169. CIC = 15
  170. end
  171.  
  172. elseif mouseWidth > 9 and mouseWidth < 11 and mouseHeight == 8 then
  173. if CIN < 3 then -- if the page counter is under 3
  174. CIN = CIN + 1 -- Then add 1 to it
  175. else
  176. CIN = 3 -- if the page counter is over 3 make it 3
  177. end
  178.  
  179. if CIN == 0 then
  180. monitor.setCursorPos(4,8)
  181. monitor.setBackgroundColour((colours.lime))
  182. monitor.write(" 1I ")
  183. CIC = 1
  184.  
  185. elseif CIN == 1 then
  186. monitor.setCursorPos(4,8)
  187. monitor.setBackgroundColour((colours.lime))
  188. monitor.write(" 3I ")
  189. CIC = 3
  190.  
  191. elseif CIN == 2 then
  192. monitor.setCursorPos(4,8)
  193. monitor.setBackgroundColour((colours.lime))
  194. monitor.write(" 9I ")
  195. CIC = 9
  196.  
  197. elseif CIN == 3 then
  198. monitor.setCursorPos(4,8)
  199. monitor.setBackgroundColour((colours.lime))
  200. monitor.write(" 15I ")
  201. CIC = 15
  202. end
  203.  
  204. elseif mouseWidth > 2 and mouseWidth < 10 and mouseHeight == 8 then
  205. if CIC == 1 then
  206. shell.run("1I")
  207. monitor.setCursorPos(4,8)
  208. monitor.setBackgroundColour((colors.red))
  209. monitor.write(" 1I ")
  210. sleep(2)
  211. monitor.setCursorPos(4,8)
  212. monitor.setBackgroundColour((colors.lime))
  213. monitor.write(" 1I ")
  214.  
  215. elseif CIC == 3 then
  216. shell.run("3I")
  217. monitor.setCursorPos(4,8)
  218. monitor.setBackgroundColour((colors.red))
  219. monitor.write(" 3I ")
  220. sleep(2)
  221. monitor.setCursorPos(4,8)
  222. monitor.setBackgroundColour((colors.lime))
  223. monitor.write(" 3I ")
  224.  
  225. elseif CIC == 9 then
  226. shell.run("9I")
  227. monitor.setCursorPos(4,8)
  228. monitor.setBackgroundColour((colors.red))
  229. monitor.write(" 9I ")
  230. sleep(2)
  231. monitor.setCursorPos(4,8)
  232. monitor.setBackgroundColour((colors.lime))
  233. monitor.write(" 9I ")
  234.  
  235. elseif CIC == 15 then
  236. shell.run("15I")
  237. monitor.setCursorPos(4,8)
  238. monitor.setBackgroundColour((colors.red))
  239. monitor.write(" 15I ")
  240. sleep(2)
  241. monitor.setCursorPos(4,8)
  242. monitor.setBackgroundColour((colors.lime))
  243. monitor.write(" 15I ")
  244. end
  245.  
  246. elseif mouseWidth > 1 and mouseWidth < 3 and mouseHeight == 11 then
  247. if CBN > 0 then -- if the page counter is over 0
  248. CBN = CBN - 1 -- then subtract 1 from it
  249. else
  250. CBN = 0 -- If the page counter is at 0 make it 0
  251. end
  252. if CBN == 0 then -- When the Page counter is on 0
  253. monitor.setCursorPos(4,11)
  254. monitor.setBackgroundColour((colours.lime))
  255. monitor.write(" 1B ")
  256. CBC = 1
  257.  
  258. elseif CBN == 1 then -- When the page counter is on 1
  259. monitor.setCursorPos(4,11)
  260. monitor.setBackgroundColour((colours.lime))
  261. monitor.write(" 3B ")
  262. CBC = 3
  263.  
  264. elseif CBN == 2 then
  265. monitor.setCursorPos(4,11)
  266. monitor.setBackgroundColour((colours.lime))
  267. monitor.write(" 9B ")
  268. CBC = 9
  269.  
  270. elseif CIN == 3 then
  271. monitor.setCursorPos(4,11)
  272. monitor.setBackgroundColour((colours.lime))
  273. monitor.write(" 15B ")
  274. CBC = 15
  275. end
  276.  
  277. elseif mouseWidth > 9 and mouseWidth < 11 and mouseHeight == 11 then
  278. if CBN < 3 then -- if the page counter is under 3
  279. CBN = CBN + 1 -- Then add 1 to it
  280. else
  281. CBN = 3 -- if the page counter is over 3 make it 3
  282. end
  283.  
  284. if CBN == 0 then
  285. monitor.setCursorPos(4,11)
  286. monitor.setBackgroundColour((colours.lime))
  287. monitor.write(" 1B ")
  288. CBC = 1
  289.  
  290. elseif CBN == 1 then
  291. monitor.setCursorPos(4,11)
  292. monitor.setBackgroundColour((colours.lime))
  293. monitor.write(" 3B ")
  294. CBC = 3
  295.  
  296. elseif CBN == 2 then
  297. monitor.setCursorPos(4,11)
  298. monitor.setBackgroundColour((colours.lime))
  299. monitor.write(" 9B ")
  300. CBC = 9
  301.  
  302. elseif CBN == 3 then
  303. monitor.setCursorPos(4,11)
  304. monitor.setBackgroundColour((colours.lime))
  305. monitor.write(" 15B ")
  306. CBC = 15
  307. end
  308.  
  309. elseif mouseWidth > 2 and mouseWidth < 10 and mouseHeight == 11 then
  310. if CBN == 1 then
  311. shell.run("1B")
  312. monitor.setCursorPos(4,11)
  313. monitor.setBackgroundColour((colors.red))
  314. monitor.write(" 1B ")
  315. sleep(2)
  316. monitor.setCursorPos(4,11)
  317. monitor.setBackgroundColour((colors.lime))
  318. monitor.write(" 1B ")
  319.  
  320. elseif CBC == 3 then
  321. shell.run("3B")
  322. monitor.setCursorPos(4,11)
  323. monitor.setBackgroundColour((colors.red))
  324. monitor.write(" 3B ")
  325. sleep(2)
  326. monitor.setCursorPos(4,11)
  327. monitor.setBackgroundColour((colors.lime))
  328. monitor.write(" 3B ")
  329.  
  330. elseif CBC == 9 then
  331. shell.run("9B")
  332. monitor.setCursorPos(4,11)
  333. monitor.setBackgroundColour((colors.red))
  334. monitor.write(" 9B ")
  335. sleep(2)
  336. monitor.setCursorPos(4,11)
  337. monitor.setBackgroundColour((colors.lime))
  338. monitor.write(" 9B ")
  339.  
  340. elseif CBC == 15 then
  341. shell.run("15B")
  342. monitor.setCursorPos(4,11)
  343. monitor.setBackgroundColour((colors.red))
  344. monitor.write(" 15B ")
  345. sleep(2)
  346. monitor.setCursorPos(4,11)
  347. monitor.setBackgroundColour((colors.lime))
  348. monitor.write(" 15B ")
  349. end
  350. end -- ends the if loop
  351. end -- ends the function
  352.  
  353. repeat
  354.  
  355.  
  356. event,p1,p2,p3 = os.pullEvent() -- Get Event data. event,p1,p2,p3 from os.pullEvent()
  357.  
  358. if event=="monitor_touch" then -- Event Mouse_touch (right click monitor)
  359.  
  360. mouseWidth = p2 -- sets mouseWidth -- Set Mouse Width to p2
  361. mouseHeight = p3 -- and mouseHeight -- Set Mouse Height to p3
  362. checkClickPosition() -- this runs our function -- Runs the pervious CheckClickPosition Function
  363.  
  364. end -- End the IF statement
  365.  
  366. 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