Advertisement
Justin_P69

main computer 1

Aug 27th, 2023 (edited)
1,667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. -- Replace with the appropriate modem address and client computer ID
  2. local modemAddress = "left"
  3. local clientComputerID = 26
  4. local monitor = peripheral.wrap("back")
  5.  
  6. function drawProgressBar(x, y, percentage)
  7.     monitor.setCursorPos(x, y)
  8.     monitor.setBackgroundColor(colors.white)
  9.     monitor.clearRow(y)
  10.     monitor.setBackgroundColor(colors.blue)
  11.     local width = math.floor(percentage / 100 * (monitor.getSize()))
  12.     monitor.setCursorPos(x, y)
  13.     monitor.write(string.rep(" ", width))
  14.     monitor.setBackgroundColor(colors.white)
  15. end
  16.  
  17. rednet.open(modemAddress)
  18.  
  19. while true do
  20.     local senderID, message = rednet.receive()
  21.     if senderID == clientComputerID then
  22.         monitor.clear()
  23.         drawProgressBar(1, 1, message)
  24.         monitor.setCursorPos(1, 2)
  25.         monitor.setTextColor(colors.black)
  26.         monitor.write("RF: " .. message .. "%")
  27.     end
  28. end
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement