Advertisement
pedrosgali

TurtleExecute

Mar 24th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | None | 0 0
  1. args = {...}
  2.  
  3. func = args[1]
  4.  
  5. function listen()
  6.     msg = 0
  7.     while msg == 0 do
  8.         id, msg = rednet.receive()
  9.     end
  10. end
  11.  
  12. os.loadAPI("API/move")
  13. move.report(func.." order received.")
  14. if func == "recall" then
  15.     move.goHome()
  16.     move.unload()
  17.     os.reboot()
  18. elseif func == "travel" then
  19.     location = args[2]
  20.     if args[3] ~= nil then
  21.         move.moveToLoc(location, "l")
  22.     else
  23.         move.moveToLoc(location)
  24.     end
  25. elseif func == "updateLocs" then
  26.     chunk = args[2]
  27.     xPos = tonumber(args[3])
  28.     yPos = tonumber(args[4])
  29.     zPos = tonumber(args[5])
  30.     hPos = tonumber(args[6])
  31.     move.addLoc(chunk, xPos, yPos, zPos, hPos)
  32. elseif func == "updateChests" then
  33.     chestTab = textutils.unserialize(args[2])
  34.     data = fs.open("Tables/chests", "w")
  35.     data.writeLine(textutils.serialize(chestTab))
  36.     data.close()
  37. elseif func == "updateBP" then
  38.     label = args[2]
  39.     listen()
  40.     data = fs.open("Blueprints/"..label, "w")
  41.     data.writeLine(msg)
  42.     data.close()
  43.     move.report(label.." blueprint data stored.")
  44. elseif func == "mine" then
  45.     location = args[2]
  46.     length = tonumber(args[3])
  47.     width = tonumber(args[4])
  48.     move.quarry(length, width)
  49. elseif func == "clear" then
  50.     location = args[2]
  51.     length = tonumber(args[3])
  52.     width = tonumber(args[4])
  53.     height = tonumber(args[5])
  54.     move.moveToLoc(location)
  55.     move.findY(height)
  56.     for i = 1, 6 do
  57.         move.setReturnPoint("gridStart")
  58.         move.digGrid(length, width)
  59.         move.moveToLoc("gridStart")
  60.         move.up(3)
  61.     end
  62. elseif func == "build" then
  63.     location = args[2]
  64.     bpName = args[3]
  65.     move.buildBP(location, bpName)
  66. elseif func == "plant" then
  67.     location = args[2]
  68.     bpName = args[3]
  69.     move.buildBP(location, bpName)
  70. elseif func == "sort" then
  71.     location = args[2]
  72.     move.myTab.opt1 = location
  73.     print(move.myTab.opt1)
  74.     move.saveMyData()
  75.     move.report("Turtle lookup")
  76.     move.listen()
  77.     move.sortChest()
  78.     move.goHome()
  79.     move.unload()
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement