jamtholee

UU Counter

Feb 17th, 2013
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local count
  2. local m = peripheral.wrap("top")
  3.  
  4. function mon(count)
  5.  m.clear()
  6.  m.setCursorPos(2,2)
  7.  m.write("UU Count: ")
  8.  m.write(count)
  9. end
  10.  
  11. if fs.exists("count") == true then
  12.  local a = fs.open("count", "r")
  13.  count = a.readLine()
  14.  a.close()
  15.  mon(count)
  16. else
  17.  count = 1
  18. end
  19.  
  20. while true do
  21.  if redstone.getInput("bottom") == true then
  22.   count = count + 1
  23.   local b = fs.open("count", "w")
  24.   b.write(count)
  25.   b.close()
  26.   mon(count)
  27.   if count % 64 == 0 then
  28.    redstone.setOutput("right", true)
  29.    sleep(1)
  30.    rs.setOutput("right", false)
  31.   end
  32.  end
  33.  sleep(0)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment