Advertisement
Shaka01

Pocket Computer listen_dependancy

Mar 2nd, 2023 (edited)
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local shaka = require("API")
  2. local _, maxY = term.getSize()
  3. shaka.clearScreen()
  4.  
  5.  
  6. function listen()
  7. local x, y = term.getCursorPos()
  8. local senderID, message = rednet.receive("listen")
  9. if  y >= maxY - 1 then
  10.     shaka.clearScreen()
  11.     term.setBackgroundColor(colors.gray)
  12.     term.clearLine()
  13.     print("Intercepting requests:\n")
  14.     term.setBackgroundColor(colors.black)
  15. end
  16.  
  17. shaka.split(message, " ")
  18. niceName = shaka.prettyName(result[1])
  19. channel = result[3]
  20. print(channel.. ": " ..niceName)
  21. end
  22.  
  23. function click()
  24. event = os.pullEvent("mouse_click")
  25. os.reboot()
  26. end
  27.  
  28. term.setBackgroundColor(colors.gray)
  29. term.clearLine()
  30. print("Intercepting requests:\n")
  31. term.setBackgroundColor(colors.black)
  32. while true do
  33. parallel.waitForAny(listen, click)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement