XxZajoZzO

ComputerCraft program for controlling power generation

Jun 18th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. os.loadAPI("button")
  2. mon = peripheral.wrap("top")
  3. mon.clear()
  4.  
  5. function createButtons()
  6.   button.setTable("Fuel", fuel, 2,17,1,3)
  7.   button.setTable("Charcoal", char, 2,17,5,7)
  8.   button.setTable("Lava", lava, 2,17,9,11)
  9.   button.setTable("Redstone", rstone, 2,17,13,15)
  10.   button.setTable("Ender Pearl", ender, 2,17,17,19)
  11.   button.screen()
  12. end
  13.  
  14. function getClick()
  15.   event,side,x,y = os.pullEvent("monitor_touch")
  16.   button.checkxy(x,y)
  17. end
  18.  
  19. function fuel()
  20.   button.toggleButton("Fuel")
  21.   if redstone.getOutput("left") then
  22.     redstone.setOutput("left", false)
  23.   else
  24.     redstone.setOutput("left", true)
  25.   end
  26. end  
  27.  
  28. function char()
  29.   button.toggleButton("Charcoal")
  30.   if redstone.getOutput("back") then
  31.     redstone.setOutput("back", false)
  32.   else
  33.     redstone.setOutput("back", true)
  34.   end
  35. end  
  36.  
  37. function lava()
  38.   button.toggleButton("Lava")
  39.   if redstone.getOutput("right") then
  40.     redstone.setOutput("right", false)
  41.   else
  42.     redstone.setOutput("right", true)
  43.   end
  44. end  
  45.  
  46. function rstone()
  47.  button.toggleButton("Redstone")
  48.   if redstone.getOutput("bottom") then
  49.     redstone.setOutput("bottom", false)
  50.   else
  51.     redstone.setOutput("bottom", true)
  52.   end
  53. end
  54.  
  55. function ender()
  56.  button.toggleButton("Ender Pearl")
  57.   if redstone.getOutput("front") then
  58.     redstone.setOutput("front", false)
  59.   else
  60.     redstone.setOutput("front", true)
  61.   end
  62. end
  63.  
  64. createButtons()
  65.  
  66. while true do
  67.   getClick()
  68. end
Add Comment
Please, Sign In to add comment