Advertisement
Guest User

startup.lua

a guest
Jul 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. shell.run("clear")
  2. rednet.open("top")
  3. z = 0
  4. MyID = os.getComputerID()
  5.  
  6. function POS()
  7. x,y = term.getCursorPos()
  8. end
  9.  
  10. function Clear()
  11. term.setCursorPos(1,1)
  12. print("Messager")
  13. end
  14.  
  15. function Recieve()
  16. POS()
  17. local y = y - 1
  18. term.setCursorPos(x,y)
  19. id,msg = rednet.receive()
  20. print(id..": "..msg)
  21. end
  22.  
  23. function Send()
  24. POS()
  25. local y = y + 1
  26. term.setCursorPos(x,y)
  27. input = read()
  28. term.setCursorPos(x,y)
  29. term.clearLine()
  30. rednet.broadcast(""..input)
  31. term.setCursorPos(x,y)
  32. print(MyID..": "..input)
  33. end
  34.  
  35. Clear()
  36. repeat
  37. parallel.waitForAny(Recieve, Send)
  38. until
  39. z == nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement