Advertisement
pedrosgali

Turtle Listen

Nov 25th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. rednet.open("right")
  2. os.loadAPI("API/move")
  3.  
  4. function listen()
  5.     move.getLoc()
  6.     move.report("Idle")
  7.     msg = 0
  8.     while msg == 0 do
  9.         id, msg = rednet.receive()
  10.     end
  11. end
  12.  
  13. term.clear()
  14. term.setCursorPos(1, 1)
  15. while true do
  16.     listen()
  17.     msg = tostring(msg)
  18.     if msg == "batch" then
  19.         id, fileName = rednet.receive()
  20.         data = fs.open(fileName, "w")
  21.         id, msg = rednet.receive()
  22.         data.write(msg)
  23.         data.close()
  24.         shell.run(fileName)
  25.     else
  26.         print(id)
  27.         print(msg)
  28.         shell.run(msg)
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement