Advertisement
Guest User

mineUI

a guest
May 30th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. modem = nil
  2.  
  3. function main()
  4.   print("=== Starting Mine GUI ===")
  5.   print("")
  6.   modem = peripheral.wrap("back")
  7.   modem.open(2)
  8.   sendPing()
  9.   -- local queuedRows = 0
  10.   while true do
  11.     print("Lisening for Mining machine...")
  12.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  13.     if message == -1 then
  14.       print("Mining machine is offline and waiting for new jobs...")
  15.       print("please enter the number of rows / -1 for none")
  16.       rows = tonumber(read())
  17.       if rows > 0 then
  18.         modem.transmit(1,2,rows)  
  19.       else
  20.     do return end
  21.    end
  22.     else
  23.       print("Mining machine is online and has " ..message.."queued rows")
  24.     end
  25.   end
  26. end
  27.  
  28. function sendPing()
  29.     modem.transmit(1,2,-1)  
  30. end
  31.  
  32. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement