Advertisement
ElijahCrafter

Untitled

Mar 1st, 2024 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. -- Viewer Script
  2.  
  3. -- Define the side where the modem is connected
  4. local modemSide = "bottom" -- Change this to match your setup
  5.  
  6. -- Open the modem on the specified side
  7. local modem = peripheral.wrap(modemSide)
  8. modem.open(123) -- Use the same port number as the sender
  9.  
  10. -- Function to receive and display screen data
  11. local function receiveAndDisplay()
  12.     while true do
  13.         local _, _, senderChannel, _, screenData = os.pullEvent("modem_message")
  14.         if senderChannel == 123 then -- Check if the message is from the sender
  15.             term.blit(unpack(screenData)) -- Display received screen data
  16.         end
  17.     end
  18. end
  19.  
  20. -- Clear the terminal
  21. term.clear()
  22. term.setCursorPos(1, 1)
  23.  
  24. -- Start receiving and displaying screen data
  25. receiveAndDisplay()
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement