Advertisement
Z4i

Main controller

Z4i
Jul 13th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. --[[Main controller updates custom HUD
  2. All other computers send information in channel 0
  3. The reply channel will detrimne the purpuse of the transmission:
  4.         a computer send on channel 0 with reply on channel 1, this indicates it is from a mining robot
  5. --]]
  6.  
  7. local modem = peripheral.wrap("left")
  8. local hud = peripheral.wrap("top")
  9.  
  10. modem.open(1)
  11.  
  12. function miner(message)
  13.     hud.clear()
  14.     hud.addText(400, 95, "Miner status: " + message, 0xFFFFFF)
  15. end
  16.  
  17.  
  18.  
  19.  
  20. while true do
  21.     local event, side, channel, reply, msg, distance = os.pullEvent("modem_message")
  22.     if channel == 1 then
  23.         if reply == 3 then
  24.             miner(msg)
  25.         end
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement