Advertisement
Himitsu_Chan

Untitled

Feb 13th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  6. mouseWidth = 0 -- Create MouseWidth Variable
  7. mouseHeight = 0 -- Create MouseHeight Variable
  8. monitor = peripheral.wrap("monitor_0") -- Wrap monitor_0 monitor to "monitor"
  9.  
  10. monitor.clear() -- Clear Monitor
  11. monitor.setCursorPos(1,1) -- Set Cursor to Pos 1,1
  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.setCursorPos(1,1)
  18. monitor.write("Ingot Engines:")
  19.  
  20. monitor.setCursorPos(1,3)
  21. monitor.write("Block Engines:")
  22.  
  23. monitor.setCursorPos(16,1)
  24. monitor.write("Filling Buffer Smeltery:")
  25.  
  26. monitor.setCursorPos(16,3)
  27. monitor.write("Empying Buffer Smeltery:")
  28.  
  29. monitor.setCursorPos(1, 7)
  30. monitor.write("Ingot Casting:")
  31.  
  32. monitor.setCursorPos(1, 10)
  33. monitor.write("Block Casting:")
  34.  
  35. monitor.setBackgroundColour((colours.lime)) -- Set monitor Background Color For button creation
  36.  
  37. monitor.setCursorPos(4,2) -- Set Cursor postion to (2,2)
  38. monitor.write(" OFF ") -- (Write what ever needs to be 5 characters.)
  39.  
  40. monitor.setCursorPos(4,4)
  41. monitor.write(" OFF ")
  42.  
  43. monitor.setCursorPos(24,2)
  44. monitor.write(" OFF ")
  45.  
  46. monitor.setCursorPos(24,4)
  47. monitor.write(" OFF ")
  48.  
  49. monitor.setCursorPos(2,8)
  50. monitor.write(" 1I  ")
  51.  
  52. monitor.setCursorPos(13,8)
  53. monitor.write(" 3I  ")
  54.  
  55. monitor.setCursorPos(24,8)
  56. monitor.write(" 9I  ")
  57.  
  58. monitor.setCursorPos(35,8)
  59. monitor.write(" 15I ")
  60.  
  61. monitor.setCursorPos(2,11)
  62. monitor.write(" 1B  ")
  63.  
  64. monitor.setCursorPos(13,11)
  65. monitor.write(" 3B  ")
  66.  
  67. monitor.setCursorPos(24,11)
  68. monitor.write(" 9B  ")
  69.  
  70. monitor.setCursorPos(35,11)
  71. monitor.write(" 15B ")
  72.  
  73.  
  74. monitor.setBackgroundColour((colours.black)) -- Set Background color to black
  75.  
  76.  
  77. function checkClickPosition()
  78.   if mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 2 then
  79.     -- button one clicked
  80.     if CIE == 0 then
  81.         shell.run("IE") -- Run program IE
  82.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  83.         monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  84.         monitor.write(" ON  ") -- rewrite IE
  85.         CIE = 1
  86.     elseif CIE == 1 then
  87.         shell.run("SIE")
  88.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  89.         monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  90.         monitor.write(" OFF ") -- rewrite IE
  91.         CIE = 0
  92.     end
  93.    
  94.   elseif mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 4 then
  95.     if CBE == 0 then
  96.         shell.run("BE") -- Run program BE
  97.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  98.         monitor.setCursorPos(4,4) -- set cursor pos to rewrite IE
  99.         monitor.write(" ON  ") -- rewrite ON
  100.         CBE = 1
  101.     elseif CBE == 1 then
  102.         shell.run("SBE") -- Run program SBE
  103.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  104.         monitor.setCursorPos(4,4) -- set cursor pos to rewrite BE
  105.         monitor.write(" OFF ") -- rewrite OFF
  106.         CBE = 0
  107.     end
  108.    
  109.   elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 2 then
  110.     if CLI == 0 then
  111.         shell.run("LI") -- Run program LI
  112.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  113.         monitor.setCursorPos(24,2) -- set cursor pos to rewrite ON
  114.         monitor.write(" ON  ") -- rewrite ON
  115.         CLI = 1
  116.     elseif CLI == 1 then
  117.         shell.run("SLI") -- Run program SLI
  118.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  119.         monitor.setCursorPos(24,2) -- set cursor pos to rewrite OFF
  120.         monitor.write(" OFF ") -- rewrite OFF
  121.         CLI = 0
  122.     end
  123.    
  124.   elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 4 then
  125.     if CLO == 0 then
  126.         shell.run("LO") -- Run program LO
  127.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  128.         monitor.setCursorPos(24,4) -- set cursor pos to rewrite ON
  129.         monitor.write(" ON  ") -- rewrite ON
  130.         CLO = 1
  131.     elseif CLO == 1 then
  132.         shell.run("SLO") -- Run program SLO
  133.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  134.         monitor.setCursorPos(24,4) -- set cursor pos to rewrite OFF
  135.         monitor.write(" OFF ") -- rewrite OFF
  136.         CLO = 0
  137.     end
  138.    
  139.   end -- ends the if loop
  140. end -- ends the function
  141.    
  142. repeat --repeat all from above
  143.  
  144.  
  145.   event,p1,p2,p3 = os.pullEvent() -- Get Event data. event,p1,p2,p3 from os.pullEvent()
  146.  
  147.    if event=="monitor_touch" then -- Event Mouse_touch (right click monitor)
  148.    
  149.      mouseWidth = p2 -- sets mouseWidth -- Set Mouse Width to p2
  150.      mouseHeight = p3 -- and mouseHeight -- Set Mouse Height to p3
  151.      checkClickPosition() -- this runs our function -- Runs the pervious CheckClickPosition Function
  152.      
  153.    end -- End the IF statement
  154.  
  155. 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