Advertisement
Guest User

thing

a guest
Jan 20th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. API = require("buttonAPI")
  2. local event = require("event")
  3. local computer = require("computer")
  4. local term = require("term")
  5. local component = require("component")
  6. local gpu = component.gpu
  7.  
  8. local rs = component.redstone
  9. local colors = require("colors")
  10. local side = require("sides")
  11. local proc = require("process")
  12.  
  13. local quarryActive = false
  14. local quarryRuns = 0
  15. local timer1
  16.  
  17.  
  18. function API.fillTable()
  19.   API.setTable("Toggle Quarry", toggleQuarry, 10,20,3,5)  
  20.   API.setTable("Free Ram", freemen, 10,20,8,10)
  21.   API.setTable("Reboot", reboot, 22,32,8,10)
  22.   API.screen()
  23. end
  24.  
  25. function getClick(p1, p2, x, y)
  26.  print(x,x, y)
  27.  if x == nil or y == nil then
  28.     local h, w = gpu.getResolution()
  29.     gpu.set(h, w, ".")
  30.     gpu.set(h, w, " ")
  31.   else
  32.     API.checkxy(x,y)
  33.   end
  34. end
  35.  
  36.  
  37. function toggleSpawning()
  38.   API.toggleButton("Spawning")
  39.   if buttonStatus == true then
  40.     toggleQuarry = true
  41.   else
  42.     toggleQuarry = false
  43.   end
  44. end
  45.  
  46. function activateRedstone()
  47.   if quarryActive then
  48.     rs.setOutput(side.west, 15)
  49.     quarryRuns = quarryRuns + 1
  50.     event.timer(1,deactivateRedstone())
  51.   end
  52. end
  53.  
  54. function deactivateRedstone()
  55.   rs.setOutput(side.west, 0)
  56.   if quarryActive then
  57.     event.timer(12,activateRedstone())
  58.   end
  59. end
  60.  
  61. function reboot()
  62.   rs.setOutput(side.top,0)
  63.   computer.shutdown(true)
  64. end
  65.  
  66. function updateScreen()
  67.   API.label(1,24,"Quarry at run: "..quarryRuns)
  68. end
  69.  
  70. term.setCursorBlink(false)
  71. gpu.setResolution(80, 25)
  72. API.clear()
  73. API.fillTable()
  74. API.heading("Frame Quarry Script for ironhide.de")
  75. API.label(1,24,"Quarry at run: "..quarryRuns)
  76. event.listen("touch", getClick)
  77. while true do updateScreen() os.sleep(5) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement