Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- rednet.open("left")
- term.redirect(mon)
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- local x,y
- local sx,sy
- local nom = ""
- local nbContacts = 2
- local users = {{3,"Lefra"},{5,"Shaman"}}
- sx,sy = term.getSize()
- while true do
- x,y = term.getCursorPos()
- if y == sy then
- term.scroll(1)
- term.setCursorPos(x,y)
- end
- event, id, text = os.pullEvent("rednet_message")
- for i=1,nbContacts do
- if id == users[i][1] then
- nom = users[i][2]
- end
- end
- if text ~= "" then
- if nom == "" then
- term.setTextColor(colors.orange)
- term.write("Ordi n°"..id.." : ")
- term.setTextColor(colors.black)
- print(text)
- else
- term.setTextColor(colors.blue)
- term.write(nom.." : ")
- term.setTextColor(colors.black)
- print(text)
- end
- end
- nom = ""
- end
Advertisement
Add Comment
Please, Sign In to add comment