ravneravn

Receiver monitor

Aug 3rd, 2021
574
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. rednet.open("back")
  3. monitor = peripheral.wrap("up")
  4.  
  5. term.clear()
  6. monitor.clear()
  7. term.setCursorPos(1,1)
  8. monitor.write("Listening for broadcast...")
  9.  
  10. local bot = {}
  11.  
  12. local function printPos()
  13.   term.clear()
  14.   monitor.clear()
  15.   term.setCursorPos(1,1)
  16.   monitor.write("------------")
  17.   monitor.write("Status: "..bot.status)
  18.   monitor.write("X: "..bot.currX)
  19.   monitor.write("Z: "..bot.currZ)
  20.   monitor.write("Y: "..bot.currY)
  21.   monitor.write("Direction: "..bot.direction)
  22.   monitor.write("Layer: "..bot.currLayer.." / "..bot.totalLayer)
  23.   monitor.write("Progress: "..bot.tilesMined.." / "..bot.tilesToMine.." ("..bot.tilesMined / bot.tilesToMine * tonumber(100).."%)")
  24.   monitor.write("Fuel left: "..turtle.getFuelLevel().." / "..bot.fuelNeeded)
  25.   monitor.write("------------")
  26. end
  27.  
  28. while true do
  29.   local id, msg = rednet.receive()
  30.   bot = textutils.unserialize(msg)
  31.   printPos()
  32. end
  33.  
RAW Paste Data