Guest User

startup

a guest
Jan 26th, 2013
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local event,param1,param2,param3
  2. local monitorSide = "left"
  3. local redstoneInputSide = "right"
  4. local itemCount = itemCount
  5.  
  6. local function color()
  7.  
  8. end
  9.  
  10. if not fs.exists(".itemCount") then
  11.   file = fs.open(".itemCount","w")
  12.   file.write(itemCount)
  13.   file.close()
  14. else
  15.   file = fs.open(".itemCount","r")
  16.   itemCount = tonumber(file.readLine())
  17.   file.close()
  18. end
  19.        
  20. monitor = peripheral.wrap(monitorSide)
  21. term.redirect(monitor)
  22. monitor.setTextScale(1)
  23.  
  24. while true do
  25.   event,param1,param2,param3 = os.pullEvent()
  26.   if event == "redstone" then
  27.         if rs.getInput(redstoneInputSide) == true then
  28.           itemCount = itemCount + 1
  29.           file = fs.open(".itemCount","w")
  30.           file.write(itemCount)
  31.           file.close()          
  32.         end
  33.        
  34.         term.clear()
  35.         term.setCursorPos(1,1)
  36.         term.setBackgroundColor(colors.white)
  37.         term.setTextColor(colors.blue)
  38.         print("TubeStats")
  39.         print("")
  40.         print("Items passed:")
  41.           if itemCount > 10 then
  42.             term.setTextColor(colors.black)
  43.           elseif itemCount > 100  then
  44.             term.setTextColor(colors.blue)
  45.           elseif itemCount > 1000 then
  46.             term.setTextColor(colors.lightBlue)
  47.           elseif itemCount > 10000 then
  48.             term.setTextColor(colors.green)
  49.           elseif itemCount > 100000 then
  50.             term.setTextColor(colors.yellow)
  51.           elseif itemCount > 1000000 then
  52.             term.setTextColor(colors.pink)
  53.           elseif itemCount > 10000000 then
  54.             term.setTextColor(colors.red)
  55.           end
  56.         print("  "..itemCount)
  57.   end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment