Advertisement
TheTartalex

Computercraft me drive system

Jan 6th, 2022
1,887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Initialazing Soaryng Drive A - COMPLETE")
  2.  
  3. controller = peripheral.wrap("bottom")
  4.  
  5. list = controller.listAvailableItems()
  6.  
  7. count = 0
  8. print("Scanning...")
  9. for number, item in pairs(list) do
  10.     count = count + item.count
  11.     print(item.name)    
  12. end
  13.  
  14. free =math.floor(240 - count)
  15. print()
  16. print("Free space: "..free)
  17.  
  18.  
  19. mon1 = peripheral.wrap("top")
  20. mon2 = peripheral.wrap("monitor_0")
  21.  
  22. mon1.setBackgroundColor(colors.white)
  23. mon2.setBackgroundColor(colors.white)
  24. mon1.setTextColor(colors.black)
  25. mon2.setTextColor(colors.black)
  26. mon1.setCursorPos(1,1)
  27. mon2.setCursorPos(1,1)
  28. mon1.clear()
  29. mon2.clear()
  30.  
  31. mon1.write("Free:")
  32. mon2.write("Free:")
  33. mon1.setCursorPos(1,2)
  34. mon2.setCursorPos(1,2)
  35. mon1.write(free)
  36. mon2.write(free)
  37.  
  38. mon1.setCursorPos(1,4)
  39. mon2.setCursorPos(1,4)
  40. mon1.write("Total:")
  41. mon2.write("Total:")
  42. mon1.setCursorPos(1,5)
  43. mon2.setCursorPos(1,5)
  44. mon1.write("240.0")
  45. mon2.write("240.0")
  46.  
  47.  
  48.  
  49.  
  50. os.sleep(100)
  51. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement