Lefra

Recep

Jul 25th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. mon = peripheral.wrap("right")
  2. rednet.open("left")
  3. term.redirect(mon)
  4. term.setBackgroundColor(colors.white)
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. local x,y
  8. local sx,sy
  9. local nom = ""
  10. local nbContacts = 2
  11. local users = {{3,"Lefra"},{5,"Shaman"}}
  12. sx,sy = term.getSize()
  13.  
  14. while true do
  15.   x,y = term.getCursorPos()
  16.   if y == sy then
  17.     term.scroll(1)
  18.     term.setCursorPos(x,y)
  19.   end
  20.   event, id, text = os.pullEvent("rednet_message")
  21.   for i=1,nbContacts do
  22.     if id == users[i][1] then
  23.       nom = users[i][2]
  24.     end
  25.   end
  26.   if text ~= "" then
  27.     if nom == "" then
  28.       term.setTextColor(colors.orange)
  29.       term.write("Ordi n°"..id.." : ")
  30.       term.setTextColor(colors.black)
  31.       print(text)
  32.     else
  33.       term.setTextColor(colors.blue)
  34.       term.write(nom.." : ")
  35.       term.setTextColor(colors.black)
  36.       print(text)
  37.     end
  38.   end
  39.   nom = ""
  40. end
Advertisement
Add Comment
Please, Sign In to add comment