Advertisement
hucking

Untitled

May 18th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. chat=peripheral.wrap("right")
  2. monitor=peripheral.wrap("bottom")
  3. monitor.clear()
  4. line=1
  5. while true do
  6. monitor.setCursorPos(1,line)
  7. local event, player, message= os.pullEvent("chat")
  8. if string.len(message)>82 then
  9. if line>39 then
  10. monitor.scroll(0)
  11. monitor.setCursorPos(1,line)
  12. end
  13. pos=string.find(message," ")
  14. if pos<82 then
  15. prevpos=pos
  16. pos=string.find(message," ", pos+1)
  17. while pos<82 do
  18. prevpos=pos
  19. pos = string.find(message," ",pos+1)
  20. end
  21. print(pos .. prevpos)
  22. monitor.write(player .. (": ") .. string.sub(message, 0 ,prevpos-1))
  23. line=line+1
  24. monitor.setCursorPos(1,line)
  25. monitor.write(string.sub(message, prevpos))
  26. else
  27. monitor.write(player .. (": ") .. string.sub(message, 0, 82))
  28. line=line+1
  29. monitor.setCursorPos(1,line)
  30. monitor.write(string.sub(message,83))
  31. end
  32. else
  33. monitor.write(player .. (": ") .. message)
  34. end
  35. line=line+1
  36. if line > 40 then
  37. monitor.scroll(0)
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement