Advertisement
Himitsu_Chan

Untitled

Feb 13th, 2016
62
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(4,8)
  50. monitor.write("SELECT")
  51.  
  52. monitor.setBackgroundColour((colors.Gray))
  53.  
  54. monitor.setCursorPos(2,8)
  55. monitor.write("<-")
  56.  
  57. monitor.setCursorPos(10,8)
  58. monitor.write("->")
  59.  
  60. monitor.setBackgroundColour((colours.black)) -- Set Background color to black
  61.  
  62.  
  63. function checkClickPosition()
  64.   if mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 2 then
  65.     -- button one clicked
  66.     if CIE == 0 then
  67.         shell.run("IE") -- Run program IE
  68.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  69.         monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  70.         monitor.write(" ON  ") -- rewrite IE
  71.         CIE = 1
  72.     elseif CIE == 1 then
  73.         shell.run("SIE")
  74.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  75.         monitor.setCursorPos(4,2) -- set cursor pos to rewrite IE
  76.         monitor.write(" OFF ") -- rewrite IE
  77.         CIE = 0
  78.     end
  79.    
  80.   elseif mouseWidth > 3 and mouseWidth < 9 and mouseHeight == 4 then
  81.     if CBE == 0 then
  82.         shell.run("BE") -- Run program BE
  83.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  84.         monitor.setCursorPos(4,4) -- set cursor pos to rewrite IE
  85.         monitor.write(" ON  ") -- rewrite ON
  86.         CBE = 1
  87.     elseif CBE == 1 then
  88.         shell.run("SBE") -- Run program SBE
  89.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  90.         monitor.setCursorPos(4,4) -- set cursor pos to rewrite BE
  91.         monitor.write(" OFF ") -- rewrite OFF
  92.         CBE = 0
  93.     end
  94.    
  95.   elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 2 then
  96.     if CLI == 0 then
  97.         shell.run("LI") -- Run program LI
  98.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  99.         monitor.setCursorPos(24,2) -- set cursor pos to rewrite ON
  100.         monitor.write(" ON  ") -- rewrite ON
  101.         CLI = 1
  102.     elseif CLI == 1 then
  103.         shell.run("SLI") -- Run program SLI
  104.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  105.         monitor.setCursorPos(24,2) -- set cursor pos to rewrite OFF
  106.         monitor.write(" OFF ") -- rewrite OFF
  107.         CLI = 0
  108.     end
  109.    
  110.   elseif mouseWidth > 23 and mouseWidth < 29 and mouseHeight == 4 then
  111.     if CLO == 0 then
  112.         shell.run("LO") -- Run program LO
  113.         monitor.setBackgroundColour((colours.red)) -- Set Background color red
  114.         monitor.setCursorPos(24,4) -- set cursor pos to rewrite ON
  115.         monitor.write(" ON  ") -- rewrite ON
  116.         CLO = 1
  117.     elseif CLO == 1 then
  118.         shell.run("SLO") -- Run program SLO
  119.         monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
  120.         monitor.setCursorPos(24,4) -- set cursor pos to rewrite OFF
  121.         monitor.write(" OFF ") -- rewrite OFF
  122.         CLO = 0
  123.     end
  124.    
  125.   end -- ends the if loop
  126. end -- ends the function
  127.    
  128. repeat --repeat all from above
  129.  
  130.  
  131.   event,p1,p2,p3 = os.pullEvent() -- Get Event data. event,p1,p2,p3 from os.pullEvent()
  132.  
  133.    if event=="monitor_touch" then -- Event Mouse_touch (right click monitor)
  134.    
  135.      mouseWidth = p2 -- sets mouseWidth -- Set Mouse Width to p2
  136.      mouseHeight = p3 -- and mouseHeight -- Set Mouse Height to p3
  137.      checkClickPosition() -- this runs our function -- Runs the pervious CheckClickPosition Function
  138.      
  139.    end -- End the IF statement
  140.  
  141. 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