Advertisement
Guest User

status.lua

a guest
Dec 20th, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. local computer = require("computer")
  2. local component = require("component")
  3. local term = require("term")
  4. local gpu = component.gpu
  5. local tm = math.modf(computer.totalMemory() / 1024)
  6. local fm = math.modf(computer.freeMemory() / 1024)
  7. local me = math.modf(computer.maxEnergy())
  8. local e = math.modf(computer.energy())
  9. local ut = math.modf(computer.uptime())
  10. local ro = component.isAvailable("robot")
  11.  
  12.  
  13.  
  14. gpu.setBackground(0x000000)
  15. term.clear()
  16. gpu.setForeground(0xFF0000)
  17. print("Статус устройства v. 1.2 by RAPD123")
  18. gpu.setForeground(0xFFFFFF)
  19. print("")
  20. if ro == "true" then
  21. gpu.setForeground(0x00FF00)
  22. print("Это робот, будет отображена дополнительная информация")
  23. else
  24. print("Это устройство не является роботом")
  25. end
  26. gpu.setForeground(0xFFFFFF)
  27. print("Всего килобайт ОЗУ:", tm)
  28. print("Свободно килобайт ОЗУ:", fm)
  29. print("Максимум энергии в устройстве/сети:", me)
  30. print("Доступно энергии в устройстве/сети:", e)
  31. print("Устройство работает в секундах:", ut)
  32. print("Адрес устройства:", computer.address())
  33. print("Список пользователей:", computer.users())
  34. if ro == "true"
  35. then
  36. local robot = require("robot")
  37. local rl = math.modf(robot.level())
  38. local rn = math.modf(robot.name())
  39. local ri = math.modf(robot.inventorySize())
  40. print("Уровень робота:", rl)
  41. print("Имя робота:", rn)
  42. print("Объём инвентаря:", ri)
  43. end
  44. computer.beep(1000, 0.1)
  45. computer.beep(1500, 0.15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement