Advertisement
jille_Jr

CC: item counter (using bundled cable)

Oct 6th, 2012
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local count = 0
  2.  
  3. if not fs.exists(".itemCount") then
  4.   countFile = fs.open(".itemCount", "w")
  5.   countFile.write(count)
  6.   countFile.close()
  7. else
  8.   countFile = fs.open(".itemCount", "r")
  9.   count = tonumber(countFile.readLine())
  10.   countFile.close()
  11. end
  12.  
  13. term.clear()
  14.  
  15. while true do
  16.   term.setCursorPos(3,2)
  17.   print("Total items passed: "..count.."   ")
  18.   os.pullEvent("redstone")
  19.   if rs.testBundledInput("bottom", color.black) then
  20.     count = count + 1
  21.     countFile = fs.open(".itemCount", "w")
  22.     countFile.write(count)
  23.     countFile.close()
  24.   end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement