Advertisement
Guest User

status.lua

a guest
Jun 30th, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 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.  
  11.  
  12.  
  13. gpu.setBackground(0x000000)
  14. term.clear()
  15. gpu.setForeground(0xFF0000)
  16. print("Статус устройства v. 2.1 by RAPD123")
  17. gpu.setForeground(0xFFFFFF)
  18. print("")
  19. if component.isAvailable("robot") then
  20. gpu.setForeground(0x00FF00)
  21. print("Это робот!")
  22. else
  23. print("Это устройство не является роботом")
  24. end
  25. gpu.setForeground(0xFFFFFF)
  26. print("Доступно ОЗУ:", fm)
  27. print("Всего ОЗУ:", tm)
  28. print("Доступно энергии:", e)
  29. print("Всего энергии:", me)
  30. print("Устройство работает в секундах:", ut)
  31. print("Адрес устройства:", computer.address())
  32. if computer.users() == "" then
  33. print("Список пользователей:", computer.users())
  34. end
  35. if component.isAvailable("robot") then
  36. local robot = require("robot")
  37. local rl = "N/A"
  38. if component.isAvailable("experience") then
  39. local rl = math.modf(component.experience.level())
  40. end
  41. local rn = robot.name()
  42. local ri = math.modf(robot.inventorySize())
  43. print("Уровень робота:", rl)
  44. print("Имя робота:", rn)
  45. print("Объём инвентаря:", ri)
  46. end
  47. computer.beep(1000, 0.1)
  48. computer.beep(1500, 0.15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement