Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chat=peripheral.wrap("right")
- monitor=peripheral.wrap("bottom")
- monitor.clear()
- line=1
- while true do
- monitor.setCursorPos(1,line)
- local event, player, message= os.pullEvent("chat")
- if string.len(message)>82 then
- if line>39 then
- monitor.scroll(0)
- monitor.setCursorPos(1,line)
- end
- pos=string.find(message," ")
- if pos<82 then
- prevpos=pos
- pos=string.find(message," ", pos+1)
- while pos<82 do
- prevpos=pos
- pos = string.find(message," ",pos+1)
- end
- print(pos .. prevpos)
- monitor.write(player .. (": ") .. string.sub(message, 0 ,prevpos-1))
- line=line+1
- monitor.setCursorPos(1,line)
- monitor.write(string.sub(message, prevpos))
- else
- monitor.write(player .. (": ") .. string.sub(message, 0, 82))
- line=line+1
- monitor.setCursorPos(1,line)
- monitor.write(string.sub(message,83))
- end
- else
- monitor.write(player .. (": ") .. message)
- end
- line=line+1
- if line > 40 then
- monitor.scroll(0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement