Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local numMove = tArgs[1] --
- local numRow = tArgs[2] --not implemented function. ignore if not causing problems, comment out if causing problems
- print("Moving: "..tArgs[1].." Blocks Forward")
- --Check fuel level and refuel
- function fuel()
- turtle.select( 1 )
- while turtle.getFuelLevel() < 10 do
- if(turtle.refuel(1)) then
- print("Refueled...")
- else
- print("Could not refuel...")
- print("Operation Terminated...")
- exit()
- end
- end
- end
- --Drop when inventory full
- function drop()
- if turtle.getItemCount(2) > 1 then
- shell.run("goto", tostring(x), tostring(y), tostring(z))
- for i=2,16 do
- turtle.select(i)
- turtle.drop(64)
- print("Dropping")
- end
- else
- sleep(0.1)
- print("Nothing To Drop")
- end
- end
- --Check for gravel
- function gCheck()
- if turtle.detect() then
- turtle.dig()
- sleep(0.5)
- end
- end
- --move forward and dig a 2 tall tunnel
- function frwd()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- end
- --check for lava and move away from it
- --I've lost many a turtle without this function
- function lava()
- while turtle.detectUp(10) do
- if frwd() then
- print("Detecting Magma like substance...")
- print("Moving Forward...")
- end
- end
- end
- --find turtle's current location
- function gpsFind()
- return gps.locate(1)
- end
- --startprogram:
- rednet.open("right")
- gpsFind() --find current location before turtle moves
- local x, y, z = gpsFind()
- print(gpsFind())
- for i = 1, tArgs[1] do
- fuel()
- gCheck()
- frwd()
- lava()
- end
- drop()
- rednet.close("right")
Advertisement
Add Comment
Please, Sign In to add comment