Advertisement
Guest User

chatlogger.lua

a guest
Aug 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. f = fs.open("chatlog","a")
  2. m = peripheral.wrap("top")
  3. c = peripheral.wrap("right")
  4.  
  5. m.clear()
  6. m.setCursorPos(1,1)
  7. i=1
  8.  
  9. function try()
  10.     _, player, msg = os.pullEvent("chat")
  11. end
  12.  
  13. while true do
  14.     if pcall(try) then
  15.         str = player .. ": " .. msg
  16.         print(str)
  17.         f.write(str.."\n")
  18.         m.setCursorPos(1,i)
  19.         m.write(str)
  20.         i=i+1
  21.     end
  22.     if i==16 then
  23.         i=1
  24.         m.clear()
  25.         m.setCursorPos(1,i)
  26.         f.close()
  27.         f = fs.open("chatlog", "a")
  28.     end
  29.     sleep(0.1)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement