Advertisement
Greenstar12345

Monitor.lua

Dec 4th, 2022 (edited)
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. monitor = peripheral.wrap("left")
  2. term.redirect(monitor)
  3. monitor.setTextScale(2)
  4. term.clear()
  5. modem = peripheral.wrap("back")
  6.  
  7. chan = 36602
  8. modem.open(chan)
  9.  
  10. local function func1 (l)
  11.     local w, h = term.getSize()
  12.     l = #l
  13.     xpos = w/2 - l/2 + 1
  14.     return xpos
  15. end
  16.  
  17. while true do
  18.     event, modemSide, senderChannel, replyChannel, message, distance = os.pullEvent("modem_message")
  19.    
  20.     if (senderChannel == 36602) then
  21.         message = "Pre Text : " .. message  
  22.         term.clear()
  23.         term.setCursorPos(func1(message), 2)
  24.         print(message)
  25.     end
  26. end
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement