Advertisement
Guest User

ch.lua

a guest
Apr 25th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local term = require("term")
  2. local component = require("component")
  3. local event = require("event")
  4. local ccb = component.chat_box
  5. local path = "chatlog.txt"
  6.  -- Принимаем сообщения с сервера:
  7. while true do
  8. component.gpu.setResolution(45, 15)
  9. print("Загрузка...")
  10. os.sleep(0.5)
  11. print("Инициализация выводного файла...")
  12. os.sleep(0.5)
  13. print("Вход в систему...")
  14. os.sleep(0.1)
  15. print("Username:Hallowt")
  16. os.sleep(0.1)
  17. print("Pass:**********")
  18. end
  19. elseif print("██████████")
  20. print("Логгирую чат...")
  21. os.sleep(0.5)
  22. print("Записываю сообщение на диск...")
  23. os.sleep(0.1)
  24. print("Записано!")
  25. os.sleep(0.1)
  26. print("░░░░░░░░░░░░░░░░")
  27.   _, _, p, m = event.pull("chat_message")
  28.   f = io.open(path, "a")
  29.   if f == nil then
  30.     io.open(path, "w")
  31.     f:close()
  32.     f = io.open(path, "a")
  33.   end
  34.     f:write(string.format("%s:%s\n",p,m))
  35.     f:flush()
  36.     f:close()
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement