Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("turtleManualOneTrip.lua")
- --start with pick in left and geoscanner in right of turtle, and modem in first slot
- function getSearchItem()
- print("Please Insert Item to Mine in Second Slot")
- print("Then Press Enter")
- read()
- desireditem = turtle.getItemDetail(2)
- return desireditem.name
- end
- scanner = peripheral.wrap("right")
- if scanner.cost(15) > scanner.getFuelLevel() then
- print("Not Enough Fuel")
- print("Cost: " .. scanner.cost(15))
- print("Fuel Level: " .. scanner.getFuelLevel() .. "/" .. scanner.getMaxFuelLevel())
- os.exit(1)
- end
- turtle.equipRight()
- rednet.open("right")
- cx, cy, cz = gps.locate()
- if cx == nil and cy == nil and cz == nil then
- print("GPS Error")
- os.exit(1)
- end
- turtle.equipRight()
- print("Item or Name? (1 or 2)")
- choice = tonumber(read())
- if choice ~= nil and choice == 1 then
- item = getSearchItem()
- elseif choice ~= nil and choice == 2 then
- print("Please input item in game name (with library included)")
- item = read()
- end
- if not item and choice == 1 then
- print("No Item Inserted")
- os.exit(1)
- elseif not item and choice == 2 then
- print("No Name Inputted")
- os.exit(1)
- end
- blocks = scanner.scan(15)
- if blocks ~= nil then
- for _, block in pairs(blocks) do
- if block.name == item then
- x = cx + block.x
- y = cy + (block.y + 1)
- z = cz + block.z
- turtleManualOneTrip.goToCordsMine(x, y, z)
- end
- end
- turtleManualOneTrip.goToCordsMine(cx, cy, cz)
- else
- print("Couldnt Scan")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement