Advertisement
MigasRocha

Sorting with time Counter

Dec 16th, 2023 (edited)
662
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | Gaming | 1 0
  1. function create(name,m,n)
  2. name = {}
  3. for i = 1,n do
  4.   map[i] = {}
  5.   for j = 1,m do
  6.     map[i][j] = 0
  7.   end
  8. end
  9.  
  10. function Save(table,name)
  11. local file = fs.open(name,"w")
  12. file.write(textutils.serialize(table))
  13. file.close()
  14. end
  15.  
  16. function Load(name)
  17. local file = fs.open(name,"r")
  18. local data = file.readAll()
  19. file.close()
  20. return textutils.unserialize(data)
  21. end
  22.  
  23.  
  24. timeS = 0
  25. timeM = 0
  26. timeH = 0
  27. timeD = 0
  28. term.clear()
  29. Reffils = 0
  30. Error = 0
  31. while true do
  32. while turtle.getItemCount(1) == 0 do
  33.    term.setTextColor(colors.orange)
  34.    term.setCursorPos(1,1)
  35.      sleep(1)
  36. timeS = timeS + 1
  37.     print("Standing by for:")
  38.     term.setTextColor(colors.red)
  39.     term.setCursorPos(3,3)
  40.     term.clearLine(3)
  41.     print(timeS, "seconds")
  42. if timeS == 60 then
  43.     timeM = timeM + 1
  44.     timeS = 0
  45. end
  46.  
  47. if timeM == 60 then
  48.     timeH = timeH + 1
  49.     timeM = 0
  50.     timeS = 0
  51. end
  52.  
  53. if timeH == 24 then
  54.     timeD = timeD + 1
  55.     timeH = 0
  56.     timeM = 0
  57.     timeS = 0
  58. end
  59.  
  60. if timeM ~= 0 then
  61.     term.clearLine(2)
  62.     term.setCursorPos(3,3)
  63.     term.setTextColor(colors.red)
  64.     print(timeM, "minutes", timeS, "seconds")  
  65.     end
  66.  
  67. if timeH ~= 0 then
  68.     term.clearLine(2)
  69.     term.setCursorPos(3,3)
  70.     term.setTextColor(colors.red)
  71.     print(timeH, "hours", timeM, "minutes", timeS, "seconds")
  72. end
  73.  
  74. if timeD ~= 0 then
  75.     term.clearLine(2)
  76.     term.setCursorPos(3,3)
  77.     term.setTextColor(colors.red)
  78.     print(timeD, "Days", timeH, "hours", timeM, "minutes", timeS, "seconds")  
  79.   end  
  80. end
  81.  
  82. local sorting, name = turtle.getItemDetail(1)
  83.                                                                                                                                                
  84. if sorting.name == "minecraft:bucket" then
  85.     turtle.drop()
  86.     sleep(3)
  87.    turtle.suck()
  88.    turtle.dropDown()
  89. Reffils = Reffils + 1
  90. term.clearLine(8)
  91. term.setCursorPos(1,6)
  92. term.setTextColor(colors.green)
  93. print("Refills Done:")
  94. term.setCursorPos(3,8)
  95. term.setTextColor(colors.lime)
  96. print(Reffils, "refills")
  97. else
  98.     turtle.dropDown()
  99. Error = Error + 1
  100. term.clearLine(11)
  101. term.setCursorPos(1,10)
  102. term.setTextColor(colors.red)
  103. print("Errors:")
  104. term.setCursorPos(3,12)
  105. print(Error, "errors")
  106.  
  107. end
  108.  
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement