This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AustinKK's profile picture

Advanced Mining Turtle - Ore Quarry

Started by AustinKK, 28 December 2012 - 05:30 AM
AustinKK #1
Posted 28 December 2012 - 06:30 AM
Hi everyone,

I know that this forum has plenty of Quarrying Mining Turtles, but I've created another one!

This turtle programs runs about 10% faster than a BuildCraft Quarry by focussing on just mining ores rather than trying to mine everything.

Speed Test and Instructions in this video (skip to 12:54 for instructions on how to download and use the program):

[media]http://www.youtube.com/watch?v=DS1H4OY0yyg[/media]

Code:
http://pastebin.com/3mkeUzby

Spoiler

-- ********************************************************************************** --
-- **																			  ** --
-- **   Minecraft Mining Turtle Ore Quarry v0.2 by AustinKK						** --
-- **   ---------------------------------------------------						** --
-- **																			  ** --
-- **   For instructions on how to use:											** --
-- **																			  ** --
-- **     http://www.youtube.com/watch?v=DS1H4OY0yyg                               ** --
-- **																			  ** --
-- ********************************************************************************** --
-- Enumeration to store the the different types of message that can be written
messageLevel = { DEBUG=0, INFO=1, WARNING=2, ERROR=3, FATAL=4 }

-- Enumeration to store names for the 6 directions
direction = { FORWARD=0, RIGHT=1, BACK=2, LEFT=3, UP=4, DOWN=5 }

local messageOutputLevel = messageLevel.INFO
local fuelLevelToRefuelAt = 5
local refuelItemsToUseWhenRefuelling = 1
local emergencyFuelToRetain = 3
local maximumGravelStackSupported = 25 -- The number of stacked gravel or sand blocks supported
local nonSeamBlocks
local bottomLayer = 5 -- The y co-ords of the layer immediately above bedrock
local returningToStart = false
local lookForChests = false -- Determines if chests should be located as part of the quarrying
local lastEmptySlot -- The last inventory slot that was empty when the program started (is either 15 if not looking for chests or 14 if we are)
local turtleId

-- Variables to store the current location and orientation of the turtle. x is right, left, y is up, down and
-- z is forward, back with relation to the starting orientation. Y is the actual turtle level, x and z are
-- in relation to the starting point (i.e. the starting point is (0, 0))
local currX
local currY
local currZ
local currOrient

-- Command line parameters
local startHeight -- Represents the height (y co-ord) that the turtle started at
local quarryWidth -- Represents the length of the mines that the turtle will dig

-- ********************************************************************************** --
-- Writes an output message
-- ********************************************************************************** --
function writeMessage(message, msgLevel)
  if (msgLevel >= messageOutputLevel) then
	print(message)
	if (turtleId == nil) then
	  rednet.broadcast(message)
	else
	  -- Broadcast the message (prefixed with the turtle's id)
	  rednet.broadcast("[".. turtleId.."] "..message)
	end
  end
end

-- ********************************************************************************** --
-- Ensures that the turtle has fuel
-- ********************************************************************************** --
function ensureFuel()

  -- Determine whether a refuel is required
  local fuelLevel = turtle.getFuelLevel()
  if (fuelLevel ~= "unlimited") then
	if (fuelLevel < fuelLevelToRefuelAt) then
	  -- Need to refuel
	  turtle.select(16)
	  local fuelItems = turtle.getItemCount(16)

	  -- Do we need to impact the emergency fuel to continue? (always
	  -- keep one fuel item in slot 16)
	  if (fuelItems == 0) then
		writeMessage("Completely out of fuel!", messageLevel.FATAL)
	  elseif (fuelItems == 1) then
		writeMessage("Out of Fuel!", messageLevel.ERROR)
	  elseif (fuelItems <= (emergencyFuelToRetain + 1)) then
		writeMessage("Consuming emergency fuel supply. "..(fuelItems - 2).." emergency fuel items remain", messageLevel.WARNING)
		turtle.refuel(1)
	  else
		-- Refuel the lesser of the refuelItemsToUseWhenRefuelling and the number of items more than
		-- the emergency fuel level
		if (fuelItems - (emergencyFuelToRetain + 1) < refuelItemsToUseWhenRefuelling) then
		  turtle.refuel(fuelItems - (emergencyFuelToRetain + 1))
		else
		  turtle.refuel(refuelItemsToUseWhenRefuelling)
		end
	  end
	end
  end
end	  

-- ********************************************************************************** --
-- Checks that the turtle has inventory space by checking for spare slots and returning
-- to the starting point to empty out if it doesn't.
--
-- Takes the position required to move to in order to empty the turtle's inventory
-- should it be full as arguments
-- ********************************************************************************** --
function ensureInventorySpace()

  -- If already returning to start, then don't need to do anything
  if (returningToStart == false) then

	-- If the last inventory slot is full, then need to return to the start and empty
	if (turtle.getItemCount(lastEmptySlot) > 0) then

	  -- Return to the starting point and empty the inventory, then go back to mining
	  returnToStartAndUnload(true)
	end
  end
end

-- ********************************************************************************** --
-- Function that is called when the turtle has returned to the start in order to
-- empty its inventory into the chest and also pick up any fuel that is
-- available
-- ********************************************************************************** --
function emptyInventory()

  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop)
	if ((slotLoop <= nonSeamBlocks) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end
	
	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items
  turtleSetOrientation(direction.LEFT)
  turtle.select(16)
  local currFuelItems = turtle.getItemCount(16)
  turtle.suck()
  while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	currFuelItems = turtle.getItemCount(16)
	turtle.suck()
  end

  slotLoop = nonSeamBlocks + 1
  -- Have now picked up all the items that we can. If we have also picked up some
  -- additional fuel in some of the other slots, then drop it again
  while (slotLoop < lastEmptySlot) do
	-- Drop any items found in this slot
	turtle.select(slotLoop)
	turtle.drop()
	slotLoop = slotLoop + 1
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)
end

-- ********************************************************************************** --
-- Function to move to the starting point, call a function that is passed in
-- and return to the same location (if required)
-- ********************************************************************************** --
function returnToStartAndUnload(returnBackToMiningPoint)

  writeMessage("returnToStartAndUnload called", messageLevel.DEBUG)
  returningToStart = true

  -- Store the current location and orientation so that it can be returned to
  local storedX = currX
  local storedY = currY
  local storedZ = currZ
  local storedOrient = currOrient

  -- First direction to move is straight up. Do this because the inventory is full and
  -- therefore don't want to pass through any blocks that contain ores. Know that all
  -- blocks above don't contain ores, so is safe to go that way
  -- (Note, there is a rare edge case where the inventory becomes full after moving
  -- forward and before checking the block above, this is quite rare and given the
  -- likelihood of it not being able be added to the inventory (even though slot 15
  -- is full), and is deemed an acceptable risk)
  if (currY < startHeight) then
	while (currY < startHeight) do
	  turtleUp()
	end
  elseif (currY > startHeight) then
	-- This should never happen
	writeMessage("Current height is greater than start height in returnToStartAndUnload", messageLevel.ERROR)
  end

  -- Move back to the correct X position
  if (currX > 0) then
	turtleSetOrientation(direction.LEFT)
	while (currX > 0) do
	  turtleForward()
	end
  elseif (currX < 0) then
	-- This should never happen
	writeMessage("Current x is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
  end

  -- Move back to the correct Z position
  if (currZ > 0) then
	turtleSetOrientation(direction.BACK)
	while (currZ > 0) do
	  turtleForward()
	end
  elseif (currZ < 0) then
	-- This should never happen
	writeMessage("Current z is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
  end

  -- Empty the inventory
  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop)
	if ((slotLoop <= nonSeamBlocks) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end
	
	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items
  turtleSetOrientation(direction.LEFT)
  turtle.select(16)
  local currFuelItems = turtle.getItemCount(16)
  turtle.suck()
  while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	currFuelItems = turtle.getItemCount(16)
	turtle.suck()
  end

  slotLoop = nonSeamBlocks + 1
  -- Have now picked up all the items that we can. If we have also picked up some
  -- additional fuel in some of the other slots, then drop it again
  while (slotLoop <= lastEmptySlot) do
	-- Drop any items found in this slot
	turtle.select(slotLoop)
	turtle.drop()
	slotLoop = slotLoop + 1
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)

  -- If required, move back to the point that we were mining at before returning to the start
  if (returnBackToMiningPoint == true) then
	-- Return to the point that we were at so that quarrying may resume
	-- Move back to the correct Z position
	writeMessage("Stored Z: "..storedZ..", currZ: "..currZ, messageLevel.DEBUG)
	if (storedZ > currZ) then
	  writeMessage("Orienting forward", messageLevel.DEBUG)
	  writeMessage("Moving in z direction", messageLevel.DEBUG)
	  turtleSetOrientation(direction.FORWARD)
	  while (storedZ > currZ) do
		turtleForward()
	  end
	elseif (storedZ < currZ) then
	  -- This should never happen
	  writeMessage("Stored z is less than current z in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Move back to the correct X position
	if (storedX > currX) then
	  writeMessage("Stored X: "..storedX..", currX: "..currX, messageLevel.DEBUG)
	  writeMessage("Orienting right", messageLevel.DEBUG)
	  writeMessage("Moving in x direction", messageLevel.DEBUG)
	  turtleSetOrientation(direction.RIGHT)
	  while (storedX > currX) do
		turtleForward()
	  end
	elseif (storedX < currX) then
	  -- This should never happen
	  writeMessage("Stored x is less than current x in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Move back to the correct Y position
	if (storedY < currY) then
	  while (storedY < currY) do
		turtleDown()
	  end
	elseif (storedY > currY) then
	  -- This should never happen
	  writeMessage("Stored y is greater than current y in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Finally, set the correct orientation
	turtleSetOrientation(storedOrient)

	writeMessage("Have returned to the mining point", messageLevel.DEBUG)
  end

  returningToStart = false

end

-- ********************************************************************************** --
-- Empties a chest's contents
-- ********************************************************************************** --
function emptyChest(suckFn)

  local prevInventoryCount = {}
  local inventoryLoop
  local chestEmptied = false

  -- Record the number of items in each of the inventory slots
  for inventoryLoop = 1, 16 do
	prevInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
  end

  while (chestEmptied == false) do
	-- Pick up the next item
	suckFn()

	-- Determine the number of items in each of the inventory slots now
	local newInventoryCount = {}
	for inventoryLoop = 1, 16 do
	  newInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
	end

	-- Now, determine whether there have been any items taken from the chest
	local foundDifferentItemCount = false
	inventoryLoop = 1
	while ((foundDifferentItemCount == false) and (inventoryLoop <= 16)) do
	  if (prevInventoryCount[inventoryLoop] ~= newInventoryCount[inventoryLoop]) then
		foundDifferentItemCount = true
	  else
		inventoryLoop = inventoryLoop + 1
	  end
	end
  
	-- If no items have been found with a different item count, then the chest has been emptied
	chestEmptied = not foundDifferentItemCount

	if (chestEmptied == false) then
	  prevInventoryCount = newInventoryCount
	  -- Check that there is sufficient inventory space as may have picked up a block
	  ensureInventorySpace()
	end
  end

  writeMessage("Finished emptying chest", messageLevel.DEBUG)
end


-- ********************************************************************************** --
-- Generic function to move the Turtle (pushing through any gravel or other
-- things such as mobs that might get in the way).
--
-- The only thing that should stop the turtle moving is bedrock. Where this is
-- found, the function will return after 15 seconds returning false
-- ********************************************************************************** --
function moveTurtle(moveFn, detectFn, digFn, attackFn, compareFn, suckFn, maxDigCount)

  ensureFuel()

  -- If we are looking for chests, then check that this isn't a chest before moving
  if (lookForChests == true) then
	if (isChestBlock(compareFn) == true) then
	  -- Have found a chest, empty it before continuing
	  emptyChest (suckFn)
	end
  end

  -- Flag to determine whether digging has been tried yet. If it has
  -- then pause briefly before digging again to allow sand or gravel to
  -- drop
  local digCount = 0
  local moveSuccess = moveFn()

  while ((moveSuccess == false) and (digCount < maxDigCount)) do

	-- If there is a block in front, dig it
	if (detectFn() == true) then
	  
		-- If we've already tried digging, then pause before digging again to let
		-- any sand or gravel drop
		if(digCount > 0) then
		  sleep(0.4)
		end

		digFn()
		digCount = digCount + 1
	else
	   -- Am being stopped from moving by a mob, attack it
	   attackFn()
	end

	-- Try the move again
	moveSuccess = moveFn()
  end

  -- Return the move success
  return moveSuccess

end

-- ********************************************************************************** --
-- Move the turtle forward one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleForward()
  local returnVal = moveTurtle(turtle.forward, turtle.detect, turtle.dig, turtle.attack, turtle.compare, turtle.suck, maximumGravelStackSupported)
  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ + 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX - 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ - 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX + 1
	else
	  writeMessage ("Invalid currOrient in turtleForward function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end

  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle up one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleUp()
  local returnVal = moveTurtle(turtle.up, turtle.detectUp, turtle.digUp, turtle.attackUp, turtle.compareUp, turtle.suckUp, maximumGravelStackSupported)
  if (returnVal == true) then
	currY = currY + 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle down one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleDown()
  local returnVal

  -- Because the turtle is digging down, can fail fast (only allow 1 dig attempt).
  returnVal = moveTurtle(turtle.down, turtle.detectDown, turtle.digDown, turtle.attackDown, turtle.compareDown, turtle.suckDown, 1)
  if (returnVal == true) then
	currY = currY - 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle back one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleBack()
  -- First try to move back using the standard function
  local returnVal = turtle.back()

  -- Moving back didn't work (might be a block or a mob in the way). Turn round and move
  -- forward instead (whereby anything in the way can be cleared)
  if(returnVal == false) then
	turtle.turnRight()
	turtle.turnRight()
	returnVal = turtleForward()
	turtle.turnRight()
	turtle.turnRight()
  end

  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ - 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX + 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ + 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX - 1
	else
	  writeMessage ("Invalid currOrient in turtleBack function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  
  return returnVal
end

-- ********************************************************************************** --
-- Turns the turtle (updating the current orientation at the same time)
-- ********************************************************************************** --
function turtleTurn(turnDir)

  if (turnDir == direction.LEFT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.LEFT
	  turtle.turnLeft()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.BACK
	  turtle.turnLeft()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.RIGHT
	  turtle.turnLeft()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.FORWARD
	  turtle.turnLeft()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  elseif (turnDir == direction.RIGHT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.RIGHT
	  turtle.turnRight()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.FORWARD
	  turtle.turnRight()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.LEFT
	  turtle.turnRight()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.BACK
	  turtle.turnRight()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  else
	writeMessage ("Invalid turnDir in turtleTurn function", messageLevel.ERROR)
  end
end

-- ********************************************************************************** --
-- Sets the turtle to a specific orientation, irrespective of its current orientation
-- ********************************************************************************** --
function turtleSetOrientation(newOrient)

  if (currOrient ~= newOrient) then
	if (currOrient == direction.FORWARD) then
	  if (newOrient == direction.RIGHT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.RIGHT) then
	  if (newOrient == direction.BACK) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.BACK) then
	  if (newOrient == direction.LEFT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.LEFT) then
	  if (newOrient == direction.FORWARD) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  end
end

-- ********************************************************************************** --
-- Determines if a particular block is considered a noise block or not. A noise
-- block is one that is a standard block in the game (stone, dirt, gravel etc.) and
-- is one to ignore when a seam is being dug out. Function works by comparing the block
-- in question against a set of blocks in the turtle's inventory which are known not to
-- be noise blocks. The first parameter is the number of slots containing noise blocks
-- (these must be at the start of the turtle's inventory), and the second param is the
-- function to use to compare the block for a noise block
-- ********************************************************************************** --
function isNoiseBlock(detectFn, compareFn)

  -- Consider air to be a noise block
  local returnVal = not detectFn()
  local seamLoop = 1

  while((returnVal == false) and (seamLoop <= nonSeamBlocks)) do
	turtle.select(seamLoop)
	returnVal = compareFn()
	seamLoop = seamLoop + 1
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Determines if a particular block is a chest. Returns false if it is not a chest
-- or chests are not being detected
-- ********************************************************************************** --
function isChestBlock(compareFn)

  -- Check the block in the appropriate direction to see whether it is a chest. Only
  -- do this if we are looking for chests
  local returnVal = false
  if (lookForChests == true) then
	turtle.select(15)
	returnVal = compareFn()
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Function to calculate the number of non seam blocks in the turtle's inventory. This
-- is all of the blocks at the start of the inventory (before the first empty slot is
-- found
-- ********************************************************************************** --
function determineNonSeamBlocksCount()
  -- Determine the location of the first empty inventory slot. All items before this represent
  -- noise items.
  local foundFirstBlankInventorySlot = false
  nonSeamBlocks = 1
  while ((nonSeamBlocks < 16) and (foundFirstBlankInventorySlot == false)) do
	if (turtle.getItemCount(nonSeamBlocks) > 0) then
	  nonSeamBlocks = nonSeamBlocks + 1
	else
	  foundFirstBlankInventorySlot = true
	end
  end
  nonSeamBlocks = nonSeamBlocks - 1

  -- Determine whether a chest was provided, and hence whether we should support
  -- looking for chests
  if (turtle.getItemCount(15) > 0) then
	lookForChests = true
	lastEmptySlot = 14
	writeMessage("Looking for chests...", messageLevel.DEBUG)
  else
	lastEmptySlot = 15
	writeMessage("Ignoring chests...", messageLevel.DEBUG)
  end
end

-- ********************************************************************************** --
-- Creates a quarry mining out only ores and leaving behind any noise blocks
-- ********************************************************************************** --
function createQuarry()

  -- Determine the starting layer. The turtle mines in layers of 3, and the bottom layer
  -- is the layer directly above bedrock.
  --
  -- The actual layer that the turtle operates in is the middle of these three layers,
  -- so determine the top layer
  local firstMiningLayer = startHeight + ((bottomLayer - startHeight - 2) % 3) - 1

  -- If the top layer is up, then ignore it and move to the next layer
  if (firstMiningLayer > currY) then
	firstMiningLayer = firstMiningLayer - 3
  end

  local miningLoop
  local firstTimeThru = true
  local onNearSideOfQuarry = true
  local diggingAway = true

  -- Loop over each mining row
  for miningLoop = firstMiningLayer, bottomLayer, -3 do
	writeMessage("Mining Layer: "..miningLoop, messageLevel.INFO)

	-- Move to the correct level to start mining
	if (currY > miningLoop) then
	  while (currY > miningLoop) do
		turtleDown()
	  end
	end

	-- Move turtle into the correct orientation to start mining
	if (firstTimeThru == true) then
	  turtleTurn(direction.RIGHT)
	  firstTimeThru = false
	else
	  turtleTurn(direction.LEFT)
	  turtleTurn(direction.LEFT)
	end

	local firstRow = true
	local mineRows
	for mineRows = 1, quarryWidth do
	  -- If this is not the first row, then get into position to mine the next row
	  if (firstRow == true) then
		firstRow = false
	  else
		-- Move into position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  turtleTurn(direction.RIGHT)
		else
		  turtleTurn(direction.LEFT)
		end

		turtleForward()
		if (isChestBlock(turtle.compareUp) == true) then
		  -- There is a chest block above. Move back and approach
		  -- from the side to ensure that we don't need to return to
		  -- start through the chest itself (potentially losing items)
		  turtleBack()
		  turtleUp()
		  emptyChest(turtle.suck)
		  turtleDown()
		  turtleForward()
		end

		-- Move into final position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  turtleTurn(direction.RIGHT)
		else
		  turtleTurn(direction.LEFT)
		end
	  end

	  -- Dig to the other side of the quarry
	  local blocksMined
	  for blocksMined = 0, (quarryWidth - 1) do
		-- Move forward and check for ores
		if(blocksMined > 0) then
		  -- Only move forward if this is not the first space
		  turtleForward()
		end
		
		-- Check upwards for a chest block if this is not the first block of the
		-- row (in which case it will have already been checked)
		if(blocksMined > 0) then
		  if (isChestBlock(turtle.compareUp) == true) then
			-- There is a chest block above. Move back and approach
			-- from the side to ensure that we don't need to return to
			-- start through the chest itself (potentially losing items)
			turtleBack()
			turtleUp()
			emptyChest(turtle.suck)
			turtleDown()
			turtleForward()
		  end
		end
	  
		if (isNoiseBlock(turtle.detectUp, turtle.compareUp) == false) then
		  turtle.digUp()
		  ensureInventorySpace()
		end

		-- Check down, if this is the bedrock layer, use an alternate approach.
		-- If this is not the bedrock layer, then just check down
		if (miningLoop == bottomLayer) then
		  -- Just above bedrock layer, dig down until can't dig any lower, and then
		  -- come back up. This replicates how the quarry functions
		  local moveDownSuccess = turtleDown()
		  while (moveDownSuccess == true) do
			moveDownSuccess = turtleDown()
		  end

		  -- Have now hit bedrock, move back to the mining layer
		  writeMessage("Moving back to mining layer", messageLevel.DEBUG)
		  writeMessage("currY: "..currY..", bottomLayer: "..bottomLayer, messageLevel.DEBUG)
		  while (currY < bottomLayer) do
			turtleUp()
		  end
		else
		  -- Check the block down for being a chest
		  if (isChestBlock(turtle.compareDown) == true) then
			emptyChest(turtle.suckDown)
		  end

		  -- Check the block down and mine if necessary
		  if (isNoiseBlock(turtle.detectDown, turtle.compareDown) == false) then
			turtle.digDown()
			ensureInventorySpace()
		  end
		end
	  end

	  -- Am now at the other side of the quarry
	  onNearSideOfQuarry = not onNearSideOfQuarry
	end

	-- If we were digging away from the starting point, will be digging
	-- back towards it on the next layer
	diggingAway = not diggingAway
  end

  -- Return to the start
  returnToStartAndUnload(false)

  -- Face forward
  turtleSetOrientation(direction.FORWARD)
end

-- ********************************************************************************** --
-- Main Function										
-- ********************************************************************************** --
-- Process the input arguments - storing them to global variables
local args = { ... }
local paramsOK = true
turtleId = os.getComputerLabel()
rednet.open("right")
if (#args == 1) then
  quarryWidth = tonumber(args[1])
  local x, y, z = gps.locate(5)
  startHeight = y
  if (startHeight == nil) then
	writeMessage("Can't locate GPS", messageLevel.FATAL)
	paramsOK = false
  end
elseif (#args == 2) then
  quarryWidth = tonumber(args[1])
  startHeight = tonumber(args[2])
else
  writeMessage("Usage: OreQuarry <diameter> <turtleY>", messageLevel.FATAL)
  paramsOK = false
end
if (paramsOK == true) then
  if ((startHeight < 6) or (startHeight > 128)) then
	writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
	paramsOK = false
  end

  if ((quarryWidth < 2) or (quarryWidth > 64)) then
	writeMessage("diameter must be between 2 and 64", messageLevel.FATAL)
	paramsOK = false
  end
end

if (paramsOK == true) then
  writeMessage("---------------------------------", messageLevel.INFO)
  writeMessage("** Ore Quarry v0.2 by AustinKK **", messageLevel.INFO)
  writeMessage("---------------------------------", messageLevel.INFO)

  -- Set the turtle's starting position
  currX = 0
  currY = startHeight
  currZ = 0
  currOrient = direction.FORWARD

  -- Calculate which blocks in the inventory signify noise blocks
  determineNonSeamBlocksCount()

  if ((nonSeamBlocks == 0) or (nonSeamBlocks == 15)) then
	writeMessage("No noise blocks have been been added. Please place blocks that the turtle should not mine (e.g. Stone, Dirt, Gravel etc.) in the first few slots of the turtle\'s inventory. The first empty slot signifies the end of the noise blocks.", messageLevel.FATAL)
  else
	-- Create a Quary
	createQuarry()
  end
end
Flaeme #2
Posted 28 December 2012 - 12:46 PM
Has noone really replied to this? I plan on using it to quarry some instead of a BC quarry, looks great.
Jack #3
Posted 28 December 2012 - 04:48 PM
Very nice. Very well documented and explained, and very efficient. Well done.
HotGirlEAN #4
Posted 28 December 2012 - 04:53 PM
Please include a pastebin link ^^;
AustinKK #5
Posted 28 December 2012 - 09:02 PM
Thanks guys.

HotGirlEAN, there is a pastebin link in the original post. It is http://pastebin.com/3mkeUzby
HotGirlEAN #6
Posted 28 December 2012 - 09:23 PM
Oh sorry, didn't catch that. I was distracted by the huge amount of code in my face! XD
Maybe putting it in Spoilers would be more effecient?
NoStyle #7
Posted 28 December 2012 - 10:55 PM
Oh man this is awesome.
Is there a way to automatic place torches to prevent mob spawning between the layers?
What happens if he hit lava/water or a mineshaft?
Thanks for this programm
AustinKK #8
Posted 28 December 2012 - 10:59 PM
Oops, yes good point HotGirlEAN :-)

(done)
AustinKK #9
Posted 28 December 2012 - 11:14 PM
Hey NoStyle,

No, there is no way to place torches at the moment. I'm still considering the best way of achieving this, so I may add it. When I use the turtle I tend to do it away from my base (and use a World Anchor to keep the chunk loaded), but I guess that's not everybody wants to do.

Hitting lava/water/mineshafts are all fine. The turtle can mine items out of lava without them burning (all mining turtles can do this by default), and from water. In mineshafts, the chests will be emptied (if you configure the turtle appropriately) and it will dig out any wood/fence posts it comes across.
DiEvAl #10
Posted 29 December 2012 - 06:27 AM
22:50 Challenge accepted! As a part of the challenge, I haven't and won't look at your source.

Can you make a world download?
Henness #11
Posted 29 December 2012 - 06:50 AM
You should check out my ore finder program i haven't tested how fast it 8s but i assume it would only take 30 min.
AustinKK #12
Posted 29 December 2012 - 06:57 AM
DiEvAl,

:-)

Ok, here's the link to download the world: http://www.mediafire...afj9la87f00459y
AustinKK #13
Posted 29 December 2012 - 08:40 AM
Hi Henness,

I tried the latest version of your Advanced Ore Finder on the map, but I struggled to get it to work. Not sure what I was doing wrong (really like the GUI by the way).

I've tried version 1.0, and it takes over an hour to run. Have you made some changes in the most recent version?
NoStyle #14
Posted 29 December 2012 - 11:23 AM
Hey tried your program and worked fine at the beginning but after a few layer it stopped and now when i run the program it say something like "can't conect to gps" why is that? I play on a server.

Edit: I'm an idiot typed "OreQuarry 8" instead "OreQuary 8 63"
abculatter_2 #15
Posted 29 December 2012 - 02:58 PM
I think there may be a more efficient way to mine all ores, by using the pattern used by this program:
http://www.computercraft.info/forums2/index.php?/topic/7663-rebootable-rabit-hole-mining-program/
And mining up and down in shafts, rather then horizontally.
Would you be able/willing to reprogram this one to use this pattern, or make a new one?
Cozzimoto #16
Posted 29 December 2012 - 04:23 PM
great minds must think alike cause i made my very own quarry program that digs three layers at a time. and ive also made a unique quarry program where the turtle digs straight down and checks the 4 walls beside him and moves like the chest piece "knight" ti get 100% ground coverage. and scraps everything even those diamonds that are hiding under bedrock.
abculatter_2 #17
Posted 29 December 2012 - 05:47 PM
great minds must think alike cause i made my very own quarry program that digs three layers at a time. and ive also made a unique quarry program where the turtle digs straight down and checks the 4 walls beside him and moves like the chest piece "knight" ti get 100% ground coverage. and scraps everything even those diamonds that are hiding under bedrock.

Could you post it, please?
Cozzimoto #18
Posted 29 December 2012 - 05:55 PM
its not quite finished in the matter that i want to ad some rednet stuff to have the little worker report to a console. and maybe a few other things
abculatter_2 #19
Posted 29 December 2012 - 07:07 PM
Mkay, that's fine. Just post it whenever it's ready.
AustinKK #20
Posted 29 December 2012 - 11:36 PM
Hey abculatter_2, Cozzimoto,

I tried the pattern that you are talking about (and great minds must think alike, because I called it the "Knight's Tour" as well!).

I've got a version somewhere, but didn't finish it because I was specifically trying to make something faster than the BuildCraft Quarry, but couldn't see how the Knight's Tour could be the optimal mining approach. I'll break down my logic so you can see where I'm coming from:

In my tests I get the following times to perform turtle actions:

Move (forward/back/up/down): 0.4s
Turn (right/left): 0.4s
Dig (up/down/front): 0.4s
Detect (front/up/down): 0.05s
Compare (front/up/down): 0.05s

The key point is that moving, digging and turning the turtle take the same amount of time. Also, they take much longer than doing a detect or a compare. To optimise the mining speed I therefore tried to reduce the number of moves/digs/turns.


Note that the speed to detect/compare is pretty negligible, and therefore in most cases can be ignored. So when I was designing the most efficient mining pattern I was focussing on minimising the number of move/turn/dig actions that the turtle performed. All of these take the same amount of time, so I will just call them "actions".

It is however interesting to note that for any one block, if you do a 1xdetect() and then 7xcompare(), you might as well have dug the block as it would have taken the same amount of time. Therefore if you, on average, need to do more than 7 compares and 1 detect before deciding whether to dig a block, you might as well just dig it. In my video, I'm checking against 5 items each time (the 4 noise blocks and the chest), however it is designed to "fail fast", so that if it finds a match, then it doesn't need to check the rest. It is for this reason that the turtle mines quickest if you put the noise blocks in the order that they are most likely to be found (you should definitely always put stone in the first inventory slot, the rest are less important).


So focussing purely on the turtle's actions (i.e. move/turn/dig), assuming that the turtle is in a solid section of the world (so that it has to dig to go any direction), then you get the following timings assuming that the Knight's Tour is vertical (it is more efficient than doing it horizontally where you would have to turn 4 times to get back to facing in the same direction):

Knight's Tour: 1 x dig, 1 x move, 3 x turn (checks 5 blocks - the one that was moved into and the surrounding 4). This is a total of 2.0s
Mine every 3rd Layer: 1 x dig, 1 x move (checks 3 blocks - the one that was moved into and the 2 that are above and below). This is a total of 0.8s

Therefore the Knight's Tour takes 0.4s per block and the mine every 3rd layer approach takes 0.27s per block.

This isn't the full story because if the Knight's Tour was mining vertically then it wouldn't need to turn at the end of every row like mining every 3rd layer does. This adds two additional turns to each row. The timing impact of this depends on the size of the area being mined - in my example where an 8 x 8 area is being mined, this is effectively an additional turn every 12 blocks checked. So, you need to add .03s per block to allow for this. Note, the impact of this becomes smaller as the mining area becomes larger.

Therefore the time per block for a Knight's Tour is 0.4s per block compared to a total of 0.3s per block when mining every third layer.


By comparison, if the turtle were in an area with no blocks (and hence can move without digging), then the timings would be as follows:

Knight's Tour: 1 x move, 3 x turn (checks 5 blocks). This is a total of 4 actions = 1.6s
Mine every 3rd Layer: 1 x move (checks 3 blocks). This is a total of 1 action = 0.4s

When you add in the additional turn at the end of each row, you get 0.32s per block for the Knight's Tour and 0.17s for mining every third layer.


In theory you should also add the amount of time that the turtle takes to get from one mining row to the next and also to return to the start. Also, checking each block against items in the inventory has some impact. However, all programs will need to do this to some extent, so neither effect the overall timings significantly.

In both instances, based on my calculations, the Knight's Tour isn't the optimal approach.

I would be interested if anyone else has a different view.
platinawolf #21
Posted 30 December 2012 - 12:53 AM
Any chance to add a flag to make it just mine for those time's ya just needs everything "gone" and don't wan't to use a quarry?
AustinKK #22
Posted 30 December 2012 - 01:14 AM
Hi PlatinaWolf,

I guess, but I would normally use the excavate program to do that.
DiEvAl #23
Posted 30 December 2012 - 05:12 AM
"Every third row" needs to go much longer way to unload/refuel (about 45 seconds per unload) than "knight's tour".

When doing multithreading multiturtling, in "knight's tour" you don't need to predetermine which turtle will mine which area. So if some turtle had more air and finished quickly, it can go help other turtles. In "every third row" it will just sit doing nothing.

"Knight's tour" mines good ores slowly all the time, but "every third row" mines them in the very end. This is important when you are starting out and don't have many resources yet or if some of those resources are used to automatically craft more turtles.




BTW, this doesn't reflect real usefulness. Why would you want to mine all ores in a specific area in shortest time possible with 1 turtle? For example if a turtle misses 1/10 of the ores but is twice faster than yours, it's usually more useful because it can mine 1.8 times more ores per unit of time. IMHO much more realistic (but probably less fun) way to measure usefulness is a limtime -> infinity (oresMined / (time * nTurtles)).
Cozzimoto #24
Posted 30 December 2012 - 05:58 AM
Spoiler
Hey abculatter_2, Cozzimoto,

I tried the pattern that you are talking about (and great minds must think alike, because I called it the "Knight's Tour" as well!).

I've got a version somewhere, but didn't finish it because I was specifically trying to make something faster than the BuildCraft Quarry, but couldn't see how the Knight's Tour could be the optimal mining approach. I'll break down my logic so you can see where I'm coming from:

In my tests I get the following times to perform turtle actions:

Move (forward/back/up/down): 0.4s
Turn (right/left): 0.4s
Dig (up/down/front): 0.4s
Detect (front/up/down): 0.05s
Compare (front/up/down): 0.05s

The key point is that moving, digging and turning the turtle take the same amount of time. Also, they take much longer than doing a detect or a compare. To optimise the mining speed I therefore tried to reduce the number of moves/digs/turns.


Note that the speed to detect/compare is pretty negligible, and therefore in most cases can be ignored. So when I was designing the most efficient mining pattern I was focussing on minimising the number of move/turn/dig actions that the turtle performed. All of these take the same amount of time, so I will just call them "actions".

It is however interesting to note that for any one block, if you do a 1xdetect() and then 7xcompare(), you might as well have dug the block as it would have taken the same amount of time. Therefore if you, on average, need to do more than 7 compares and 1 detect before deciding whether to dig a block, you might as well just dig it. In my video, I'm checking against 5 items each time (the 4 noise blocks and the chest), however it is designed to "fail fast", so that if it finds a match, then it doesn't need to check the rest. It is for this reason that the turtle mines quickest if you put the noise blocks in the order that they are most likely to be found (you should definitely always put stone in the first inventory slot, the rest are less important).


So focussing purely on the turtle's actions (i.e. move/turn/dig), assuming that the turtle is in a solid section of the world (so that it has to dig to go any direction), then you get the following timings assuming that the Knight's Tour is vertical (it is more efficient than doing it horizontally where you would have to turn 4 times to get back to facing in the same direction):

Knight's Tour: 1 x dig, 1 x move, 3 x turn (checks 5 blocks - the one that was moved into and the surrounding 4). This is a total of 2.0s
Mine every 3rd Layer: 1 x dig, 1 x move (checks 3 blocks - the one that was moved into and the 2 that are above and below). This is a total of 0.8s

Therefore the Knight's Tour takes 0.4s per block and the mine every 3rd layer approach takes 0.27s per block.

This isn't the full story because if the Knight's Tour was mining vertically then it wouldn't need to turn at the end of every row like mining every 3rd layer does. This adds two additional turns to each row. The timing impact of this depends on the size of the area being mined - in my example where an 8 x 8 area is being mined, this is effectively an additional turn every 12 blocks checked. So, you need to add .03s per block to allow for this. Note, the impact of this becomes smaller as the mining area becomes larger.

Therefore the time per block for a Knight's Tour is 0.4s per block compared to a total of 0.3s per block when mining every third layer.


By comparison, if the turtle were in an area with no blocks (and hence can move without digging), then the timings would be as follows:

Knight's Tour: 1 x move, 3 x turn (checks 5 blocks). This is a total of 4 actions = 1.6s
Mine every 3rd Layer: 1 x move (checks 3 blocks). This is a total of 1 action = 0.4s

When you add in the additional turn at the end of each row, you get 0.32s per block for the Knight's Tour and 0.17s for mining every third layer.


In theory you should also add the amount of time that the turtle takes to get from one mining row to the next and also to return to the start. Also, checking each block against items in the inventory has some impact. However, all programs will need to do this to some extent, so neither effect the overall timings significantly.

In both instances, based on my calculations, the Knight's Tour isn't the optimal approach.

I would be interested if anyone else has a different view.

One thing that my knight quarry program does it i have 4 checks before it detects
and it goes the most common blocks to least common
IE stone dirt sand gravel

and if it compares and matches the very first one lets say its stone and it compares to the stone in the check list it then cant be anything else so it breaks the check list and returns false on my function. if its an ore its not going to return true to any of the checks so my function returns true and then mines it.

as far as moving i dont ever check the top or bottom till i get to bedrock where i only check the bottom because the turtle is already moving down. it just checks the walls and moves down.

another neat thing is when the turtle is returning he moves to its next spot in the knight move and digs up and checks all the walls that way till it reaches the surface.

i think my method is really fast compared to anything i have seen or tried. and uses of fuel is very low since my goal of this program is to do as much as possible in one move to conserve fuel

as for reaching a cave, if it detects a block then check it if not then must be a cave and continue to move down. so i dont lack that 1.6s comparison when he doesnt have to check anything because there is nothing there to check. so its a mixture of detecting if something is there to compare and finding caves

EDIT: another plus i like about the knights move theory is since it digs down every time it goes down you have a chance to find diamonds alot quicker than a standard quarry because you would have to wait for it to go down all the way to the bottom since it digs horizontally.
AustinKK #25
Posted 30 December 2012 - 07:39 AM
Hi DiEvAl,

With multiturtles, I was thinking that each would mine out their own area, and talk to a central computer to determine where the next quarry area would be. That way they wouldn't sit idle.

You're right about starting from the top, and therefore not getting the best ores until later. It's a good point, so I may add an option whereby you would still mine every third layer, but start at the bottom rather than the top. You would then get the good ores more quickly than you would if you were using a Knight's Tour. It wouldn't take any longer overall, so maybe it should be the default.

I agree regarding the measure of usefulness. I was trying to outperform the quarry and not miss anything (particularly uranium), but finding 90% of the ores in half the time would be better. Have you got an example of this?

The other thing regarding usefulness vs speed is that the turtle digs into the bedrock at the moment, and perhaps this is an unnecessary luxury (it slows down the average ore rate). Given that it is not uncommon to find good ores amongst the bedrock, I'll probably leave this in for now. It's the same with checking for chests (although this is an option that you can already disable), but again, I just don't like the idea of missing anything in the mined area.

By the way, I've just updated the program to version 0.3 so it is now about 20% faster than the BC Quarry (rather than the original 10% faster). I'm also looking at what the optimal set of "noise blocks" are to maximise the speed.
AustinKK #26
Posted 30 December 2012 - 07:47 AM
Hey Cozzimoto,

I definitely agree that a Knight's Tour approach is good if you want to use the minimum fuel. The program I wrote moves through 1 of every 3 blocks, whereas a Knight's Tour would only go through 1 in 5, and therefore will be much more efficient (especially as yours returns up the next shaft rather than returning to the top and digging down again).

Not sure I quite understand your point regarding caves. When you say "if it detects a block", do you mean checking for a block below? So if there is no block below you don't check the four surrounding blocks?

I agree with you point about the diamonds and it is a good one, see my post above that I might change the mining order to start at the bottom first.
Cozzimoto #27
Posted 30 December 2012 - 08:37 AM
AustinKK:

i read your post above about starting from the bottom and i havent thought about that. lol.
but what i have found out is that if it doesnt match its junk list it will still return true if there is nothing there. because initially it was just comparing, but i added if turtle.detect() then check the junk list. but if there isnt anything there then just skip comparing the junk list
AustinKK #28
Posted 30 December 2012 - 09:01 AM
Hi Cozzimoto,

yeah, you need to detect as well if all your compares are false. I've changed the order of compares in the latest version of my code so that it does the detect at the end (so check the junk list first, then compare rather than the other way round). It's a little bit quicker since it's more common to find junk than it is to find an air block.
Cozzimoto #29
Posted 30 December 2012 - 09:15 AM
im trying to understand what you did, you do a compare then a detect. why not detect if the block is there in the first place before you take the nescessary time to check the junk list.

my check function does the following.

for i=1,4 do
selects slot
does a compare [then if it matches before the end of the loop it breaks it and returns false]
end

if the loop is finished must return true cause the block being compared must me an ore block


so while its doing the loop i need it to detect if a block is there because if it doesnt then its going to go through the list check it all and none of them are giong to match so it returns true when it doesnt need to becasue its an air block.

this is why my check is in the begining becasue the function that checks the walls i use its return arguments to dig the block if true in another function that loops it to check all 4 sides instead of one.
AustinKK #30
Posted 30 December 2012 - 10:43 AM
I have something very similar to you (I have the same type of function to calculate if the turtle should dig), except I do the detect at the end.

My logic goes like this:

Typically, it is a lot more common that you will find a stone block than you will find an air block. Because of this, I want to get to the test that allows the function to return as quickly as possible. I think that finding a stone block (which would be the first junk block) is more than 4 times likely than finding an air block in most cases, therefore detecting for a junk block and then as a final resort checking for an air block should be quicker than doing it the other way round (does that make sense?!)

To put it another way, I guess if you wanted to be really clever, the most efficient way would be to do the following (assuming you agree that this is the order of likelihood of finding these things):

1) Check if the block is stone (compare)
2) Check if the block is dirt (compare)
3) Check if the block is air (detect)
4) Check if the block is gravel (compare)
5) Check if the block is sand (compare)

That would allow the function to return in the quickest possible time because you are checking the most likely case each time. As long as the junk list is small (I've done some tests that are starting to make me think that the optimal junk list might be just stone and dirt) then it should be the case that doing the compares first and the detects second is optimal.

If you have a long compare list then this no longer remains true, but as I say, I'm thinking that a junk list of 2 might be optimal (for my program anyway) in most cases.
Cozzimoto #31
Posted 30 December 2012 - 10:51 AM
ok but an air block is untangable how would you do that in the middle of a junk list? i odnt have an actual spot to check if there is anything there or not. its just written in the code to check if it fails to check everything else.

and i like my junk list cause i dont need any sand or gravel, i hate gravel. lol
platinawolf #32
Posted 30 December 2012 - 12:07 PM
The normal excavate program just takes one row at a time though AustinKK, your program takes 3 row's at a time ^^* Though I suppose I could just put some glass in the first slot ^^* I'd lose a slot but its still faster than the normal excavate. Assuming ofcourse they havn't updated the excavate program.
AustinKK #33
Posted 30 December 2012 - 09:24 PM
Cozzimoto,

I was thinking that you could somehow configure it to know (so for example, you could give it two junk lists, one to check before the compare, one to check afterwards). Or you could have two settings, one which is the number of junk blocks, one which is how many of them to check before looking for an air block.

Just an idea - not sure I'm going to implement it. As I say, I'm starting to think that 2 junk blocks is optimal (one stone, one dirt) - I'm not quite sure whether it's true in all cases, but if it is, in effect I'm going to get the 1) - 3) elements of the list above.
AustinKK #34
Posted 30 December 2012 - 09:26 PM
Hi platinawolf,

Not sure I follow about the glass block. Are you suggesting you put glass in to indicate an air block?

Not sure I follow your point about mining three layers vs one layer either. Can you clarify?
platinawolf #35
Posted 31 December 2012 - 07:30 AM
Right ^^* Using glassblock to trick your program that it has noise blocks ^^* As for digging three layers vs one layer, 3 layers is faster due to less movement :P/> Sides, the normal excavate turtle doesn't open chests does it?
AustinKK #36
Posted 31 December 2012 - 09:30 PM
Platinawolf,

Ah, I see what you mean. Yes, you do need to provide a noise block, so glass would do it. If you wanted to mine everything out though, I'm not sure it would be much quicker. I'd be interested to know how much faster it is than excavate (if it is at all).
Ulthean #37
Posted 31 December 2012 - 10:20 PM
Sure it is, using the values you pointed out earlier:
  • The normal excavate digs one block per move, so to dig one block it takes on average: 0.4s (dig) + 0.4s (move) = 0.8 seconds per block
  • Three layer excavations dig three blocks per move: 0.4s (dig) + 0.4s (dig) + 0.4s (dig) + 0.4s (move) = 1.6 seconds per three blocks = 0.533.. seconds per block
So three layer excavation programs are 1-(0.533&#46;&#46;/0.8) = 33% faster than the standard excavation program.
AustinKK #38
Posted 01 January 2013 - 07:38 AM
Hi Ulthean,

Yes, I suppose when you put it like that…

It makes sense too because it is doing the same amount of digging, but only a third the amount of moving. Would be interesting to see if it actually works out that way (I'm just thinking that the excavate just digs rather than trying to determine if there is a noise block/chest first).
Doyle3694 #39
Posted 01 January 2013 - 08:13 AM
I hope you know that 4 stirling engines isn't even half speed, because you said it would be full speed in the video. So I find your testresults….. obsolete.
AustinKK #40
Posted 01 January 2013 - 03:02 PM
Hi Doyle3694,

Yes I now know that the 10Mj/t limit has been removed from the Quarry. I've commented on the video to that effect if you look on YouTube.

I'm going to re-record the video to set the record straight. Running the quarry from a redstone energy cell placed next to it mines the sample area in 39 minutes as apposed to the 1h 3m shown in the video.


It's not quite double the speed, but it's not far off.
Doyle3694 #41
Posted 01 January 2013 - 03:05 PM
9MJ/t is the limit. 4MJ/t is what you get from 4 stirling engines. With some math 4 is less than 9/2
AustinKK #42
Posted 02 January 2013 - 07:10 AM
Hey Doyle3694,

I think you may have misunderstood my point. Yes you are right that 4 Stirling Engines doesn't power the Quarry at full speed, and I got it wrong. I intend to add a new video to YouTube to correct my error.

However, it's not correct that the Quarry powered at 9MJ/t is more than twice as fas as the Quarry powered at 4 MJ/t. Also, the limit is no longer 9MJ/t.

The more power you give the Quarry the faster it goes, but the increase is not linear. Here are some examples based on the map that I used in the video:

4 MJ/t = 1:03:26 (as per the video)
10 MJ/t = 43:38 (this is only 31% faster despite being 2.5 times as much energy)

The point I was making in my previous post is that this isn't even the limit anymore. For instance, if you place a Redstone Energy Cell next to the Quarry, and max it's output (125MJ/t), then the Quarry completes in 39:31.

The more power you give it the faster it goes, but the returns are diminished as the energy levels increase.
Doyle3694 #43
Posted 02 January 2013 - 08:50 AM
http://minecraftbuil...com/wiki/Quarry

And yes, I was wrong saying its double speed. Though, I really thought that it was just a straight curve up. I see your point on it not being 100% higher speed but only 30% higher speed.
Guess you should just add a annotation or something in the video to clearify the incorrect time.

Anyways, it's a really clever design.
AustinKK #44
Posted 02 January 2013 - 10:24 AM
Thanks.

I'm going to create a new video this week and update the old one.

Running from a Redstone Energy Cell the Quarry mines out in 39:31. I've spent ages optimising the program and I've managed to get it down to about a minute quicker than that (which is about a third quicker than it was in the video).

It's not going to be faster in all cases (for instance if there is loads of air blocks, then the Quarry will always be faster because it just skips from one block to another whereas the turtle needs to work its way through them) but given the fuel requirements hopefully it still has a use.
Crozekiel #45
Posted 02 January 2013 - 11:54 AM
Say you left the turtle running, and then you left the area and forgot to plonk down a world anchor… Is there a way to get them to continue where they left off? or do i need to take them back to the start and tell them to go again?
simwah #46
Posted 02 January 2013 - 02:13 PM
Is there anyway we could get the turtle to continue mining on startup (server crash, etc) or atleast return home. I keep loosing my turtles and have to go find them.
Kane Hart #47
Posted 02 January 2013 - 04:04 PM
Is there anyway we could get the turtle to continue mining on startup (server crash, etc) or atleast return home. I keep loosing my turtles and have to go find them.

Also having this issue. Accept I never find them again haha.
DrCeph #48
Posted 02 January 2013 - 05:51 PM
Is there anyway we could get the turtle to continue mining on startup (server crash, etc) or atleast return home. I keep loosing my turtles and have to go find them.

Having it return home would be a good compromise, I suppose something like storing the start point in a file and moving there on boot would be a simple way to do this. This is especially important given that the levels created are only one block high and hence can't fit the player. Also, most people would use a miner like this early on when they are low on resources so those 3 lost diamond hurts.
simwah #49
Posted 02 January 2013 - 06:00 PM
Its especially hard when your running 64x64 mines.
Doyle3694 #50
Posted 02 January 2013 - 10:09 PM
Atleast if you are using gps it shouldn't be to much code to add a save position feature, try adding that feature yourself. It shouldn't be to many lines of code really
AustinKK #51
Posted 03 January 2013 - 12:11 AM
I haven't added this yet. I've been working on performance improvements but I know this is an issue. It's something that I'm going to look into.
Kadura #52
Posted 03 January 2013 - 02:52 PM
I am quite new to ComputerCraft, and am having difficulty figuring out how to view the output the program seems to be sending out via the rednet system. Is there a companion program that will run on a computer/turtle near the mining turtles that will display that output?
DiamondDave #53
Posted 03 January 2013 - 05:43 PM
I am quite new to ComputerCraft, and am having difficulty figuring out how to view the output the program seems to be sending out via the rednet system. Is there a companion program that will run on a computer/turtle near the mining turtles that will display that output?
Here's some code I pieced together from various threads to do this. I don't claim any of this as original. Sorry, I don't recall the author's off hand. I have this code saved as rednetLogger. The command runs at start up on a turtle at y level 250. It grabs the time from the web (stolen bit, I really should find the author's name) and timestamps incoming messages. Maybe someone knows of a better way to pull real world time? The message and time are written to the file, rednetlog. I use less in a bash shell outside of minecraft to watch this file during long mining runs. Much easier on the eyes. Notepad++ on windows is good for watching log file changes. too. I quickly learned this program running at ground level loses contact with the mining turtle somewhere down around mining level 11. The 64 block limit for a wireless rednet computer sitting on the ground in my case. The logger needs to be up high or it will miss messages. Also, it's easy to flood the logger with too many messages. Probably, because of the web time pull. So, in my mining code I have a sleep(0.2) before and after the rednet.broadcast to keep missed messages down. Skews the time a bit but close enough.
Spoiler

-- HTTP parsing methods --
function GetTimePage()
		local sRespone = nil
		local sLine = ""
		sResponse = http.get( "http://www.timeanddate.com/library/abbreviations/timezones/na/cst.html" )
	  
		if sResponse then
				for nLine = 1, 31 do
						sLine = sResponse.readLine()
--print(sLine)
				end
				sResponse.close()
				return true, sLine
		else
				return false, nil
		end
end
function GetTimeFromLine()
		sArea = "Central Standard Time"
		local bSuccess, sLine = GetTimePage()
		if bSuccess then
				if sArea == "Pacific Standard Time" then
						_, nTimePos = string.find( sLine, '<span id="ij0">' )
						nEndTimePos = string.find( sLine, '</span>', nTimePos )
				else
						_, nTimePos = string.find( sLine, 'class="big">' )
						nEndTimePos = string.find( sLine, '</span>', nTimePos )
				end
				local sTime = string.sub( sLine, nTimePos + 1, nEndTimePos - 1 )
				return sTime
		else
				return nil
		end
end
local delay = 2
local sNow
term.clear()
term.setCursorPos(1,1)
rednet.open("right")
print( GetTimeFromLine() )
if not fs.exists("rednetLog") then
   f = fs.open("rednetlog", "w")
   sNow = GetTimeFromLine()
   message = "Log File Created - "..sNow
   f.writeLine(message)
   f.close()
   print("Created Log file.")
end
while true do
	evt, p1, p2, p3 = os.pullEvent()
	if evt == "rednet_message" then
	  sNow = GetTimeFromLine()
	  message = sNow..": "..p1..": "..p2.." | "..p3
	  print( message )
	  f = fs.open("rednetlog","a")
	  f.writeLine(message)
	  f.close()
	end
end
Kadura #54
Posted 03 January 2013 - 06:08 PM
DiamondDave,

Out of curiosity, have you tried the above program with the OreQuarry program this topic is about? I am not going to be able to put anything up high since I am working on an ore world that the surface is deadly. I need to stay underground to keep from bursting into flames.

Also, will this be making it to pastebin?
DiamondDave #55
Posted 03 January 2013 - 06:49 PM
Thanks, for sharing the code AustinKK!

I made a few changes to satisfy my OCD. The turtles popping up out of the ground is cool and all and they gave me a great idea for a turtle defense system where turtles appear out of the ground on command. But, I like using the mine shaft. So, I changed the logic a bit to only dig up to the previous mining layer and then return to main mining shaft before heading up. Fewer blocks to dig through and one shaft. Also, I really want to make sure I get those hidden diamonds. I changed the bottomLayer logic to spin the turtle all the way around to detect hidden ores. Put glass in the inventory along with the other noise blocks if you run this on the OreQuarry world save or it will break some below layer 5. These changes didn't add much to the overall run-time of QreQuarry v 0.3. Around 52mins on a fresh OreQuarry world save and I got that diamond hidden in the bedrock. :)/>

This is not an official AustinKK release. Just some changes for the OCD miner. Here is the diff from the original .3 version and my copy. Feel free to use my changes or not…

Spoiler

14c14
< -- **																			  ** --
---
> -- **	 2nd Jan 2013: [v0.3+] The OCD Miner changes							  ** --
34c34,35
<
---
> local exitLevel = 0
>
193,194c194,196
<   if (currY < startHeight) then
<	 while (currY < startHeight) do
---
>   -- Return to the bottom layer before returning
>   if (currY < bottomLayer) then
>	 while (currY < bottomLayer) do
197,199d198
<   elseif (currY > startHeight) then
<	 -- This should never happen
<	 writeMessage("Current height is greater than start height in returnToStartAndUnload", messageLevel.ERROR)
201c200,207
<
---
>   -- Set exitLevel to previous level and dig up
>   if (currY < startHeight) then
>		   exitLevel = currY + 3
>		   while (currY < exitLevel) do
>				   turtleUp()
>				 end
>   end
>
223c229,238
<
---
>   -- In the shaft now go home
>   if (currY < startHeight) then
>	 while (currY < startHeight) do
>	   turtleUp()
>	 end
>   elseif (currY > startHeight) then
>	 -- This should never happen
>	 writeMessage("Current height is greater than start height in returnToStartAndUnload", messageLevel.ERROR)
>   end
>
271a287,304
>
>	 -- Move back to the correct Y position
>	 -- Did I start below the bottomLayer?
>	   -- Go to bottomLayer if we did.
>	   if (storedY < bottomLayer) then
>		 while (bottomLayer < currY) do
>		   turtleDown()
>		 end
>	   --Else, go to exitLevel
>	   elseif (storedY < currY) then
>	   while (exitLevel < currY) do
>		 turtleDown()
>	   end
>	 elseif (storedY > currY) then
>	   -- This should never happen
>	   writeMessage("Stored y is greater than current y in returnToStartAndUnload", messageLevel.ERROR)
>	 end
>
300,307c333,337
<	 -- Move back to the correct Y position
<	 if (storedY < currY) then
<	   while (storedY < currY) do
<		 turtleDown()
<	   end
<	 elseif (storedY > currY) then
<	   -- This should never happen
<	   writeMessage("Stored y is greater than current y in returnToStartAndUnload", messageLevel.ERROR)
---
>	 if (exitLevel > 0) then
>		 while (storedY < currY) do
>				 turtleDown()
>			   end
>			   exitLevel=0
310c340,346
<	 -- Finally, set the correct orientation
---
>	 if (storedY < bottomLayer) then
>		 while (storedY<currY) do
>		   turtleDown()
>		 end
>	   end
>
>	   -- Finally, set the correct orientation
845a882,888
>				   -- Spin around and search for hiddin ore
>				   for i=1,4 do
>					 if (isNoiseBlock(turtle.detect, turtle.compare) == false) then
>						   turtle.dig()
>						 end
>						 turtle.turnRight()
>					   end
Spoiler

-- ********************************************************************************** --
-- **																			  ** --
-- **   Minecraft Mining Turtle Ore Quarry v0.3 by AustinKK						** --
-- **   ---------------------------------------------------						** --
-- **																			  ** --
-- **   For instructions on how to use:											** --
-- **																			  ** --
-- **	 http://www.youtube.com/watch?v=DS1H4OY0yyg							   ** --
-- **																			  ** --
-- **																			  ** --
-- **  Change Log:																 ** --
-- **	27th Dec 2012: [v0.2] Initial Draft Release							   ** --
-- **	29th Dec 2012: [v0.3] Minor Performance Improvements					  ** --
-- **	 2nd Jan 2013: [v0.3+] The OCD Miner changes							  ** --
-- ********************************************************************************** --
-- Enumeration to store the the different types of message that can be written
messageLevel = { DEBUG=0, INFO=1, WARNING=2, ERROR=3, FATAL=4 }

-- Enumeration to store names for the 6 directions
direction = { FORWARD=0, RIGHT=1, BACK=2, LEFT=3, UP=4, DOWN=5 }

local messageOutputLevel = messageLevel.INFO
local fuelLevelToRefuelAt = 5
local refuelItemsToUseWhenRefuelling = 64
local emergencyFuelToRetain = 0
local maximumGravelStackSupported = 25 -- The number of stacked gravel or sand blocks supported
local nonSeamBlocks
local bottomLayer = 5 -- The y co-ords of the layer immediately above bedrock
local returningToStart = false
local lookForChests = false -- Determines if chests should be located as part of the quarrying
local lastEmptySlot -- The last inventory slot that was empty when the program started (is either 15 if not looking for chests or 14 if we are)
local turtleId
local exitLevel = 0
-- Variables to store the current location and orientation of the turtle. x is right, left, y is up, down and
-- z is forward, back with relation to the starting orientation. Y is the actual turtle level, x and z are
-- in relation to the starting point (i.e. the starting point is (0, 0))
local currX
local currY
local currZ
local currOrient

-- Command line parameters
local startHeight -- Represents the height (y co-ord) that the turtle started at
local quarryWidth -- Represents the length of the mines that the turtle will dig

-- ********************************************************************************** --
-- Writes an output message
-- ********************************************************************************** --
function writeMessage(message, msgLevel)
  if (msgLevel >= messageOutputLevel) then
	print(message)
	if (turtleId == nil) then
	  rednet.broadcast(message)
	else
	  -- Broadcast the message (prefixed with the turtle's id)
	  rednet.broadcast("[".. turtleId.."] "..message)
	end
	sleep(0.4)
  end
end

-- ********************************************************************************** --
-- Ensures that the turtle has fuel
-- ********************************************************************************** --
function ensureFuel()

  -- Determine whether a refuel is required
  local fuelLevel = turtle.getFuelLevel()
  if (fuelLevel ~= "unlimited") then
	if (fuelLevel < fuelLevelToRefuelAt) then
	  -- Need to refuel
	  turtle.select(16)
	  local fuelItems = turtle.getItemCount(16)

	  -- Do we need to impact the emergency fuel to continue? (always
	  -- keep one fuel item in slot 16)
	  if (fuelItems == 0) then
		writeMessage("Completely out of fuel!", messageLevel.FATAL)
	  elseif (fuelItems == 1) then
		writeMessage("Out of Fuel!", messageLevel.ERROR)
	  elseif (fuelItems <= (emergencyFuelToRetain + 1)) then
		writeMessage("Consuming emergency fuel supply. "..(fuelItems - 2).." emergency fuel items remain", messageLevel.WARNING)
		turtle.refuel(1)
	  else
		-- Refuel the lesser of the refuelItemsToUseWhenRefuelling and the number of items more than
		-- the emergency fuel level
		if (fuelItems - (emergencyFuelToRetain + 1) < refuelItemsToUseWhenRefuelling) then
		  turtle.refuel(fuelItems - (emergencyFuelToRetain + 1))
		else
		  turtle.refuel(refuelItemsToUseWhenRefuelling)
		end
	  end
	end
  end
end	  

-- ********************************************************************************** --
-- Checks that the turtle has inventory space by checking for spare slots and returning
-- to the starting point to empty out if it doesn't.
--
-- Takes the position required to move to in order to empty the turtle's inventory
-- should it be full as arguments
-- ********************************************************************************** --
function ensureInventorySpace()

  -- If already returning to start, then don't need to do anything
  if (returningToStart == false) then

	-- If the last inventory slot is full, then need to return to the start and empty
	if (turtle.getItemCount(lastEmptySlot) > 0) then

	  -- Return to the starting point and empty the inventory, then go back to mining
	  returnToStartAndUnload(true)
	end
  end
end

-- ********************************************************************************** --
-- Function that is called when the turtle has returned to the start in order to
-- empty its inventory into the chest and also pick up any fuel that is
-- available
-- ********************************************************************************** --
function emptyInventory()

  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop)
	if ((slotLoop <= nonSeamBlocks) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end
	
	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items
  turtleSetOrientation(direction.LEFT)
  turtle.select(16)
  local currFuelItems = turtle.getItemCount(16)
  turtle.suck()
  while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	currFuelItems = turtle.getItemCount(16)
	turtle.suck()
  end

  slotLoop = nonSeamBlocks + 1
  -- Have now picked up all the items that we can. If we have also picked up some
  -- additional fuel in some of the other slots, then drop it again
  while (slotLoop < lastEmptySlot) do
	-- Drop any items found in this slot
	turtle.select(slotLoop)
	turtle.drop()
	slotLoop = slotLoop + 1
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)
end

-- ********************************************************************************** --
-- Function to move to the starting point, call a function that is passed in
-- and return to the same location (if required)
-- ********************************************************************************** --
function returnToStartAndUnload(returnBackToMiningPoint)

  writeMessage("returnToStartAndUnload called", messageLevel.DEBUG)
  returningToStart = true

  -- Store the current location and orientation so that it can be returned to
  local storedX = currX
  local storedY = currY
  local storedZ = currZ
  local storedOrient = currOrient

  -- First direction to move is straight up. Do this because the inventory is full and
  -- therefore don't want to pass through any blocks that contain ores. Know that all
  -- blocks above don't contain ores, so is safe to go that way
  -- (Note, there is a rare edge case where the inventory becomes full after moving
  -- forward and before checking the block above, this is quite rare and given the
  -- likelihood of it not being able be added to the inventory (even though slot 15
  -- is full), and is deemed an acceptable risk)

  -- Return to the bottom layer before returning
  if (currY < bottomLayer) then
	while (currY < bottomLayer) do
	  turtleUp()
	end
  end
  -- Set exitLevel to previous level and dig up
  if (currY < startHeight) then
		  exitLevel = currY + 3
		  while (currY < exitLevel) do
	  turtleUp()
	end
  end

  -- Move back to the correct X position
  if (currX > 0) then
	turtleSetOrientation(direction.LEFT)
	while (currX > 0) do
	  turtleForward()
	end
  elseif (currX < 0) then
	-- This should never happen
	writeMessage("Current x is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
  end

  -- Move back to the correct Z position
  if (currZ > 0) then
	turtleSetOrientation(direction.BACK)
	while (currZ > 0) do
	  turtleForward()
	end
  elseif (currZ < 0) then
	-- This should never happen
	writeMessage("Current z is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
  end
  -- In the shaft now go home
  if (currY < startHeight) then
	while (currY < startHeight) do
	  turtleUp()
	end
  elseif (currY > startHeight) then
	-- This should never happen
	writeMessage("Current height is greater than start height in returnToStartAndUnload", messageLevel.ERROR)
  end
  
  -- Empty the inventory
  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop)
	if ((slotLoop <= nonSeamBlocks) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end
	
	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items
  turtleSetOrientation(direction.LEFT)
  turtle.select(16)
  local currFuelItems = turtle.getItemCount(16)
  turtle.suck()
  while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	currFuelItems = turtle.getItemCount(16)
	turtle.suck()
  end

  slotLoop = nonSeamBlocks + 1
  -- Have now picked up all the items that we can. If we have also picked up some
  -- additional fuel in some of the other slots, then drop it again
  while (slotLoop <= lastEmptySlot) do
	-- Drop any items found in this slot
	turtle.select(slotLoop)
	turtle.drop()
	slotLoop = slotLoop + 1
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)

  -- If required, move back to the point that we were mining at before returning to the start
  if (returnBackToMiningPoint == true) then
	-- Return to the point that we were at so that quarrying may resume
	-- Move back to the correct Y position
	-- Did I start below the bottomLayer?
-- Go to bottomLayer if we did.
if (storedY < bottomLayer) then
   while (bottomLayer < currY) do
	 turtleDown()
   end
--Else, go to exitLevel
elseif (storedY < currY) then
	  while (exitLevel < currY) do
		turtleDown()
	  end
	elseif (storedY > currY) then
	  -- This should never happen
	  writeMessage("Stored y is greater than current y in returnToStartAndUnload", messageLevel.ERROR)
	end
	-- Move back to the correct Z position
	writeMessage("Stored Z: "..storedZ..", currZ: "..currZ, messageLevel.DEBUG)
	if (storedZ > currZ) then
	  writeMessage("Orienting forward", messageLevel.DEBUG)
	  writeMessage("Moving in z direction", messageLevel.DEBUG)
	  turtleSetOrientation(direction.FORWARD)
	  while (storedZ > currZ) do
		turtleForward()
	  end
	elseif (storedZ < currZ) then
	  -- This should never happen
	  writeMessage("Stored z is less than current z in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Move back to the correct X position
	if (storedX > currX) then
	  writeMessage("Stored X: "..storedX..", currX: "..currX, messageLevel.DEBUG)
	  writeMessage("Orienting right", messageLevel.DEBUG)
	  writeMessage("Moving in x direction", messageLevel.DEBUG)
	  turtleSetOrientation(direction.RIGHT)
	  while (storedX > currX) do
		turtleForward()
	  end
	elseif (storedX < currX) then
	  -- This should never happen
	  writeMessage("Stored x is less than current x in returnToStartAndUnload", messageLevel.ERROR)
	end

	if (exitLevel > 0) then
		while (storedY < currY) do
	turtleDown()
  end
  exitLevel=0
	end

	if (storedY < bottomLayer) then
   while (storedY<currY) do
	 turtleDown()
   end
end
  
-- Finally, set the correct orientation
	turtleSetOrientation(storedOrient)

	writeMessage("Have returned to the mining point", messageLevel.DEBUG)
  end

  returningToStart = false

end

-- ********************************************************************************** --
-- Empties a chest's contents
-- ********************************************************************************** --
function emptyChest(suckFn)

  local prevInventoryCount = {}
  local inventoryLoop
  local chestEmptied = false

  -- Record the number of items in each of the inventory slots
  for inventoryLoop = 1, 16 do
	prevInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
  end

  while (chestEmptied == false) do
	-- Pick up the next item
	suckFn()

	-- Determine the number of items in each of the inventory slots now
	local newInventoryCount = {}
	for inventoryLoop = 1, 16 do
	  newInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
	end

	-- Now, determine whether there have been any items taken from the chest
	local foundDifferentItemCount = false
	inventoryLoop = 1
	while ((foundDifferentItemCount == false) and (inventoryLoop <= 16)) do
	  if (prevInventoryCount[inventoryLoop] ~= newInventoryCount[inventoryLoop]) then
		foundDifferentItemCount = true
	  else
		inventoryLoop = inventoryLoop + 1
	  end
	end
  
	-- If no items have been found with a different item count, then the chest has been emptied
	chestEmptied = not foundDifferentItemCount

	if (chestEmptied == false) then
	  prevInventoryCount = newInventoryCount
	  -- Check that there is sufficient inventory space as may have picked up a block
	  ensureInventorySpace()
	end
  end

  writeMessage("Finished emptying chest", messageLevel.DEBUG)
end


-- ********************************************************************************** --
-- Generic function to move the Turtle (pushing through any gravel or other
-- things such as mobs that might get in the way).
--
-- The only thing that should stop the turtle moving is bedrock. Where this is
-- found, the function will return after 15 seconds returning false
-- ********************************************************************************** --
function moveTurtle(moveFn, detectFn, digFn, attackFn, compareFn, suckFn, maxDigCount)

  ensureFuel()

  -- If we are looking for chests, then check that this isn't a chest before moving
  if (lookForChests == true) then
	if (isChestBlock(compareFn) == true) then
	  -- Have found a chest, empty it before continuing
	  emptyChest (suckFn)
	end
  end

  -- Flag to determine whether digging has been tried yet. If it has
  -- then pause briefly before digging again to allow sand or gravel to
  -- drop
  local digCount = 0
  local moveSuccess = moveFn()

  while ((moveSuccess == false) and (digCount < maxDigCount)) do

	-- If there is a block in front, dig it
	if (detectFn() == true) then
	  
		-- If we've already tried digging, then pause before digging again to let
		-- any sand or gravel drop
		if(digCount > 0) then
		  sleep(0.1)
		end

		digFn()
		digCount = digCount + 1
	else
	   -- Am being stopped from moving by a mob, attack it
	   attackFn()
	end

	-- Try the move again
	moveSuccess = moveFn()
  end

  -- Return the move success
  return moveSuccess

end

-- ********************************************************************************** --
-- Move the turtle forward one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleForward()
  local returnVal = moveTurtle(turtle.forward, turtle.detect, turtle.dig, turtle.attack, turtle.compare, turtle.suck, maximumGravelStackSupported)
  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ + 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX - 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ - 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX + 1
	else
	  writeMessage ("Invalid currOrient in turtleForward function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end

  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle up one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleUp()
  local returnVal = moveTurtle(turtle.up, turtle.detectUp, turtle.digUp, turtle.attackUp, turtle.compareUp, turtle.suckUp, maximumGravelStackSupported)
  if (returnVal == true) then
	currY = currY + 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle down one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleDown()
  local returnVal

  -- Because the turtle is digging down, can fail fast (only allow 1 dig attempt).
  returnVal = moveTurtle(turtle.down, turtle.detectDown, turtle.digDown, turtle.attackDown, turtle.compareDown, turtle.suckDown, 1)
  if (returnVal == true) then
	currY = currY - 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle back one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleBack()
  -- First try to move back using the standard function
  local returnVal = turtle.back()

  -- Moving back didn't work (might be a block or a mob in the way). Turn round and move
  -- forward instead (whereby anything in the way can be cleared)
  if(returnVal == false) then
	turtle.turnRight()
	turtle.turnRight()
	returnVal = turtleForward()
	turtle.turnRight()
	turtle.turnRight()
  end

  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ - 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX + 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ + 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX - 1
	else
	  writeMessage ("Invalid currOrient in turtleBack function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  
  return returnVal
end

-- ********************************************************************************** --
-- Turns the turtle (updating the current orientation at the same time)
-- ********************************************************************************** --
function turtleTurn(turnDir)

  if (turnDir == direction.LEFT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.LEFT
	  turtle.turnLeft()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.BACK
	  turtle.turnLeft()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.RIGHT
	  turtle.turnLeft()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.FORWARD
	  turtle.turnLeft()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  elseif (turnDir == direction.RIGHT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.RIGHT
	  turtle.turnRight()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.FORWARD
	  turtle.turnRight()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.LEFT
	  turtle.turnRight()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.BACK
	  turtle.turnRight()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  else
	writeMessage ("Invalid turnDir in turtleTurn function", messageLevel.ERROR)
  end
end

-- ********************************************************************************** --
-- Sets the turtle to a specific orientation, irrespective of its current orientation
-- ********************************************************************************** --
function turtleSetOrientation(newOrient)

  if (currOrient ~= newOrient) then
	if (currOrient == direction.FORWARD) then
	  if (newOrient == direction.RIGHT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.RIGHT) then
	  if (newOrient == direction.BACK) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.BACK) then
	  if (newOrient == direction.LEFT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.LEFT) then
	  if (newOrient == direction.FORWARD) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  end
end

-- ********************************************************************************** --
-- Determines if a particular block is considered a noise block or not. A noise
-- block is one that is a standard block in the game (stone, dirt, gravel etc.) and
-- is one to ignore when a seam is being dug out. Function works by comparing the block
-- in question against a set of blocks in the turtle's inventory which are known not to
-- be noise blocks. The first parameter is the number of slots containing noise blocks
-- (these must be at the start of the turtle's inventory), and the second param is the
-- function to use to compare the block for a noise block
-- ********************************************************************************** --
function isNoiseBlock(detectFn, compareFn)

  -- Consider air to be a noise block
  local returnVal = false
  local seamLoop = 1

  while((returnVal == false) and (seamLoop <= nonSeamBlocks)) do
	turtle.select(seamLoop)
	returnVal = compareFn()
	seamLoop = seamLoop + 1
  end
  -- Finally, check if this is an air block or not. Do this last on the assumption
  -- that typically this will be the case less than 1 in 4 times (in which case it is
  -- quicker to test for noise blocks first)
  if (returnVal == false) then
	returnVal = not detectFn()
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Determines if a particular block is a chest. Returns false if it is not a chest
-- or chests are not being detected
-- ********************************************************************************** --
function isChestBlock(compareFn)

  -- Check the block in the appropriate direction to see whether it is a chest. Only
  -- do this if we are looking for chests
  local returnVal = false
  if (lookForChests == true) then
	turtle.select(15)
	returnVal = compareFn()
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Function to calculate the number of non seam blocks in the turtle's inventory. This
-- is all of the blocks at the start of the inventory (before the first empty slot is
-- found
-- ********************************************************************************** --
function determineNonSeamBlocksCount()
  -- Determine the location of the first empty inventory slot. All items before this represent
  -- noise items.
  local foundFirstBlankInventorySlot = false
  nonSeamBlocks = 1
  while ((nonSeamBlocks < 16) and (foundFirstBlankInventorySlot == false)) do
	if (turtle.getItemCount(nonSeamBlocks) > 0) then
	  nonSeamBlocks = nonSeamBlocks + 1
	else
	  foundFirstBlankInventorySlot = true
	end
  end
  nonSeamBlocks = nonSeamBlocks - 1

  -- Determine whether a chest was provided, and hence whether we should support
  -- looking for chests
  if (turtle.getItemCount(15) > 0) then
	lookForChests = true
	lastEmptySlot = 14
	writeMessage("Looking for chests...", messageLevel.DEBUG)
  else
	lastEmptySlot = 15
	writeMessage("Ignoring chests...", messageLevel.DEBUG)
  end
end

-- ********************************************************************************** --
-- Creates a quarry mining out only ores and leaving behind any noise blocks
-- ********************************************************************************** --
function createQuarry()

  -- Determine the starting layer. The turtle mines in layers of 3, and the bottom layer
  -- is the layer directly above bedrock.
  --
  -- The actual layer that the turtle operates in is the middle of these three layers,
  -- so determine the top layer
  local firstMiningLayer = startHeight + ((bottomLayer - startHeight - 2) % 3) - 1

  -- If the top layer is up, then ignore it and move to the next layer
  if (firstMiningLayer > currY) then
	firstMiningLayer = firstMiningLayer - 3
  end

  local miningLoop
  local startedLayerToRight = true -- Only used where the quarry is of an odd width

  -- Loop over each mining row
  for miningLoop = firstMiningLayer, bottomLayer, -3 do
	writeMessage("Mining Layer: "..miningLoop, messageLevel.INFO)

	-- Move to the correct level to start mining
	if (currY > miningLoop) then
	  while (currY > miningLoop) do
		turtleDown()
	  end
	end

	-- Move turtle into the correct orientation to start mining (if this is the
	-- first row, then just turn right, otherwise turn all the way around)
	if (miningLoop < firstMiningLayer) then
	  -- Turn towards the next mining layer
	  if (quarryWidth % 2 == 0) then
		-- An even width quarry, always turn right
		turtleTurn(direction.RIGHT)
	  else
		-- Turn the opposite direction to that which we turned before
		if (startedLayerToRight == true) then
		  turtleTurn(direction.LEFT)
		  startedLayerToRight = false
		else
		  turtleTurn(direction.RIGHT)
		  startedLayerToRight = true
		end
	  end
	end

	local mineRows
	local onNearSideOfQuarry = true
	local diggingAway = true
	for mineRows = 1, quarryWidth do
	  -- If this is not the first row, then get into position to mine the next row
	  if (mineRows > 1) then
		-- Move into position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  if (startedLayerToRight == true) then
			turtleTurn(direction.LEFT)
		  else
			turtleTurn(direction.RIGHT)
		  end
		else
		  if (startedLayerToRight == true) then
			turtleTurn(direction.RIGHT)
		  else
			turtleTurn(direction.LEFT)
		  end
		end

		turtleForward()
		if (isChestBlock(turtle.compareUp) == true) then
		  -- There is a chest block above. Move back and approach
		  -- from the side to ensure that we don't need to return to
		  -- start through the chest itself (potentially losing items)
		  turtleBack()
		  turtleUp()
		  emptyChest(turtle.suck)
		  turtleDown()
		  turtleForward()
		end

		-- Move into final position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  if (startedLayerToRight == true) then
			turtleTurn(direction.LEFT)
		  else
			turtleTurn(direction.RIGHT)
		  end
		else
		  if (startedLayerToRight == true) then
			turtleTurn(direction.RIGHT)
		  else
			turtleTurn(direction.LEFT)
		  end
		end
	  end

	  -- Dig to the other side of the quarry
	  local blocksMined
	  for blocksMined = 0, (quarryWidth - 1) do
		-- Move forward and check for ores
		if(blocksMined > 0) then
		  -- Only move forward if this is not the first space
		  turtleForward()
		end
		
		-- Check upwards to see if there is a noise block above. Don't do this if this is the first
		-- block of the layer
		if ((blocksMined > 0) or (mineRows > 1)) then
		  if (isNoiseBlock(turtle.detectUp, turtle.compareUp) == false) then
			-- Determine if it is a chest before digging it (if this is the first block
			-- of the row then it has already been checked)
			if ((blocksMined > 0) and (isChestBlock(turtle.compareUp) == true)) then
			  -- There is a chest block above. Move back and approach
			  -- from the side to ensure that we don't need to return to
			  -- start through the chest itself (potentially losing items)
			  turtleBack()
			  turtleUp()
			  emptyChest(turtle.suck)
			  turtleDown()
			  turtleForward()
			else
			  turtle.digUp()
			  ensureInventorySpace()
			end
		  end
		end
	  
		-- Check down, if this is the bedrock layer, use an alternate approach.
		-- If this is not the bedrock layer, then just check down
		if (miningLoop == bottomLayer) then
		  -- Just above bedrock layer, dig down until can't dig any lower, and then
		  -- come back up. This replicates how the quarry functions
		  local moveDownSuccess = turtleDown()
		  while (moveDownSuccess == true) do
	  -- Spin around and search for hiddin ore
	  for i=1,4 do
		   if (isNoiseBlock(turtle.detect, turtle.compare) == false) then
	   turtle.dig()
	 end
	 turtle.turnRight()
   end
			moveDownSuccess = turtleDown()
		  end

		  -- Have now hit bedrock, move back to the mining layer
		  writeMessage("Moving back to mining layer", messageLevel.DEBUG)
		  writeMessage("currY: "..currY..", bottomLayer: "..bottomLayer, messageLevel.DEBUG)
		  while (currY < bottomLayer) do
			turtleUp()
		  end
		else
		  -- Check the block down for being a noise block
		  if (isNoiseBlock(turtle.detectDown, turtle.compareDown) == false) then
			-- Is a noise block, check for being a chest before mining it
			if (isChestBlock(turtle.compareDown) == true) then
			  emptyChest(turtle.suckDown)
			else
			  turtle.digDown()
			  ensureInventorySpace()
			end
		  end
		end
	  end

	  -- Am now at the other side of the quarry
	  onNearSideOfQuarry = not onNearSideOfQuarry
	end

	-- If we were digging away from the starting point, will be digging
	-- back towards it on the next layer
	diggingAway = not diggingAway
  end

  -- Return to the start
  returnToStartAndUnload(false)

  -- Face forward
  turtleSetOrientation(direction.FORWARD)
end

-- ********************************************************************************** --
-- Main Function										
-- ********************************************************************************** --
-- Process the input arguments - storing them to global variables
local args = { ... }
local paramsOK = true
turtleId = os.getComputerLabel()
rednet.open("right")
if (#args == 1) then
  quarryWidth = tonumber(args[1])
  local x, y, z = gps.locate(5)
  startHeight = y
  if (startHeight == nil) then
	writeMessage("Can't locate GPS", messageLevel.FATAL)
	paramsOK = false
  end
elseif (#args == 2) then
  quarryWidth = tonumber(args[1])
  startHeight = tonumber(args[2])
else
  writeMessage("Usage: OreQuarry <diameter> <turtleY>", messageLevel.FATAL)
  paramsOK = false
end
if (paramsOK == true) then
  if ((startHeight < 6) or (startHeight > 128)) then
	writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
	paramsOK = false
  end

  if ((quarryWidth < 2) or (quarryWidth > 64)) then
	writeMessage("diameter must be between 2 and 64", messageLevel.FATAL)
	paramsOK = false
  end
end

if (paramsOK == true) then
  writeMessage("---------------------------------", messageLevel.INFO)
  writeMessage("** Ore Quarry v0.3 by AustinKK **", messageLevel.INFO)
  writeMessage("---------------------------------", messageLevel.INFO)

  -- Set the turtle's starting position
  currX = 0
  currY = startHeight
  currZ = 0
  currOrient = direction.FORWARD

  -- Calculate which blocks in the inventory signify noise blocks
  determineNonSeamBlocksCount()

  if ((nonSeamBlocks == 0) or (nonSeamBlocks == 15)) then
	writeMessage("No noise blocks have been been added. Please place blocks that the turtle should not mine (e.g. Stone, Dirt, Gravel etc.) in the first few slots of the turtle\'s inventory. The first empty slot signifies the end of the noise blocks.", messageLevel.FATAL)
  else
	-- Create a Quary
	writeMessage("Begin Mining", messageLevel.INFO)
	createQuarry()
	writeMessage("Mining Complete", messageLevel.INFO)
  end
end
DiamondDave #56
Posted 03 January 2013 - 07:06 PM
DiamondDave,

Out of curiosity, have you tried the above program with the OreQuarry program this topic is about? I am not going to be able to put anything up high since I am working on an ore world that the surface is deadly. I need to stay underground to keep from bursting into flames.

Also, will this be making it to pastebin?
Interesting. Yes, I've used this on the OreQuarry world save to time my mining runs. Not sure how high the logger would have to be in your situation. Just keep in mind the distance of wireless rednet is a factor. The last parameter, p3, printed in the message is the distance the message traveled. Useful for troubleshooting missed messages. Like when messages stop showing up after 63.467 meters you know you went out of range at 64. You may have to play with it to make sure you get coverage all the way down to bedrock. Go as high as you can and see what you get. I haven't made a pastebin account yet. Maybe I will. I'll investigate it more tomorrow.
Zagi #57
Posted 05 January 2013 - 12:12 AM
Awesome program! I used this to make a giant hole for my house :)/>.

PS: You have greaaat taste in music, DAFT PUNK!
Deor #58
Posted 05 January 2013 - 01:07 AM
AustinKK, I've been using this program for a little while now and love it, actually prefer it over a quarry these days even if its a tad slower. Look forward to future versions! Would like to see the ability to resume, or add a startup maybe so that the turtle will return to the start position if the chunk gets unloaded for some reason.

DiamondDave, going to try out your version as i too would prefer a single mineshaft. This would also make recovering lost turtles easier as you can just go down the one shaft to the level the turtle was mining when it stopped.Hope Austin will consider including these changes :)/>
AustinKK #59
Posted 05 January 2013 - 05:39 AM
Hi guys,

The latest version is about a third faster. I'm hoping to release it this weekend. It's finished, I just need to record a video to go with it.

DiamondDave, the reason for the turtle coming out of the ground was so that it could be guaranteed not to lose any ores (the block above is safe to dig through), however I have changed this is the latest version to make it more efficient (so your OCD will be satisfied as it comes back up the mineshaft).

Kadura, to print out the messages, it pretty simple. Here's some code to do it (assuming that the computer has a wireless modem on its right hand side).

Spoilerrednet.open("right")
local sender, message, dist

while true do
sender, message, dist = rednet.receive()
print(message)
end

It's on pastebin at http://pastebin.com/5kz10pjP

I'm sure DiamondDave's one works equally well too
Cozzimoto #60
Posted 05 January 2013 - 07:26 AM
sweet cant wait to see it in action compared to your other methods
Doyle3694 #61
Posted 05 January 2013 - 08:47 AM
Ive got a suggestion, how about having it return into the bottom left corner when refuel or dropoff, so that it wont make holes everywhere? I mean it's still moving to that corner but it does it underground and comes up through a main hole.
Deor #62
Posted 05 January 2013 - 12:06 PM
Looking forward to the new version Austin :)/>
crazygoattoe #63
Posted 06 January 2013 - 04:42 PM
Is there any way to get this into a turtle in SSP without typing it all out?
Deor #64
Posted 06 January 2013 - 09:31 PM
Check that HTTP is enabled in the CC config file and then do

rom/programs/http/pastebin get 3mkeUzby OreQuarry
to get the code from bastebin and save it to the OreQuarry file.
AustinKK #65
Posted 07 January 2013 - 12:13 AM
Hi Dolye3694,

Yep, great idea - that's exactly what I've done.

There's a few changes (including that one), and I'm hoping to upload a new video and release version 0.4 today.
AustinKK #66
Posted 07 January 2013 - 12:16 AM
Hi crazygoattoe,

You need to do what Deor suggested. There's no other way really. The new version (v0.4) which I'm hoping to release today is almost 1,200 lines long, so you really don't want to be trying to type that out!!
simwah #67
Posted 07 January 2013 - 01:05 AM
One thought, have 2 ender chests on the turtle, 1 for fuel, one to drop stuff in when full. Therefore no base station required.
OmagaIII #68
Posted 07 January 2013 - 03:36 AM
Hey guys,

Just created an account for the sole purpose of coming here and thanking you AustinnKK. :D/>

This app of yours is great and very efficient. LOVE IT!

Keep up the good work!

Cheers
Poodmund #69
Posted 07 January 2013 - 04:34 AM
If the program stops during a cycle, to restart it the turtle has to cover all the Z Levels from the start again. How about an option to specify the Z Level of the Base but also a Z Level to start mining from to aid in completing the rest of the 'Quarry' promoting time and fuel usage efficiency?
AustinKK #70
Posted 07 January 2013 - 05:46 AM
Thanks Omagalll,

I'm currently uploading a new video that is for the latest version (0.4) which is 33% quicker than version 0.2. Upload is taking a while though (still 5 hours left to go!!!).

Will post on here when the video is there and version 0.4 is released.
AustinKK #71
Posted 07 January 2013 - 05:48 AM
Does anyone know whether dan200 is going to include the ability for turtles to retain their state when the chunk is unloaded? I would hate to spend time enabling the program to restart if dan200 is going to include it in the standard mod.

I have some ideas for other mining turtle programs that I want to write, so would rather start on them instead…
crazygoattoe #72
Posted 07 January 2013 - 07:36 AM
Ah thanks, got it working, and it is awesome! Can't wait for the update
acters124 #73
Posted 07 January 2013 - 10:08 AM
I love your orequarry program, but if only there is an option to specify the level in which the turtle can go when the chunk unloads and I start it up.
(coincidently my name is austin xD)
Doyle3694 #74
Posted 07 January 2013 - 10:33 AM
Austin, it is planned though you are better of saving the state. It isn't something going to be added to the next version or anythin like that.
AustinKK #75
Posted 07 January 2013 - 10:54 AM
All,

I've had a mare uploading the video for the new version of the Ore Quarry to YouTube. After 5 hours it slowed to a crawl. I've split the upload into two (the first part is more important anyway), and am trying to re-upload the first part overnight (UK time).

Hopefully it will be there in the morning, and I will post it here when it is.
AustinKK #76
Posted 07 January 2013 - 10:57 AM
Hi Doyle3694,

Any tips for avoiding a race condition when saving state? i.e. if you move, and then write the new co-ordinates to a file, if the programs stops between those functions the turtle will be in an invalid state.

GPS will help, but even then I can envisage some race conditions occurring that might impact the overall reliability, and enforcing a requirement for GPS to allow the turtle to restart would be a pain.
simwah #77
Posted 07 January 2013 - 11:45 AM
Ugh, making us wait for the video :)/>
DrCeph #78
Posted 07 January 2013 - 03:59 PM
Hey AustinKK,

If you are worried about too much work for what will be a future feature, you could consider a compromise by implementing an 'escape to top' mechanism.

When you start the program you either give it the current height, or it is calculated using GPS. If you store this information you could make the turtle return (directly upwards) to the stored level should it be reset for whatever reason. Although this will require manual resetting of the turtle and restarting the program from the starting point (I'm assuming doing this will subsequently get the turtle back to the last spot relatively quickly), at least the turtle will have returned to the surface and hence can be recovered in the case of a reset.

EDIT: Should also help solve dealing with any race condition and would also remove the need to write to a file several hundred times ;)/>
Edited on 07 January 2013 - 03:03 PM
Kadura #79
Posted 07 January 2013 - 04:33 PM
AustinKK,

DiamondDave's may work as well (if not better), but at 90+ lines of code, and no pastebin link, was a little tedious to type in… yours is in and running in under 4 minutes. Thanks!

-Kadura
Hawkertech #80
Posted 07 January 2013 - 07:24 PM
can you use the misc. peripherals charging station instead of coal? I tried lava it ignores it.
Kylun #81
Posted 07 January 2013 - 07:25 PM
Hey AustinKK,

If you are worried about too much work for what will be a future feature, you could consider a compromise by implementing an 'escape to top' mechanism.

When you start the program you either give it the current height, or it is calculated using GPS. If you store this information you could make the turtle return (directly upwards) to the stored level should it be reset for whatever reason. Although this will require manual resetting of the turtle and restarting the program from the starting point (I'm assuming doing this will subsequently get the turtle back to the last spot relatively quickly), at least the turtle will have returned to the surface and hence can be recovered in the case of a reset.

EDIT: Should also help solve dealing with any race condition and would also remove the need to write to a file several hundred times ;)/>

not really. Imagine this…
the turtle is actually at 99,100,99
You write to the log that the turtle is moving to 100,100,99… which is what you are ABOUT to move to. . so you write to the log, then boom, your program crashes.
Without looking, where is your turtle. did you succeed in moving, and now infact are you at 99,100,99 or are you still at 100,100,99.

makes it hard to go to the surfce that way.

I'm liking the GPS idea myself but there are major drawbacks to GPS, like its not always available… Apparently if you place it all the way up, at max range, it has a range of 384 blocks, unless raining then its 64 blocks… which especially underground makes it darn near useless.

even thought ok, just make a GPS underground, but the lower you go the shorter your gps range is. Now we only need 64 blocks, but are the 64 blocks available all the time, or even though we are (potentially) underground and not getting wet, are we affected by this?


this is the issue, and there's no easy way to solve it.
AustinKK #82
Posted 07 January 2013 - 08:26 PM
Yeah, the GPS is a pain.

If there is a thunderstorm, then it more than likely wont have enough range. Even if it does work, then you need to worry about maintaining several GPS hosts (and they need to restart when the chunk is unloaded too). Add to that the fact that you can't just mine anywhere without extending your GPS range to cover the new area I just think it's a real pain.

I think DrCeph is suggesting just moving up the number of blocks equal to the height that was passed in to the original program, this way the turtle will definitely get back to the top, but may end up in the air (but at least it's easier to find that way).
AustinKK #83
Posted 07 January 2013 - 08:43 PM
The video upload has failed again <sigh> Going to try and upload it while I'm at work today.

Rather than waiting for the video to get onto YouTube, I've released v0.4 and will update when there is a video available for those who are interested.

The pastebin link is the same: http://pastebin.com/3mkeUzby

Command line to copy it to a turtle is: rom/programs/http/pastebin get 3mkeUzby OreQuarry

This is the code:
Spoiler


-- ********************************************************************************** --
-- **																			  ** --
-- **   Minecraft Mining Turtle Ore Quarry v0.4 by AustinKK						** --
-- **   ---------------------------------------------------						** --
-- **																			  ** --
-- **   For instructions on how to use:											** --
-- **																			  ** --
-- **     http://www.youtube.com/watch?v=DS1H4OY0yyg                               ** --
-- **																			  ** --
-- **																			  ** --
-- **  Change Log:																 ** --
-- **	27th Dec 2012: [v0.2] Initial Draft Release							   ** --
-- **	29th Dec 2012: [v0.3] Minor Performance Improvements					  ** --
-- **	30th Dec 2012: [v0.4] Further Performance Improvements					** --
-- **																			  ** --
-- ********************************************************************************** --

-- Enumeration to store the the different types of message that can be written
messageLevel = { DEBUG=0, INFO=1, WARNING=2, ERROR=3, FATAL=4 }

-- Enumeration to store names for the 6 directions
direction = { FORWARD=0, RIGHT=1, BACK=2, LEFT=3, UP=4, DOWN=5 }

local messageOutputLevel = messageLevel.INFO
local fuelLevelToRefuelAt = 5
local refuelItemsToUseWhenRefuelling = 63
local emergencyFuelToRetain = 0
local maximumGravelStackSupported = 25 -- The number of stacked gravel or sand blocks supported
local noiseBlocksCount
local bottomLayer = 5 -- The y co-ords of the layer immediately above bedrock
local returningToStart = false
local lookForChests = false -- Determines if chests should be located as part of the quarrying
local miningOffset -- The offset to the mining layer. This is set depending on whether chests are being looked for or not
local lastEmptySlot -- The last inventory slot that was empty when the program started (is either 15 if not looking for chests or 14 if we are)
local turtleId
local currentlySelectedSlot = 0 -- The slot that the last noise block was found in
local lastMoveNeededDig = true -- Determines whether the last move needed a dig first
local haveBeenAtZeroZeroOnLayer -- Determines whether the turtle has been at (0, 0) in this mining layer
local orientationAtZeroZero -- The turtle's orientation when it was at (0, 0)
local levelToReturnTo -- The level that the turtle should return to in order to head back to the start to unload

-- Variables to store the current location and orientation of the turtle. x is right, left, y is up, down and
-- z is forward, back with relation to the starting orientation. Y is the actual turtle level, x and z are
-- in relation to the starting point (i.e. the starting point is (0, 0))
local currX
local currY
local currZ
local currOrient

-- Command line parameters
local startHeight -- Represents the height (y co-ord) that the turtle started at
local quarryWidth -- Represents the length of the mines that the turtle will dig

-- ********************************************************************************** --
-- Writes an output message
-- ********************************************************************************** --
function writeMessage(message, msgLevel)
  if (msgLevel >= messageOutputLevel) then
	print(message)
	if (turtleId == nil) then
	  rednet.broadcast(message)
	else
	  -- Broadcast the message (prefixed with the turtle's id)
	  rednet.broadcast("[".. turtleId.."] "..message)
	end
  end
end

-- ********************************************************************************** --
-- Ensures that the turtle has fuel
-- ********************************************************************************** --
function ensureFuel()

  -- Determine whether a refuel is required
  local fuelLevel = turtle.getFuelLevel()
  if (fuelLevel ~= "unlimited") then
	if (fuelLevel < fuelLevelToRefuelAt) then
	  -- Need to refuel
	  turtle.select(16)
	  currentlySelectedSlot = 16
	  local fuelItems = turtle.getItemCount(16)

	  -- Do we need to impact the emergency fuel to continue? (always  
	  -- keep one fuel item in slot 16)
	  if (fuelItems == 0) then
		writeMessage("Completely out of fuel!", messageLevel.FATAL)
	  elseif (fuelItems == 1) then
		writeMessage("Out of Fuel!", messageLevel.ERROR)
		turtle.refuel()
	  elseif (fuelItems <= (emergencyFuelToRetain + 1)) then
		writeMessage("Consuming emergency fuel supply. "..(fuelItems - 2).." emergency fuel items remain", messageLevel.WARNING)
		turtle.refuel(1)
	  else
		-- Refuel the lesser of the refuelItemsToUseWhenRefuelling and the number of items more than
		-- the emergency fuel level
		if (fuelItems - (emergencyFuelToRetain + 1) < refuelItemsToUseWhenRefuelling) then
		  turtle.refuel(fuelItems - (emergencyFuelToRetain + 1))
		else
		  turtle.refuel(refuelItemsToUseWhenRefuelling)
		end
	  end
	end
  end
end		

-- ********************************************************************************** --
-- Checks that the turtle has inventory space by checking for spare slots and returning
-- to the starting point to empty out if it doesn't.
--
-- Takes the position required to move to in order to empty the turtle's inventory
-- should it be full as arguments
-- ********************************************************************************** --
function ensureInventorySpace()

  -- If already returning to start, then don't need to do anything
  if (returningToStart == false) then

	-- If the last inventory slot is full, then need to return to the start and empty
	if (turtle.getItemCount(lastEmptySlot) > 0) then

	  -- Return to the starting point and empty the inventory, then go back to mining
	  returnToStartAndUnload(true)
	end
  end
end

-- ********************************************************************************** --
-- Function that is called when the turtle has returned to the start in order to
-- empty its inventory into the chest and also pick up any fuel that is
-- available
-- ********************************************************************************** --
function emptyInventory()

  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop) -- Don't bother updating selected slot variable as it will set later in this function
	if ((slotLoop <= noiseBlocksCount) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end

	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items
  turtleSetOrientation(direction.LEFT)
  turtle.select(16) -- Don't bother updating selected slot variable as it will set later in this function
  local currFuelItems = turtle.getItemCount(16)
  turtle.suck()
  while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	currFuelItems = turtle.getItemCount(16)
	turtle.suck()
  end

  slotLoop = noiseBlocksCount + 1
  -- Have now picked up all the items that we can. If we have also picked up some
  -- additional fuel in some of the other slots, then drop it again
  while (slotLoop < lastEmptySlot) do
	-- Drop any items found in this slot
	turtle.select(slotLoop) -- Don't bother updating selected slot variable as it will set later in this function
	turtle.drop()
	slotLoop = slotLoop + 1
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)
  currentlySelectedSlot = 1
end

-- ********************************************************************************** --
-- Function to move to the starting point, call a function that is passed in
-- and return to the same location (if required)
-- ********************************************************************************** --
function returnToStartAndUnload(returnBackToMiningPoint)

  writeMessage("returnToStartAndUnload called", messageLevel.DEBUG)
  returningToStart = true

  -- Store the current location and orientation so that it can be returned to
  local storedX = currX
  local storedY = currY
  local storedZ = currZ
  local storedOrient = currOrient

  writeMessage("Return to start, return level: "..levelToReturnTo, messageLevel.DEBUG)

  -- Move down to the correct layer to return via
  if (currY > levelToReturnTo) then
	while (currY > levelToReturnTo) do
	  turtleDown()
	end
  elseif (currY < levelToReturnTo) then
	while (currY < levelToReturnTo) do
	  turtleUp()
	end
  end

  if ((haveBeenAtZeroZeroOnLayer == false) or (orientationAtZeroZero == direction.FORWARD)) then
	-- Move back to the correct X position first
	if (currX > 0) then
	  turtleSetOrientation(direction.LEFT)
	  while (currX > 0) do
		turtleForward()
	  end
	elseif (currX < 0) then
	  -- This should never happen
	  writeMessage("Current x is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Then move back to the correct Z position
	if (currZ > 0) then
	  turtleSetOrientation(direction.BACK)
	  while (currZ > 0) do
		turtleForward()
	  end
	elseif (currZ < 0) then
	  -- This should never happen
	  writeMessage("Current z is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
	end
  else
	-- Move back to the correct Z position first
	if (currZ > 0) then
	  turtleSetOrientation(direction.BACK)
	  while (currZ > 0) do
		turtleForward()
	  end
	elseif (currZ < 0) then
	  -- This should never happen
	  writeMessage("Current z is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
	end

	-- Then move back to the correct X position
	if (currX > 0) then
	  turtleSetOrientation(direction.LEFT)
	  while (currX > 0) do
		turtleForward()
	  end
	elseif (currX < 0) then
	  -- This should never happen
	  writeMessage("Current x is less than 0 in returnToStartAndUnload", messageLevel.ERROR)
	end
  end

  -- Return to the starting layer
  if (currY < startHeight) then
	while (currY < startHeight) do
	  turtleUp()
	end
  elseif (currY > startHeight) then
	-- This should never happen
	writeMessage("Current height is greater than start height in returnToStartAndUnload", messageLevel.ERROR)
  end

  -- Empty the inventory
  local slotLoop = 1

  -- Face the chest
  turtleSetOrientation(direction.BACK)

  -- Loop over each of the slots (except the 16th one which stores fuel)
  while (slotLoop < 16) do
	-- If this is one of the slots that contains a noise block, empty all blocks except
	-- one
	turtle.select(slotLoop) -- Don't bother updating selected slot variable as it will set later in this function
	if ((slotLoop <= noiseBlocksCount) or ((slotLoop == 15) and (lookForChests == true))) then
	  turtle.drop(turtle.getItemCount(slotLoop) - 1)
	else
	  -- Not a noise block, drop all of the items in this slot
	  turtle.drop()
	end

	slotLoop = slotLoop + 1
  end

  -- While we are here, refill the fuel items if there is capacity
  if (turtle.getItemCount(16) < 64) then
	turtleSetOrientation(direction.LEFT)
	turtle.select(16) -- Don't bother updating selected slot variable as it will set later in this function
	local currFuelItems = turtle.getItemCount(16)
	turtle.suck()
	while ((currFuelItems ~= turtle.getItemCount(16)) and (turtle.getItemCount(16) < 64)) do
	  currFuelItems = turtle.getItemCount(16)
	  turtle.suck()
	end

	slotLoop = noiseBlocksCount + 1
	-- Have now picked up all the items that we can. If we have also picked up some
	-- additional fuel in some of the other slots, then drop it again
	while (slotLoop <= lastEmptySlot) do
	  -- Drop any items found in this slot
	  turtle.select(slotLoop) -- Don't bother updating selected slot variable as it will set later in this function
	  turtle.drop()
	  slotLoop = slotLoop + 1
	end
  end

  -- Select the 1st slot because sometimes when leaving the 15th or 16th slots selected it can result
  -- in that slot being immediately filled (resulting in the turtle returning to base again too soon)
  turtle.select(1)
  currentlySelectedSlot = 1

  -- If required, move back to the point that we were mining at before returning to the start
  if (returnBackToMiningPoint == true) then
	-- Return back to the required layer
	while (currY > levelToReturnTo) do
	  turtleDown()
	end

	if ((haveBeenAtZeroZeroOnLayer == false) or (orientationAtZeroZero == direction.FORWARD)) then
	  -- Move back to the correct Z position first
	  writeMessage("Stored Z: "..storedZ..", currZ: "..currZ, messageLevel.DEBUG)
	  if (storedZ > currZ) then
		writeMessage("Orienting forward", messageLevel.DEBUG)
		writeMessage("Moving in z direction", messageLevel.DEBUG)
		turtleSetOrientation(direction.FORWARD)
		while (storedZ > currZ) do
		  turtleForward()
		end
	  elseif (storedZ < currZ) then
		-- This should never happen
		writeMessage("Stored z is less than current z in returnToStartAndUnload", messageLevel.ERROR)
	  end

	  -- Then move back to the correct X position
	  if (storedX > currX) then
		writeMessage("Stored X: "..storedX..", currX: "..currX, messageLevel.DEBUG)
		writeMessage("Orienting right", messageLevel.DEBUG)
		writeMessage("Moving in x direction", messageLevel.DEBUG)
		turtleSetOrientation(direction.RIGHT)
		while (storedX > currX) do
		  turtleForward()
		end
	  elseif (storedX < currX) then
		-- This should never happen
		writeMessage("Stored x is less than current x in returnToStartAndUnload", messageLevel.ERROR)
	  end
	else
	  -- Move back to the correct X position first
	  if (storedX > currX) then
		writeMessage("Stored X: "..storedX..", currX: "..currX, messageLevel.DEBUG)
		writeMessage("Orienting right", messageLevel.DEBUG)
		writeMessage("Moving in x direction", messageLevel.DEBUG)
		turtleSetOrientation(direction.RIGHT)
		while (storedX > currX) do
		  turtleForward()
		end
	  elseif (storedX < currX) then
		-- This should never happen
		writeMessage("Stored x is less than current x in returnToStartAndUnload", messageLevel.ERROR)
	  end

	  -- Then move back to the correct Z position
	  writeMessage("Stored Z: "..storedZ..", currZ: "..currZ, messageLevel.DEBUG)
	  if (storedZ > currZ) then
		writeMessage("Orienting forward", messageLevel.DEBUG)
		writeMessage("Moving in z direction", messageLevel.DEBUG)
		turtleSetOrientation(direction.FORWARD)
		while (storedZ > currZ) do
		  turtleForward()
		end
	  elseif (storedZ < currZ) then
		-- This should never happen
		writeMessage("Stored z is less than current z in returnToStartAndUnload", messageLevel.ERROR)
	  end
	end

	-- Move back to the correct layer
	if (storedY < currY) then
	  while (storedY < currY) do
		turtleDown()
	  end
	elseif (storedY > currY) then
	  while (storedY > currY) do
		turtleUp()
	  end
	end

	-- Finally, set the correct orientation
	turtleSetOrientation(storedOrient)

	writeMessage("Have returned to the mining point", messageLevel.DEBUG)
  end

  returningToStart = false

end

-- ********************************************************************************** --
-- Empties a chest's contents
-- ********************************************************************************** --
function emptyChest(suckFn)

  local prevInventoryCount = {}
  local inventoryLoop
  local chestEmptied = false

  -- Record the number of items in each of the inventory slots
  for inventoryLoop = 1, 16 do
	prevInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
  end

  while (chestEmptied == false) do
	-- Pick up the next item
	suckFn()

	-- Determine the number of items in each of the inventory slots now
	local newInventoryCount = {}
	for inventoryLoop = 1, 16 do
	  newInventoryCount[inventoryLoop] = turtle.getItemCount(inventoryLoop)
	end

	-- Now, determine whether there have been any items taken from the chest
	local foundDifferentItemCount = false
	inventoryLoop = 1
	while ((foundDifferentItemCount == false) and (inventoryLoop <= 16)) do
	  if (prevInventoryCount[inventoryLoop] ~= newInventoryCount[inventoryLoop]) then
		foundDifferentItemCount = true
	  else
		inventoryLoop = inventoryLoop + 1
	  end
	end

	-- If no items have been found with a different item count, then the chest has been emptied
	chestEmptied = not foundDifferentItemCount

	if (chestEmptied == false) then
	  prevInventoryCount = newInventoryCount
	  -- Check that there is sufficient inventory space as may have picked up a block
	  ensureInventorySpace()
	end
  end

  writeMessage("Finished emptying chest", messageLevel.DEBUG)
end


-- ********************************************************************************** --
-- Generic function to move the Turtle (pushing through any gravel or other
-- things such as mobs that might get in the way).
--
-- The only thing that should stop the turtle moving is bedrock. Where this is
-- found, the function will return after 15 seconds returning false
-- ********************************************************************************** --
function moveTurtle(moveFn, detectFn, digFn, attackFn, compareFn, suckFn, maxDigCount)

  ensureFuel()

  -- Flag to determine whether digging has been tried yet. If it has
  -- then pause briefly before digging again to allow sand or gravel to
  -- drop
  local digCount = 0
  local moveSuccess = false

  if (lastMoveNeededDig == false) then
	-- Didn't need to dig last time the turtle moved, so try moving first
	writeMessage("Trying to move before digging", messageLevel.DEBUG)
	moveSuccess = moveFn()

	-- Don't need to set the last move needed dig. It is already false, if
	-- move success is now true, then it won't be changed
  else	
	writeMessage("Trying to dig before moving", messageLevel.DEBUG)
	-- If we are looking for chests, then check that this isn't a chest before trying to dig it
	if (lookForChests == true) then
	  if (isNoiseBlock(compareFn) == false) then
		if (detectFn() == true) then
		  -- Determine if it is a chest before digging it
		  if (isChestBlock(compareFn) == true) then
			-- Have found a chest, empty it before continuing
			emptyChest (suckFn)
		  end
		end
	  end
	end

	-- Try to dig (without doing a detect as it is quicker)
	local digSuccess = digFn()
	if (digSuccess == true) then
	  digCount = 1
	end
	moveSuccess = moveFn()

	if (moveSuccess == true) then
	  lastMoveNeededDig = digSuccess
	end
  end

  -- Loop until we've successfully moved
  if (moveSuccess == false) then
	while ((moveSuccess == false) and (digCount < maxDigCount)) do

	  -- If there is a block in front, dig it
	  if (detectFn() == true) then

		  -- If we've already tried digging, then pause before digging again to let
		  -- any sand or gravel drop, otherwise check for a chest before digging
		  if(digCount == 0) then
			-- Am about to dig a block - check that it is not a chest if necessary
			-- If we are looking for chests, then check that this isn't a chest before moving
			if (lookForChests == true) then
			  if (isNoiseBlock(compareFn) == false) then
				if (detectFn() == true) then
				  -- Determine if it is a chest before digging it
				  if (isChestBlock(compareFn) == true) then
					-- Have found a chest, empty it before continuing
					emptyChest (suckFn)
				  end
				end
			  end
			end
		  else
			sleep(0.1)
		  end

		  digFn()
		  digCount = digCount + 1
	  else
		 -- Am being stopped from moving by a mob, attack it
		 attackFn()
	  end

	  -- Try the move again
	  moveSuccess = moveFn()
	end

	if (digCount == 0) then
	  lastMoveNeededDig = false
	else
	  lastMoveNeededDig = true
	end
  end

  -- Return the move success
  return moveSuccess

end

-- ********************************************************************************** --
-- Move the turtle forward one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleForward()
  local returnVal = moveTurtle(turtle.forward, turtle.detect, turtle.dig, turtle.attack, turtle.compare, turtle.suck, maximumGravelStackSupported)
  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ + 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX - 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ - 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX + 1
	else
	  writeMessage ("Invalid currOrient in turtleForward function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end

  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle up one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleUp()
  local returnVal = moveTurtle(turtle.up, turtle.detectUp, turtle.digUp, turtle.attackUp, turtle.compareUp, turtle.suckUp, maximumGravelStackSupported)
  if (returnVal == true) then
	currY = currY + 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle down one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleDown()
  local returnVal

  -- Because the turtle is digging down, can fail fast (only allow 1 dig attempt).
  returnVal = moveTurtle(turtle.down, turtle.detectDown, turtle.digDown, turtle.attackDown, turtle.compareDown, turtle.suckDown, 1)
  if (returnVal == true) then
	currY = currY - 1

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end
  return returnVal
end

-- ********************************************************************************** --
-- Move the turtle back one block (updating the turtle's position)
-- ********************************************************************************** --
function turtleBack()
  -- First try to move back using the standard function
  local returnVal = turtle.back()

  -- Moving back didn't work (might be a block or a mob in the way). Turn round and move
  -- forward instead (whereby anything in the way can be cleared)
  if(returnVal == false) then
	turtle.turnRight()
	turtle.turnRight()
	returnVal = turtleForward()
	turtle.turnRight()
	turtle.turnRight()
  end  

  if (returnVal == true) then
	-- Update the current co-ordinates
	if (currOrient == direction.FORWARD) then
	  currZ = currZ - 1
	elseif (currOrient == direction.LEFT) then
	  currX = currX + 1
	elseif (currOrient == direction.BACK) then
	  currZ = currZ + 1
	elseif (currOrient == direction.RIGHT) then
	  currX = currX - 1
	else
	  writeMessage ("Invalid currOrient in turtleBack function", messageLevel.ERROR)
	end

	-- Check that there is sufficient inventory space as may have picked up a block
	ensureInventorySpace()
  end

  return returnVal
end

-- ********************************************************************************** --
-- Turns the turtle (updating the current orientation at the same time)
-- ********************************************************************************** --
function turtleTurn(turnDir)

  if (turnDir == direction.LEFT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.LEFT
	  turtle.turnLeft()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.BACK
	  turtle.turnLeft()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.RIGHT
	  turtle.turnLeft()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.FORWARD
	  turtle.turnLeft()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  elseif (turnDir == direction.RIGHT) then
	if (currOrient == direction.FORWARD) then
	  currOrient = direction.RIGHT
	  turtle.turnRight()
	elseif (currOrient == direction.LEFT) then
	  currOrient = direction.FORWARD
	  turtle.turnRight()
	elseif (currOrient == direction.BACK) then
	  currOrient = direction.LEFT
	  turtle.turnRight()
	elseif (currOrient == direction.RIGHT) then
	  currOrient = direction.BACK
	  turtle.turnRight()
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  else
	writeMessage ("Invalid turnDir in turtleTurn function", messageLevel.ERROR)
  end
end

-- ********************************************************************************** --
-- Sets the turtle to a specific orientation, irrespective of its current orientation
-- ********************************************************************************** --
function turtleSetOrientation(newOrient)

  if (currOrient ~= newOrient) then
	if (currOrient == direction.FORWARD) then
	  if (newOrient == direction.RIGHT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.RIGHT) then
	  if (newOrient == direction.BACK) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.LEFT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.BACK) then
	  if (newOrient == direction.LEFT) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.FORWARD) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	elseif (currOrient == direction.LEFT) then
	  if (newOrient == direction.FORWARD) then
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.RIGHT) then
		turtle.turnRight()
		turtle.turnRight()
		currOrient = newOrient
	  elseif (newOrient == direction.BACK) then
		turtle.turnLeft()
		currOrient = newOrient
	  else
		writeMessage ("Invalid newOrient in turtleSetOrientation function", messageLevel.ERROR)
	  end
	else
	  writeMessage ("Invalid currOrient in turtleTurn function", messageLevel.ERROR)
	end
  end
end

-- ********************************************************************************** --
-- Determines if a particular block is considered a noise block or not. A noise
-- block is one that is a standard block in the game (stone, dirt, gravel etc.) and
-- is one to ignore as not being an ore. Function works by comparing the block
-- in question against a set of blocks in the turtle's inventory which are known not to
-- be noise blocks. Param is the function to use to compare the block for a noise block
-- ********************************************************************************** --
function isNoiseBlock(compareFn)

  -- Consider air to be a noise block
  local returnVal = false
  local seamLoop = 1
  local prevSelectedSlot  

  -- If the currently selected slot is a noise block, then compare against this first
  -- so that the slot doesn't need to be selected again (there is a 0.05s cost to do
  -- this even if it is the currently selected slot)
  if (currentlySelectedSlot <= noiseBlocksCount) then
	returnVal = compareFn()
  end

  if (returnVal == false) then
	prevSelectedSlot = currentlySelectedSlot
	while((returnVal == false) and (seamLoop <= noiseBlocksCount)) do
	  if (seamLoop ~= prevSelectedSlot) then
		turtle.select(seamLoop)
		currentlySelectedSlot = seamLoop
		returnVal = compareFn()
	  end
	  seamLoop = seamLoop + 1
	end
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Determines if a particular block is a chest. Returns false if it is not a chest
-- or chests are not being detected
-- ********************************************************************************** --
function isChestBlock(compareFn)

  -- Check the block in the appropriate direction to see whether it is a chest. Only
  -- do this if we are looking for chests
  local returnVal = false
  if (lookForChests == true) then
	turtle.select(15)
	currentlySelectedSlot = 15
	returnVal = compareFn()
  end

  -- Return the calculated value
  return returnVal

end

-- ********************************************************************************** --
-- Function to calculate the number of non seam blocks in the turtle's inventory. This
-- is all of the blocks at the start of the inventory (before the first empty slot is
-- found
-- ********************************************************************************** --
function determineNoiseBlocksCountCount()
  -- Determine the location of the first empty inventory slot. All items before this represent
  -- noise items.
  local foundFirstBlankInventorySlot = false
  noiseBlocksCount = 1
  while ((noiseBlocksCount < 16) and (foundFirstBlankInventorySlot == false)) do
	if (turtle.getItemCount(noiseBlocksCount) > 0) then
	  noiseBlocksCount = noiseBlocksCount + 1
	else
	  foundFirstBlankInventorySlot = true
	end
  end
  noiseBlocksCount = noiseBlocksCount - 1

  -- Determine whether a chest was provided, and hence whether we should support
  -- looking for chests
  if (turtle.getItemCount(15) > 0) then
	lookForChests = true
	lastEmptySlot = 14
	miningOffset = 0
	writeMessage("Looking for chests...", messageLevel.DEBUG)
  else
	lastEmptySlot = 15
	miningOffset = 1
	writeMessage("Ignoring chests...", messageLevel.DEBUG)
  end
end

-- ********************************************************************************** --
-- Creates a quarry mining out only ores and leaving behind any noise blocks
-- ********************************************************************************** --
function createQuarry()

  -- Determine the top mining layer layer. The turtle mines in layers of 3, and the bottom layer
  -- is the layer directly above bedrock.
  --
  -- The actual layer that the turtle operates in is the middle of these three layers,
  -- so determine the top layer
  local topMiningLayer = startHeight + ((bottomLayer - startHeight - 2) % 3) - 1 + miningOffset

  -- If the top layer is up, then ignore it and move to the next layer
  if (topMiningLayer > currY) then
	topMiningLayer = topMiningLayer - 3
  end

  local startedLayerToRight = true -- Only used where the quarry is of an odd width

  -- Loop over each mining row
  local miningLevel
  for miningLevel = (bottomLayer + miningOffset), topMiningLayer, 3 do
	writeMessage("Mining Layer: "..miningLevel, messageLevel.INFO)
	haveBeenAtZeroZeroOnLayer = false

	-- While the initial shaft is being dug out, set the level to return to in order to unload
	-- to the just take the turtle straight back up
	if (miningLevel == (bottomLayer + miningOffset)) then
	  levelToReturnTo = startHeight
	end

	-- Move to the correct level to start mining
	if (currY > miningLevel) then
	  while (currY > miningLevel) do
		turtleDown()
	  end
	elseif (currY < miningLevel) then
	  while (currY < miningLevel) do
		turtleUp()
	  end
	end

	-- Set the layer to return via when returning to the surface as the one below the currently
	-- mined one
	if (miningLevel == (bottomLayer + miningOffset)) then
	  levelToReturnTo = (bottomLayer + miningOffset)
	else
	  levelToReturnTo = miningLevel - 3
	end

	-- Move turtle into the correct orientation to start mining (if this is the
	-- first row to be mined, then don't need to turn, otherwise turn towards the next
	-- mining section)

	writeMessage("Mining Level: "..miningLevel..", Bottom Layer: "..bottomLayer..", Mining Offset: "..miningOffset, messageLevel.DEBUG)

	if (miningLevel > (bottomLayer + miningOffset)) then
	  writeMessage ("Turning at start of layer", messageLevel.DEBUG)
	  -- Turn towards the next mining layer
	  if (quarryWidth % 2 == 0) then
		-- An even width quarry, always turn right
		turtleTurn(direction.RIGHT)
	  else
		-- Turn the opposite direction to that which we turned before
		if (startedLayerToRight == true) then
		  turtleTurn(direction.LEFT)
		  startedLayerToRight = false
		else
		  turtleTurn(direction.RIGHT)
		  startedLayerToRight = true
		end
	  end
	end

	local mineRows
	local onNearSideOfQuarry = true
	local diggingAway = true
	for mineRows = 1, quarryWidth do

	  -- If this is not the first row, then get into position to mine the next row
	  if ((mineRows == 1) and (lookForChests == false)) then
		-- Not looking for chests, check the block below for being an ore. Only do this
		-- if we're not looking for chests since the program doesn't support chests in
		-- bedrock
		if (isNoiseBlock(turtle.compareDown) == false) then
		  turtle.digDown()
		  ensureInventorySpace()
		end
	  elseif (mineRows > 1) then
		-- Move into position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  if (startedLayerToRight == true) then
			turtleTurn(direction.LEFT)
		  else
			turtleTurn(direction.RIGHT)
		  end
		else
		  if (startedLayerToRight == true) then
			turtleTurn(direction.RIGHT)
		  else
			turtleTurn(direction.LEFT)
		  end
		end

		turtleForward()

		-- Before making the final turn, check the block below. Do this
		-- now because if it is a chest, then we want to back up and
		-- approach it from the side (so that we don't lose items if we
		-- have to return to the start through it).
		--
		-- This is the point at which it is safe to back up without moving
		-- out of the quarry area (unless at bedrock in which case don't bother
		-- as we'll be digging down anyway)
		if (miningLevel ~= bottomLayer) then
		  if (isNoiseBlock(turtle.compareDown) == false) then
			-- If we are not looking for chests, then just dig it (it takes
			-- less time to try to dig and fail as it does to do detect and
			-- only dig if there is a block there)
			if (lookForChests == false) then
			  turtle.digDown()
			  ensureInventorySpace()
			elseif (turtle.detectDown() == true) then
			  if (isChestBlock(turtle.compareDown) == true) then
				-- There is a chest block below. Move back and approach
				-- from the side to ensure that we don't need to return to
				-- start through the chest itself (potentially losing items)
				turtleBack()
				turtleDown()
				emptyChest(turtle.suck)
				turtleUp()
				turtleForward()
				turtle.digDown()
				ensureInventorySpace()
			  else
				turtle.digDown()
				ensureInventorySpace()
			  end
			end
		  end
		end

		-- Move into final position for mining the next row
		if (onNearSideOfQuarry == diggingAway) then
		  if (startedLayerToRight == true) then
			turtleTurn(direction.LEFT)
		  else
			turtleTurn(direction.RIGHT)
		  end
		else
		  if (startedLayerToRight == true) then
			turtleTurn(direction.RIGHT)
		  else
			turtleTurn(direction.LEFT)
		  end
		end
	  end

	  -- Dig to the other side of the quarry
	  local blocksMined
	  for blocksMined = 0, (quarryWidth - 1) do
		if (blocksMined > 0) then
		  -- Only move forward if this is not the first space
		  turtleForward()
		end

		-- If the current block is (0,0), then record the fact that the
		-- turtle has been through this block and what it's orientation was and update the layer
		-- that it should return via to get back to the surface (it no longer needs to go down
		-- a level to prevent losing ores).
		if ((currX == 0) and (currZ == 0)) then
		  -- Am at (0, 0). Remember this, and what direction I was facing so that the quickest route
		  -- to the surface can be taken
		  levelToReturnTo = miningLevel
		  haveBeenAtZeroZeroOnLayer = true
		  orientationAtZeroZero = currOrient
		end

		-- If currently at bedrock, just move down until the turtle can't go any
		-- further. This allows the blocks within the bedrock to be mined
		if (miningLevel == bottomLayer) then
		  -- Temporarily turn off looking for chests to increase bedrock mining speed (this
		  -- means that the program doesn't support chests below level 5 - but I think
		  -- they they don't exist anyway)
		  local lookForChestsPrev = lookForChests
		  lookForChests = false

		  -- Manually set the flag to determine whether the turtle should try to move first or
		  -- dig first. At bedrock, is very rarely any space

		  -- Just above bedrock layer, dig down until can't dig any lower, and then
		  -- come back up. This replicates how the quarry functions
		  lastMoveNeededDig = true
		  local moveDownSuccess = turtleDown()
		  while (moveDownSuccess == true) do
			moveDownSuccess = turtleDown()
		  end

		  -- Know that we are moving back up through air, therefore set the flag to force the
		  -- turtle to try moving first
		  lastMoveNeededDig = false

		  -- Have now hit bedrock, move back to the mining layer
		  writeMessage("Moving back to mining layer", messageLevel.DEBUG)
		  writeMessage("currY: "..currY..", bottomLayer: "..bottomLayer, messageLevel.DEBUG)
		  while (currY < bottomLayer) do
			turtleUp()
		  end

		  -- Now back at the level above bedrock, again reset the flag to tell the turtle to
		  -- try digging again (because it is rare to find air at bedrock level)
		  lastMoveNeededDig = false

		  -- Reset the look for chests value
		  lookForChests = lookForChestsPrev
		elseif ((blocksMined > 0) and ((currX ~= 0) or (currZ ~= 0))) then
		  -- This isn't the first block of the row, nor are we at (0, 0) so we need to check the
		  -- block below

		  -- Check the block down for being a noise block (don't need to check the first
		  -- block as it has already been checked in the outer loop)
		  if (isNoiseBlock(turtle.compareDown) == false) then
			-- If we are not looking for chests, then just dig it (it takes
			-- less time to try to dig and fail as it does to do detect and
			-- only dig if there is a block there)
			if (lookForChests == false) then
			  turtle.digDown()
			  ensureInventorySpace()
			elseif (turtle.detectDown() == true) then
			  if (isChestBlock(turtle.compareDown) == true) then
				-- There is a chest block below. Move back and approach
				-- from the side to ensure that we don't need to return to
				-- start through the chest itself (potentially losing items)
				turtleBack()
				turtleDown()
				emptyChest(turtle.suck)
				turtleUp()
				turtleForward()
				turtle.digDown()
				ensureInventorySpace()
			  else
				turtle.digDown()
				ensureInventorySpace()
			  end
			end
		  end
		end

		-- Check the block above for ores (if we're not a (0, 0) in which case
		-- we know it's air)
		if ((currX ~= 0) or (currZ ~= 0)) then
		  if (isNoiseBlock(turtle.compareUp) == false) then
			-- If we are not looking for chests, then just dig it (it takes
			-- less time to try to dig and fail as it does to do detect and
			-- only dig if there is a block there)
			if (lookForChests == false) then
			  turtle.digUp()
			  ensureInventorySpace()
			elseif (turtle.detectUp() == true) then
			  -- Determine if it is a chest before digging it
			  if (isChestBlock(turtle.compareUp) == true) then
				-- There is a chest block above. Empty it before digging it
				emptyChest(turtle.suckUp)
				turtle.digUp()
				ensureInventorySpace()
			  else
				turtle.digUp()
				ensureInventorySpace()
			  end
			end
		  end
		end
	  end

	  -- Am now at the other side of the quarry
	  onNearSideOfQuarry = not onNearSideOfQuarry
	end

	-- If we were digging away from the starting point, will be digging
	-- back towards it on the next layer
	diggingAway = not diggingAway
  end

  -- Return to the start
  returnToStartAndUnload(false)

  -- Face forward
  turtleSetOrientation(direction.FORWARD)
end

-- ********************************************************************************** --
-- Main Function										  
-- ********************************************************************************** --
-- Process the input arguments - storing them to global variables
local args = { ... }
local paramsOK = true

turtleId = os.getComputerLabel()
rednet.open("right")

if (#args == 1) then
  quarryWidth = tonumber(args[1])
  local x, y, z = gps.locate(5)
  startHeight = y
  if (startHeight == nil) then
	writeMessage("Can't locate GPS", messageLevel.FATAL)
	paramsOK = false
  end
elseif (#args == 2) then
  quarryWidth = tonumber(args[1])
  startHeight = tonumber(args[2])
else
  writeMessage("Usage: OreQuarry <diameter> <turtleY>", messageLevel.FATAL)
  paramsOK = false
end

if (paramsOK == true) then
  if ((startHeight < 6) or (startHeight > 128)) then
	writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
	paramsOK = false
  end

  if ((quarryWidth < 2) or (quarryWidth > 64)) then
	writeMessage("diameter must be between 2 and 64", messageLevel.FATAL)
	paramsOK = false
  end
end

if (paramsOK == true) then
  writeMessage("---------------------------------", messageLevel.INFO)
  writeMessage("** Ore Quarry v0.4 by AustinKK **", messageLevel.INFO)
  writeMessage("---------------------------------", messageLevel.INFO)

  -- Set the turtle's starting position
  currX = 0
  currY = startHeight
  currZ = 0
  currOrient = direction.FORWARD

  -- Calculate which blocks in the inventory signify noise blocks
  determineNoiseBlocksCountCount()

  if ((noiseBlocksCount == 0) or (noiseBlocksCount == 15)) then
	writeMessage("No noise blocks have been been added. Please place blocks that the turtle should not mine (e.g. Stone, Dirt, Gravel etc.) in the first few slots of the turtle\'s inventory. The first empty slot signifies the end of the noise blocks.", messageLevel.FATAL)
  else
	-- Create a Quary
	turtle.select(1)
	currentlySelectedSlot = 1
	createQuarry()
  end
end

Major changes are as follows:

- Turtle now mines bottom up rather than top down (so first thing it does is dig all the way to bedrock and then works its way back up)
- Turtle now always returns up the original mineshaft rather than digging up in any one area
- Heavily performance optimised (an increase in performance of just under 33% since v0.2)
- Turtle uses all but one of it's fuel when it first starts (so make sure you label your turtle before you run the program)

One important thing that is contained in the video is that when you are specifying noise blocks (i.e. the blocks that you put in the first few slots) it is better to only use two - stone in the first slot and dirt in the second. You can still put gravel and sand in, but it is more performant if you don't.

Briefly the reason for this is that because the mining turtle mines horizontally in layers of three, it typically ends up digging out all the gravel or sand anyway. For any one stack of gravel or sand, the maximum that can be left undug is the very bottom block (and even then that is only if it happens to be one row below one of the mining levels). The benefit that is gained from trying to ignore sand or gravel is outweighed by the gain of not checking for it all the time and the increase in inventory space.

This is true even when there is a lot of sand or gravel around (I did some performance tests in the dessert and it is definitely quicker to just specify stone and dirt as the noise blocks).

So the standard configuration for the inventory is:
[Slot 1] Stone block
[Slot 2] Dirt block
[Slots 3 - 14] Empty
[Slot 15] Chest
[Slot 16] Stack of fuel

If you try version 0.4, let me know what you think.
Kylun #84
Posted 07 January 2013 - 08:47 PM
I think DrCeph is suggesting just moving up the number of blocks equal to the height that was passed in to the original program, this way the turtle will definitely get back to the top, but may end up in the air (but at least it's easier to find that way).

in the case of my world, if you did that you'd not really help much, atleast i'd know what level to search on, but thats about it…

I put my mines on level 16, and there's just 1 block opening from where they start. i'd have to dig the entire floor out to find it.

An idea i did just have however….
yes, GPS is a pain…

but, here's a worst-case… go to the topmost floor, like you mentioned… then engage gps locator beacon mode… this mode would:
a) listen for GPS signals
B)/> broadcast your location once found, over rednet.

so here's my thinking, and again, this is like, worst case until something better could be thought up… but when you lose your turtle, you know what level to search for it on, and all you have to do is setup a GPS unit on that floor and see if you get a ping back. I think you can do it with only 2 wireless computers, because you dont need Y, just X and Z.

could help atleast?
AustinKK #85
Posted 07 January 2013 - 09:05 PM
Kylun,

I really like that idea. Have a startup script that just keeps trying to get its location from GPS, and if it finds it - send it via redstone.

That way you don't need to maintain a GPS network at all, you would only need to create one temporarily if you have lost your turtles. Also if it is raining, you could accept the fact that you are going to struggle to find the turtle, and go and do something else, returning to look for it once the weather is better.

I wouldn't even bother moving the turtle. Just leave it where it is and get it to broadcast its location.

All I would have to do (now that the turtle mines from the bottom up) is add the ability for you to specify the bottom level that it will mine at (so if for instance you found it at level 30, you could restart so that it doesn't go below that level).

Very nice idea. Like it a lot. It will work for all programs that may not mine in such a uniform way as well.
Kylun #86
Posted 07 January 2013 - 09:38 PM
Technically, you could even write a "rescue turtle". it would know its starting coords, deploy a series of wireless turtles (they are easier than computers with wireless modems). see if it receives the beacon, then literally allow the turtle to just restart in place, because afterall once the turtle has a fix on its own position, nothing's stopping it from resuming right then and there…

hmm….

even simpler yet..
rescue turtle could not even bother deploying the gps until it receives a signal from the lost turtle…
Kylun #87
Posted 07 January 2013 - 09:40 PM
I did think of one thing, but it gets to a point of "come on, really?".. what if you save/quit while the rescue turtle is rescuing… then you really are stuck… unless you rescue the rescuer so it can rescue the stranded turtle.
AustinKK #88
Posted 07 January 2013 - 10:04 PM
Kylun,

Explain your rescue turtle again. So as I understand what you are saying, you would create a Rescue Turtle with a number of wireless mining turtle's in its inventory (presumably they would need to have a label and contain fuel) and give the Rescue Turtle its co-ordinates.

It could then deploy the other turtles who would go out and ping their co-ordinates as they go (which they would know because they know the Rescue Turtle's starting position and they know where they have moved from there) and once they get a response from the Mining Turtle that is lost, they return to their starting point. Meanwhile, the previously lost turtle can now resume.

Is that what you mean?
Deor #89
Posted 07 January 2013 - 10:10 PM
Great stuff Austin, will be testing is shortly and will report back!

Im using the Feed the Beast Mindcrack mod pack so have Misc Peripherals and ive been using the chunk loader addon for my mining turtles which is very useful :)/>


AustinKK,

DiamondDave's may work as well (if not better), but at 90+ lines of code, and no pastebin link, was a little tedious to type in… yours is in and running in under 4 minutes. Thanks!

-Kadura

Kadura, nothing to stop you dropping the code into Pastebin yourself…
DrCeph #90
Posted 07 January 2013 - 10:38 PM
I think DrCeph is suggesting just moving up the number of blocks equal to the height that was passed in to the original program, this way the turtle will definitely get back to the top, but may end up in the air (but at least it's easier to find that way).

Yup that is what I mean, although I suppose a turtle that crashes one or two layers down would shoot right up into the sky. Perhaps a better yet still relatively simple alternative would be to record the current level and recover by moving up that amount if restarted. Still way less logging, and that way even if it crashes between writing and moving down (depending the order you do those), it will either end at:

a ) ground level (one below start level))
b ) on the ground (same level as start) or
c ) one block above the ground (one above start level)

The only thing you don't know then is exactly where in the mining square it will be - but you will be able to eyeball it (assuming mining on a flat surface), and you know the bounds of the mining square as you set it yourself in the first place.
AustinKK #91
Posted 08 January 2013 - 12:06 AM
OK, so the videos are now on YouTube. I had to split the video into two parts to help get them uploaded. You can watch them here:

Part 1:
http://www.youtube.com/watch?v=PIugLVzUz3g

Part 2:
http://www.youtube.com/watch?v=zIkktCTCOB4

This is version 0.4 of the OreQuarry program

The pastebin link is the same: http://pastebin.com/3mkeUzby

Command line to download the program onto a mining turtle is:
rom/programs/http/pastebin get 3mkeUzby OreQuarry
DrCeph #92
Posted 08 January 2013 - 12:27 AM
Hey, just a thought, if you just set off another mining turtle would it just mine the original turtle?
AustinKK #93
Posted 08 January 2013 - 12:57 AM
Hi DrCeph,

Yes it would. Not a bad idea. The only problem would be if the original turtle had a full inventory then you would lose some items. But yes, good shout…
dybukk #94
Posted 08 January 2013 - 01:46 AM
Really nice program. Enjoyed the youtube videos as well :)/>

I quite like the idea of it dumping down a startup script when the script starts (remove it when its finished). The startup script could then try to get a GPS… if it succeeds it just resumes if not it will tunnel straight up to its starting layer (plus or minus 1 layer to deal with any inconsistencies) and waits for someone to take it back to the chest where it can be resumed. There is nothing worse then going down after your turtle to find a massive lava lake down there.

Also maybe adding an option so that it won't mine higher than a certain user defined level, rather than having to start it at a lower level. This would mean you can always start on the surface which would make finding it easier if there is an interruption and its come to the surface.
Kylun #95
Posted 08 January 2013 - 03:43 AM
Kylun,

Explain your rescue turtle again. So as I understand what you are saying, you would create a Rescue Turtle with a number of wireless mining turtle's in its inventory (presumably they would need to have a label and contain fuel) and give the Rescue Turtle its co-ordinates.

It could then deploy the other turtles who would go out and ping their co-ordinates as they go (which they would know because they know the Rescue Turtle's starting position and they know where they have moved from there) and once they get a response from the Mining Turtle that is lost, they return to their starting point. Meanwhile, the previously lost turtle can now resume.

Is that what you mean?

Yes, so, you have a rescue turtle with several turtles inside it. They probably don't even need fuel because they won't be moving. According to my copy of FTB Mindcrack, lowest altitude thunderstorm (i.e. worst case) is 16 blocks. The rescue turtle could travel to each floor constantly listening/pinging the stranded turtle. Once the turtle is found, it could deploy GPS, allowing the stranded turtle to get a fix.

Once the stranded turtle has a fix, it can either go back to the surface and unload, or continue mining. Since it has its coords it would be possible to continue where it left of.

it seems a little over involved…, but losing a turtle hurts. especially when its full of ores.
AustinKK #96
Posted 08 January 2013 - 04:12 AM
Hmmm, perhaps a bit over involved :unsure:/>

I think I prefer the idea of a startup script that pings it's co-ordinates via rednet once it knows what they are. That means that if you lose the turtle, then you can set up a GPS network and it will tell you where it is.

You then have to go and find it yourself, but at least you know where it is.

I like this approach particularly because I'm looking at other programs that don't have such a simple approach (and therefore resuming might not be quite as easy). Because I'm lazy I would like to have just one program for turtle recovery…
Kylun #97
Posted 08 January 2013 - 04:37 AM
Agreed. However, again, once the device HAS its GPS coordinates, it can either resume in-place or return to the base station.. This also has a nice caveat that if your GPS network is well, and its not raining, the darn thing will just auto-resume.

I WOULD however request 1 or two features. I'd like a method to (over rednet) recall the device. alternately or inclusively, I'm using UNOBTANIUM's fir wood chopper, and he has a rather simple yet effective way to disable the device whenever you want. when it docks, he checks for a redstone signal. if present, stop execution. This would make it pretty easy to purposefully quit the game. turn off the turtle, wait for it to dock, then you can log out.
AustinKK #98
Posted 08 January 2013 - 05:49 AM
Hi Kylun,

Yes I like that idea.

I'm going to quickly write another turtle program that i've been wanting to do for a while, and will then look to add a feature like the one you mention.
Hawkertech #99
Posted 08 January 2013 - 06:56 AM
The turtle appears to have missed the sixth diamond under the bed rock.
PaidLeber #100
Posted 08 January 2013 - 08:24 AM
Hi Kylun,

Yes I like that idea.

I'm going to quickly write another turtle program that i've been wanting to do for a while, and will then look to add a feature like the one you mention.
If you don't mind me asking, what is your next turtle project?

Your turtle mining program works great. Thanks. It inspired me to write a program to get the turtle from a base station to a target area using lyqyd's rednet api http://www.computercraft.info/forums2/index.php?/topic/1708-lyqydnet-rednet-api/, then use OreQuarry to mine the area.
Amoa123 #101
Posted 08 January 2013 - 09:08 AM
Hey, just wanted to say I love this program. I really liked the older version and use it all the time. With the new version WOW, just wow!

The turtle appears to have missed the sixth diamond under the bed rock.

That is because the turtle works the same way as a quarry (the quarry also misses the same diamond). When at bedrock level it will just keep digging down until it hits some bedrock, then it moves back up and goes across to the next block, then does the same. That means that it will never see that last diamond as it has 2 bedrock on top. The same for the quarry it mines as low as it can until it hits bedrock, so it also misses that last diamond in his test.
dybukk #102
Posted 08 January 2013 - 11:15 AM
I made the following change:



*** OreQuarry_orig 2013-01-07 22:04:54.000000000 +0000
--- OreQuarry 2013-01-07 20:52:48.000000000 +0000
***************
*** 53,54 ****
--- 53,62 ----

+  
+ --Saves current progress to file
+ function save()
+  local file = io.open('OreQuarry_Depth', 'w');
+	 file:write((startHeight-currY));
+	 file:close();
+ end;
+  
  -- ********************************************************************************** --
***************
*** 580,582 ****
	  currY = currY + 1
!  
	  -- Check that there is sufficient inventory space as may have picked up a block
--- 588,590 ----
	  currY = currY + 1
!	 save()
	  -- Check that there is sufficient inventory space as may have picked up a block
***************
*** 597,599 ****
	  currY = currY - 1
!  
	  -- Check that there is sufficient inventory space as may have picked up a block
--- 605,607 ----
	  currY = currY - 1
!	 save()
	  -- Check that there is sufficient inventory space as may have picked up a block

Which allowed the following startup script to recover the turtle to the surface if the chunk gets unloaded (Well plus or minus 1 block).


local turtleDepth = 0

function up()
	while not turtle.up() do
		if turtle.getFuelLevel() == 0 then
			turtle.select(16)
			turtle.refuel(1)
			if turtle.getFuelLevel() == 0 then
				os.exit()
			end
		end
		turtle.digUp()
	end
end

--Saves current progress to file
function save()
	local file = io.open('OreQuarry_Depth', 'w')
	file:write(""..turtleDepth)
	file:close()
end


local file = fs.open('OreQuarry_Depth', 'r')
if (file ~= nil) then
	turtleDepth = file:readAll()
	print ('Recovering from turtleDepth ' .. turtleDepth)
	for i=1, turtleDepth do
		up()
		turtleDepth=turtleDepth-1
		save()
	end
	file:close()
	shell.run('delete', 'OreQuarry_Depth');
end

Yes I know. My lua sucks :)/>

Again really nice program :)/>
Xetian #103
Posted 08 January 2013 - 04:52 PM
Could you add the option to ignore diamond ore with a command prompt? Mining them with fortune is just too good, so I've been using a silk touched ore to stop the little guy from eating all of it
sjkeegs #104
Posted 08 January 2013 - 06:33 PM
Could you add the option to ignore diamond ore with a command prompt? Mining them with fortune is just too good, so I've been using a silk touched ore to stop the little guy from eating all of it

You should be able to do that now, Just add a diamond Ore block as a noise block, and the miner turtle should treat it like any other noise block that you put in there (stone, dirt, gravel…)
Xetian #105
Posted 09 January 2013 - 03:31 AM
You should be able to do that now, Just add a diamond Ore block as a noise block, and the miner turtle should treat it like any other noise block that you put in there (stone, dirt, gravel…)

I did so, but it took us about 120 levels to get a silk touch pick and another 60 to get fortune.
bruteman #106
Posted 09 January 2013 - 07:59 AM
I am not sure why i have followed everything step for step but when i start it off with a chest in slot 15 64 coal in 16 and noise blocks in 1 and 2 it heads off does its thing but on its first return it drops off the chest into the storage system yet in your video the chest remained in the 15th slot… is this right?
Kadura #107
Posted 09 January 2013 - 09:56 AM
I have the same issue. Hiccup in programming, or intentional?
OmagaIII #108
Posted 09 January 2013 - 10:16 AM
In the updated version the turtle definitely drops the chest inside the storage unit as opposed to using it as a filter for loot chest underground. Also, I am not quite sure, but is the noise blocks supposed to be 'discarded' by the turtle or not? It seems that whether I use it or not, I still end up with huge amounts of cobble and dirt.

If this is the case, couldn't you consider adding a step or 2 in which it discards any of the noise blocks before making a trip to the chest as to firstly free up space and secondly avoid dropping unnecessary blocks in the chest. That, or should we add our own processes to discard unwanted blocks?

Still a winning program though :D/>
AustinKK #109
Posted 09 January 2013 - 12:30 PM
The turtle appears to have missed the sixth diamond under the bed rock.

Yes, I know. That's the point. The turtle is designed to dig out exactly the same ores as a Quarry. Hunting for diamonds in bedrock is quite time consuming, so I accept that it will miss the 6th one in the same way that a Quarry does.
AustinKK #110
Posted 09 January 2013 - 12:32 PM
Hi Kylun,

Yes I like that idea.

I'm going to quickly write another turtle program that i've been wanting to do for a while, and will then look to add a feature like the one you mention.
If you don't mind me asking, what is your next turtle project?

Your turtle mining program works great. Thanks. It inspired me to write a program to get the turtle from a base station to a target area using lyqyd's rednet api http://www.computerc...net-rednet-api/, then use OreQuarry to mine the area.

I'm not 100% sure yet, I've got a couple of ideas for automating normal minecraft tasks, but they might not work, so need to try them out first because I'll just pretend they never existed if they don't work ;-)
AustinKK #111
Posted 09 January 2013 - 12:35 PM
I made the following change:



*** OreQuarry_orig 2013-01-07 22:04:54.000000000 +0000
--- OreQuarry 2013-01-07 20:52:48.000000000 +0000
***************
*** 53,54 ****
--- 53,62 ----

+  
+ --Saves current progress to file
+ function save()
+  local file = io.open('OreQuarry_Depth', 'w');
+	 file:write((startHeight-currY));
+	 file:close();
+ end;
+  
  -- ********************************************************************************** --
***************
*** 580,582 ****
	  currY = currY + 1
!  
	  -- Check that there is sufficient inventory space as may have picked up a block
--- 588,590 ----
	  currY = currY + 1
!	 save()
	  -- Check that there is sufficient inventory space as may have picked up a block
***************
*** 597,599 ****
	  currY = currY - 1
!  
	  -- Check that there is sufficient inventory space as may have picked up a block
--- 605,607 ----
	  currY = currY - 1
!	 save()
	  -- Check that there is sufficient inventory space as may have picked up a block

Which allowed the following startup script to recover the turtle to the surface if the chunk gets unloaded (Well plus or minus 1 block).


local turtleDepth = 0

function up()
	while not turtle.up() do
		if turtle.getFuelLevel() == 0 then
			turtle.select(16)
			turtle.refuel(1)
			if turtle.getFuelLevel() == 0 then
				os.exit()
			end
		end
		turtle.digUp()
	end
end

--Saves current progress to file
function save()
	local file = io.open('OreQuarry_Depth', 'w')
	file:write(""..turtleDepth)
	file:close()
end


local file = fs.open('OreQuarry_Depth', 'r')
if (file ~= nil) then
	turtleDepth = file:readAll()
	print ('Recovering from turtleDepth ' .. turtleDepth)
	for i=1, turtleDepth do
		up()
		turtleDepth=turtleDepth-1
		save()
	end
	file:close()
	shell.run('delete', 'OreQuarry_Depth');
end

Yes I know. My lua sucks :)/>

Again really nice program :)/>

Very nice :-)
AustinKK #112
Posted 09 January 2013 - 12:38 PM
You should be able to do that now, Just add a diamond Ore block as a noise block, and the miner turtle should treat it like any other noise block that you put in there (stone, dirt, gravel…)
I did so, but it took us about 120 levels to get a silk touch pick and another 60 to get fortune.

Adding a Diamond Ore as a noise block will make sure it doesn't dig it, but only in the case where it doesn't happen to already be digging that block (for example if there is a diamond in one of the layers that it is travelling through it will always dig it)
AustinKK #113
Posted 09 January 2013 - 12:41 PM
I have the same issue. Hiccup in programming, or intentional?

Err, no, not intentional.

Let me investigate…
AustinKK #114
Posted 09 January 2013 - 12:47 PM
In the updated version the turtle definitely drops the chest inside the storage unit as opposed to using it as a filter for loot chest underground. Also, I am not quite sure, but is the noise blocks supposed to be 'discarded' by the turtle or not? It seems that whether I use it or not, I still end up with huge amounts of cobble and dirt. If this is the case, couldn't you consider adding a step or 2 in which it discards any of the noise blocks before making a trip to the chest as to firstly free up space and secondly avoid dropping unnecessary blocks in the chest. That, or should we add our own processes to discard unwanted blocks? Still a winning program though :D/>/>

The noise blocks are supposed to stay in the turtle's inventory, they can't be discarded because it needs them for block comparisons.

Because the turtle digs every third layer, it will pick up plenty of dirt and cobble because of that. It wouldn't be easy to drop cobble and dirt (in fact I'm not sure how you would go about doing it because the turtle can only compare blocks to other ones that are in the world rather than in its inventory). Besides, I normally want a bit of cobble anyway (I usually turn it into scrap to use in a Matter Fabricator).
AustinKK #115
Posted 09 January 2013 - 12:57 PM
You guys that are finding that the turtle is dropping off it's chest, are you configuring the inventory like it is at 16:26 in this video:

http://www.youtube.com/watch?v=PIugLVzUz3g

If so, that's odd because I'm getting different results (see 24:46 - the chest is still there after the program has finished). Does it always happen, or just sometimes?
Cozzimoto #116
Posted 09 January 2013 - 03:17 PM
austinKK great update video, nice work in taking in everyone's input, but i give you credit cause you did all the testing and the hard work =P
Spraw #117
Posted 09 January 2013 - 05:22 PM
In the updated version the turtle definitely drops the chest inside the storage unit as opposed to using it as a filter for loot chest underground. Also, I am not quite sure, but is the noise blocks supposed to be 'discarded' by the turtle or not? It seems that whether I use it or not, I still end up with huge amounts of cobble and dirt. If this is the case, couldn't you consider adding a step or 2 in which it discards any of the noise blocks before making a trip to the chest as to firstly free up space and secondly avoid dropping unnecessary blocks in the chest. That, or should we add our own processes to discard unwanted blocks? Still a winning program though :D/>/>

The noise blocks are supposed to stay in the turtle's inventory, they can't be discarded because it needs them for block comparisons.

Because the turtle digs every third layer, it will pick up plenty of dirt and cobble because of that. It wouldn't be easy to drop cobble and dirt (in fact I'm not sure how you would go about doing it because the turtle can only compare blocks to other ones that are in the world rather than in its inventory). Besides, I normally want a bit of cobble anyway (I usually turn it into scrap to use in a Matter Fabricator).

You can actually compare items in a turtles inventory. turtle.compareTo(slot) compares the selected slot with the slot you tell it to
bruteman #118
Posted 09 January 2013 - 07:00 PM
Identical to video only difference is i use coal in slot 16 instead of charcoal but yes same setup using Pastebin : 3mkeUzby
AustinKK #119
Posted 09 January 2013 - 10:29 PM
In the updated version the turtle definitely drops the chest inside the storage unit as opposed to using it as a filter for loot chest underground. Also, I am not quite sure, but is the noise blocks supposed to be 'discarded' by the turtle or not? It seems that whether I use it or not, I still end up with huge amounts of cobble and dirt. If this is the case, couldn't you consider adding a step or 2 in which it discards any of the noise blocks before making a trip to the chest as to firstly free up space and secondly avoid dropping unnecessary blocks in the chest. That, or should we add our own processes to discard unwanted blocks? Still a winning program though :D/>/>

The noise blocks are supposed to stay in the turtle's inventory, they can't be discarded because it needs them for block comparisons.

Because the turtle digs every third layer, it will pick up plenty of dirt and cobble because of that. It wouldn't be easy to drop cobble and dirt (in fact I'm not sure how you would go about doing it because the turtle can only compare blocks to other ones that are in the world rather than in its inventory). Besides, I normally want a bit of cobble anyway (I usually turn it into scrap to use in a Matter Fabricator).

You can actually compare items in a turtles inventory. turtle.compareTo(slot) compares the selected slot with the slot you tell it to

Oh, yes, you are right.
Deor #120
Posted 10 January 2013 - 01:15 AM
Have noticed my turtle seems to sometimes discard the chest, but not always. Cant put my finger on it I'm afraid.
I've been having a few issues with my turtle anyway as I've had some server stability problems with the latest FTB Mindcrack update, seems to have settled now tho. Doesn't help when you are trying to run a 50x50 quarry so will go back to my normal 15x15 setup and let you know how it runs over the next few days.

BTW, my mechanical friend has retrieved 47 diamonds for me since you released the new version! Do drop me a line if you want to hop on to my UK based server for any testing.

Oh and I think it would be great if you could do a tree farm program :)/>
AustinKK #121
Posted 10 January 2013 - 03:54 AM
Have noticed my turtle seems to sometimes discard the chest, but not always. Cant put my finger on it I'm afraid.
I've been having a few issues with my turtle anyway as I've had some server stability problems with the latest FTB Mindcrack update, seems to have settled now tho. Doesn't help when you are trying to run a 50x50 quarry so will go back to my normal 15x15 setup and let you know how it runs over the next few days.

BTW, my mechanical friend has retrieved 47 diamonds for me since you released the new version! Do drop me a line if you want to hop on to my UK based server for any testing.

Oh and I think it would be great if you could do a tree farm program :)/>

Let's just put it down to sever stability issues then! :unsure:/>

I'll create a version with more debugging in and if you guys can use that whilst your having a problem and send me the output when it goes wrong (I'll write it to a file on the turtle) that would really help get to the bottom of this.
AustinKK #122
Posted 10 January 2013 - 06:03 AM
Would one of you guys that are having problems with the chest being deposited in the chest try a version of the OreQuarry that has some debugging around the inventory emptying function.

It is on pastebin (id = TRtdTB19)

It writes to an output file called "log.txt". Can you post the file after a run where it incorrectly drops off the chest?

Thanks!
wizaerd #123
Posted 10 January 2013 - 07:51 AM
Has this program undergone any changes recently? last night I tried to use it, and the turtle did not filter out the items I placed in the first three inventory slots. I put Stone, Cobblestone, and Dirt in the first 3 inventory slots of the turtle, and in the chest the turtle would dump into included Stone, Cobblestone, and Dirt.
Ulthean #124
Posted 10 January 2013 - 08:05 AM
The turtle will still need to dig the paths, so some dirt and cobblestone will always be mined, as long as he didn't quarry out the entire area (like a buildcraft quarry) I am sure it is working as intended.
Mcfeegle #125
Posted 10 January 2013 - 09:20 AM
Would one of you guys that are having problems with the chest being deposited in the chest try a version of the OreQuarry that has some debugging around the inventory emptying function.

It is on pastebin (id = TRtdTB19)

It writes to an output file called "log.txt". Can you post the file after a run where it incorrectly drops off the chest?

Thanks!

Didn't get a chance to run a full cycle however I did get this much….

bios:338: [string "log.txt"]:2:unexpected symbol
evilguard #126
Posted 10 January 2013 - 01:55 PM
Did try a lot of software and really this one is one of the best so far! It use less energy and it work like a charm for now. What i would love to see add? A resume fonction would be cool and there is something i would love to know.

Is that programs could be applied in a branch mining underground? It would branch mining like a boss and could be nice for more specific use like finding diamond or Tin/copper since they spawn in various layer. Saying that little buddy mining 5 high and 32 wide channel and 32 dept branch mine!

Its sound like a great idea?
MrFuggernaut #127
Posted 10 January 2013 - 02:47 PM
This program is fantastic and I have completely replaced my BC quarries with this!! Major props to austinkk and I love the vid! In response to some of you guys that wanted a branch mining program, you can use this one in combination with the MLG circular mining to really roll in the diamonds :D/>
Kadura #128
Posted 10 January 2013 - 02:52 PM
I have started running the debug version of 0.5, and have a couple of log files for you - you can find them on pastebin at XNPkKcXF and XeqCLQw6.
I think the files ended up truncating because the server seized up and had to be rebooted (not certain of the cause of that, either, the only thing going on was my turtles running 0.5 - nobody else was logged on)
bruteman #129
Posted 11 January 2013 - 03:58 AM
Would one of you guys that are having problems with the chest being deposited in the chest try a version of the OreQuarry that has some debugging around the inventory emptying function.

It is on pastebin (id = TRtdTB19)

It writes to an output file called "log.txt". Can you post the file after a run where it incorrectly drops off the chest?

Thanks!

also video recording the start of the turtle and the setup i have in it and then with a chest open the dropping off after the chest is deposited into the storage system i'll try and open the turtle on a return to show you the missing chest on video. stay tuned :)/>


Here is the video…. the text log to follow shortly :

[media]http://youtu.be/EFZY5248dss[/media]
AustinKK #130
Posted 11 January 2013 - 06:15 AM
Thanks those who downloaded the debug program (and thanks bruteman for the video).

I can see what it is doing, but not why.

I've refreshed the debug version of the code and uploaded it to pastebin. Would one of you that is having the problem try the new version (v0.51). It is at the same pastebin link as the previous debug version (TRtdTB19).

If you can post the log.txt file when it fails, that would really help. Thanks in advance.
AustinKK #131
Posted 11 January 2013 - 06:24 AM
Would one of you guys that are having problems with the chest being deposited in the chest try a version of the OreQuarry that has some debugging around the inventory emptying function.

It is on pastebin (id = TRtdTB19)

It writes to an output file called "log.txt". Can you post the file after a run where it incorrectly drops off the chest?

Thanks!

Didn't get a chance to run a full cycle however I did get this much….

bios:338: [string "log.txt"]:2:unexpected symbol

Errr, no idea why you are getting that.

I've refreshed the code with some more debugging (v0.51). Could you try again?

I have started running the debug version of 0.5, and have a couple of log files for you - you can find them on pastebin at XNPkKcXF and XeqCLQw6.
I think the files ended up truncating because the server seized up and had to be rebooted (not certain of the cause of that, either, the only thing going on was my turtles running 0.5 - nobody else was logged on)

Thanks for this - it identified what wasn't working (but still not sure why…).
Deor #132
Posted 11 January 2013 - 08:19 AM
Just setting up to run the debug version for you, will report back later.
Deor #133
Posted 11 January 2013 - 09:13 AM
Ok so pretty much on the first unload hes dumped the chest and replaced it with gravel. Will post the log once hes finished and i can copy it for you.
AustinKK #134
Posted 11 January 2013 - 10:22 AM
Ok so pretty much on the first unload hes dumped the chest and replaced it with gravel. Will post the log once hes finished and i can copy it for you.

OK, thanks
Deor #135
Posted 11 January 2013 - 10:29 AM
Here we go, log on pastebin: http://pastebin.com/uS1e7TRg
AustinKK #136
Posted 11 January 2013 - 11:10 AM
Here we go, log on pastebin: http://pastebin.com/uS1e7TRg

Thanks for that. Think I might know where the bug is.

Can I ask how big the Quarry is that you mining (width wise)?
Kadura #137
Posted 11 January 2013 - 11:32 AM
My standard quarry is 15x15, starting at 18 (foot height), and so far I have run the 0.5 version twice (I run a pair of turtles, going in opposite direction), and each time the turtles have locked the server up somehow. Perhaps log file size? One turtle finishes, the other gets stuck on like row 13 column 13 on level 18 after working its way up from the bottom (both times), and both times both turtles have ejected their slot 15 chests at their first visit to the drop off chest. I will download 0.51 a bit later when I am home on the main computer and easily able to restart the server.

I must say that I find the alteration to bottom-up digging a bit disconcerting as I now find my turtles hovering over a hole directly to bedrock (or, in both instances I've run it, LAVA.) Not a fan of that, really.
Deor #138
Posted 11 January 2013 - 11:59 AM
Mine was 15 by 15, started at level 52.
AustinKK #139
Posted 11 January 2013 - 10:08 PM
Hi Guys,

I've found the problem, and pretty sure I've fixed it.

I've updated the debug version with the fix (TRtdTB19) so that is now version 0.52. If one of you guys could give it one last test before I update the standard version with the bug fix I would appreciate it.

Thanks in particular to Deor, Kadura and bruteman for helping me get to the bottom of this…

Kadura, not sure why you're getting problems. If this fix works, I'll take the log file writing out of the version that I release. In terms of digging from the bottom up, I guess if the turtle was working, then would be no problem, but yes I see your point. I think I'm going to need to add the ability for the turtle to restart sooner rather than later…
Deor #140
Posted 12 January 2013 - 12:13 AM
No problem mate, any time!

Have set it off again and will report back, same size as before.
r2range #141
Posted 12 January 2013 - 01:31 AM
ey when i run my turtle it stops it mines until badrock and goes like 6 squares then it just stops.
AustinKK #142
Posted 12 January 2013 - 01:52 AM
ey when i run my turtle it stops it mines until badrock and goes like 6 squares then it just stops.

Which version are you using?
Deor #143
Posted 12 January 2013 - 02:06 AM
And we are done. Here is the debug log for you: http://pastebin.com/BtEyUY4D
Didnt drop the chest either so i think you cracked it!
r2range #144
Posted 12 January 2013 - 05:32 AM
ey when i run my turtle it stops it mines until badrock and goes like 6 squares then it just stops.

Which version are you using?
well this version

http://www.youtube.com/watch?v=PIugLVzUz3g
AustinKK #145
Posted 12 January 2013 - 06:07 AM
OK, I've released an updated version of the Ore Quarry (version 0.53) which has a fix to the bug that meant that the turtle would sometimes drop off its chest when emptying its inventory.

This is an update to the original pastebin upload (http://pastebin.com/3mkeUzby)

To download it to a mining turtle:
rom/programs/http/pastebin get 3mkeUzby OreQuarry

Thanks Deor for your help :D/>

ey when i run my turtle it stops it mines until badrock and goes like 6 squares then it just stops.

Which version are you using?
well this version

[media]http://www.youtube.com/watch?v=PIugLVzUz3g[/media]

OK. If you specify the height co-ordinate incorrectly (especially if you set it one too high), then the turtle will not perform correctly. That may be the problem you are seeing.
r2range #146
Posted 12 January 2013 - 06:10 AM
OK, I've released an updated version of the Ore Quarry (version 0.53) which has a fix to the bug that meant that the turtle would sometimes drop off its chest when emptying its inventory.

This is an update to the original pastebin upload (http://pastebin.com/3mkeUzby)

To download it to a mining turtle:
rom/programs/http/pastebin get 3mkeUzby OreQuarry

Thanks Deor for your help :D/>

ey when i run my turtle it stops it mines until badrock and goes like 6 squares then it just stops.

Which version are you using?
well this version

[media]http://www.youtube.com/watch?v=PIugLVzUz3g[/media]

OK. If you specify the height co-ordinate incorrectly (especially if you set it one too high), then the turtle will not perform correctly. That may be the problem you are seeing.
well i just did it as how you did it in the video "OreQuarry 8 69"
"Size of The Hole you want" "My Feet level"

Also your change log needs to be 2013
Deor #147
Posted 12 January 2013 - 09:27 AM
I think you need to give us a bit more to go on mate. Given there are 8 pages in this thread and many people, including me, using the program its very solid and does work if you set it up right. Give us some details of what you do, step by step, post a few pics maybe? Do a short vid? Will be a lot easier to help you get it running than "OMG IT NOT WORK FIIIIIIXXXXXX!!!!!!!" ;)/>
AustinKK #148
Posted 12 January 2013 - 09:36 AM
Also your change log needs to be 2013

Oh yeah - thanks (changed now).

As Deor says, I think we need more information to help you I'm afraid…
r2range #149
Posted 12 January 2013 - 09:52 AM
ok well here is was i do

Place Down Minning Turtle
Left Side a Chest(With Coal)
Under The Minning Turtle Another Chest(empty For the Items to go in )

Open The Minning Turtle and typing in the command

rom/programs/http/pastebin get 3mkeUzby OreQuarry

Then i type label set [name]

Then i type OreQuarry 8 69

69 = Floor Level

and i place Coal in the right down slot next to it a chest and in the first 3 slots (Stone/Sand/Dirt)
bruteman #150
Posted 12 January 2013 - 11:16 AM
ok well here is was i do

Place Down Minning Turtle
Left Side a Chest(With Coal)
Under The Minning Turtle Another Chest(empty For the Items to go in )

Open The Minning Turtle and typing in the command

rom/programs/http/pastebin get 3mkeUzby OreQuarry

Then i type label set [name]

Then i type OreQuarry 8 69

69 = Floor Level

and i place Coal in the right down slot next to it a chest and in the first 3 slots (Stone/Sand/Dirt)

dont put anything under the turtle it mines down!
r2range #151
Posted 12 January 2013 - 11:18 AM
ok well here is was i do

Place Down Minning Turtle
Left Side a Chest(With Coal)
Under The Minning Turtle Another Chest(empty For the Items to go in )

Open The Minning Turtle and typing in the command

rom/programs/http/pastebin get 3mkeUzby OreQuarry

Then i type label set [name]

Then i type OreQuarry 8 69

69 = Floor Level

and i place Coal in the right down slot next to it a chest and in the first 3 slots (Stone/Sand/Dirt)

dont put anything under the turtle it mines down!
i know i ment

[Chest]Turtle
-
c
h
e
s
t

like that on minecraft format then :P/>
Kadura #152
Posted 12 January 2013 - 04:23 PM
Freshly downloaded 0.53, first run… so far so good - server hasn't crashed yet.
DjKiDD #153
Posted 12 January 2013 - 08:36 PM
Great program!
I have a suggestion however…
I was thinking the addition of a new function that could be called when the turtle is full that compares the inventory items to the noise blocks and if they are a match just drop those blocks on the ground
AustinKK #154
Posted 12 January 2013 - 10:52 PM
Great program!
I have a suggestion however…
I was thinking the addition of a new function that could be called when the turtle is full that compares the inventory items to the noise blocks and if they are a match just drop those blocks on the ground

Yeah, that's been mentioned before. I'm not a huge fan of the idea to be honest (I don't like leaving blocks lying around for a variety of reasons). It would only work for dirt too (because stone when mined will be cobble in the inventory so wont match the noise block).
Ethkl #155
Posted 12 January 2013 - 11:05 PM
So we installed the script on to out server and it runs as expected until the first time the fuel runs out. It just stops were ever and when I dig it up the screen says need fuel but I adding it does nothing and I can't type in the interface to tell it to refuel. My only option is to scrap it and replace it.

It seemed like the program is crashing during the refuel portion.

Any thoughts?
NightKev #156
Posted 13 January 2013 - 02:56 AM
Seems to be something strange going on with 0.53, it's mining vertically rather than horizontally.
AustinKK #157
Posted 13 January 2013 - 02:59 AM
Seems to be something strange going on with 0.53, it's mining vertically rather than horizontally.

Check the height value that you've set for it. You get that if you've given it the wrong starting height.
AustinKK #158
Posted 13 January 2013 - 03:00 AM
So we installed the script on to out server and it runs as expected until the first time the fuel runs out. It just stops were ever and when I dig it up the screen says need fuel but I adding it does nothing and I can't type in the interface to tell it to refuel. My only option is to scrap it and replace it.

It seemed like the program is crashing during the refuel portion.

Any thoughts?

The refuel function doesn't keep trying for fuel until it receives some. If it's run out, it's run out.

The idea is that you put fuel in the chest at the top (to the left of where the turtle starts) to keep it fuelled up rather than you having to find the turtle to refuel it.

Yes, if it runs out of fuel you will have to reset it.
NightKev #159
Posted 13 January 2013 - 03:37 AM
Hm, I must have switched the area and y-coord arguments or something, as re-running them has indeed fixed the problem.
Ethkl #160
Posted 13 January 2013 - 05:07 AM
So it doesn't have a refuel routine like excavate does? If excavate is low on fuel it returns to base and awaits refueling.

Well at least I know what I'm doing wrong. I'll go farm some coal before I implement this. Thanks for the quick response.

P.S. I might suggest updating the "how to" section to point that out for people playing on survival. I have nearly ever had multiple stacks of coal.

I wouldn't go and do a whole new vid. Just post up some simple instructions on the OP.

Thanks and great work.
bruteman #161
Posted 13 January 2013 - 05:49 AM
So it doesn't have a refuel routine like excavate does? If excavate is low on fuel it returns to base and awaits refueling.

Well at least I know what I'm doing wrong. I'll go farm some coal before I implement this. Thanks for the quick response.

P.S. I might suggest updating the "how to" section to point that out for people playing on survival. I have nearly ever had multiple stacks of coal.

I wouldn't go and do a whole new vid. Just post up some simple instructions on the OP.

Thanks and great work.

The video tutorial clearly shows this it has since he first put the program up …
wizaerd #162
Posted 13 January 2013 - 06:01 AM
So I've run the turle OreQuarry twice thus far this morning, and I put a block of cobblestone in the first slot, dirt in the second, and regular stone in the third, a chest in the next to last and coal in the very last. And I end up with a chest full of cobblestone, dirt, and stone along with all the other stuff. In this filtering portion, is it a single block or a stack I should be putting there, because so far it's just not filtering anything.
r2range #163
Posted 13 January 2013 - 06:04 AM
well it was running now for 20mins or something and it just crashed it stoped mining and was standing, it came back once to empty the inventory / refuel
Ethkl #164
Posted 13 January 2013 - 06:41 AM
well it was running now for 20mins or something and it just crashed it stoped mining and was standing, it came back once to empty the inventory / refuel

That is the same issue I am having. Check to see if it is running out of fuel. If so you just need to start with more.
r2range #165
Posted 13 January 2013 - 07:08 AM
well it was running now for 20mins or something and it just crashed it stoped mining and was standing, it came back once to empty the inventory / refuel

That is the same issue I am having. Check to see if it is running out of fuel. If so you just need to start with more.
well it didnt run out of fuel it had still 64x coal left when i broke it.
Deor #166
Posted 13 January 2013 - 07:11 AM
Guys are you staying with your turtles while they mine? If the chunk they are mining on unloads, they will stop working and reset. On a SMP server the norm is for the server to load a 21x21 grid with you in the middle. So, if you move more than 10 chunks (about 160m) from your turtle, it will get unloaded and stop in its tracks!

You can get around this by using a world anchor or chunk loader to keep the mining area alive. There is also the chunk loader turtle addon if you have MiscPeriferals installed along side CC.
Deor #167
Posted 13 January 2013 - 07:14 AM
So I've run the turle OreQuarry twice thus far this morning, and I put a block of cobblestone in the first slot, dirt in the second, and regular stone in the third, a chest in the next to last and coal in the very last. And I end up with a chest full of cobblestone, dirt, and stone along with all the other stuff. In this filtering portion, is it a single block or a stack I should be putting there, because so far it's just not filtering anything.

Wizaerd, this is because the turtle still has to mine out every third level regardless of your filter blocks, otherwise he cant get around. You will always get some stuff you don't want regardless, so i use a pipe filter system to clean it up and add extra storage for when im mining a larger area. I'll post some pics of my typical setup in a bit!
wizaerd #168
Posted 13 January 2013 - 07:18 AM
So I've run the turle OreQuarry twice thus far this morning, and I put a block of cobblestone in the first slot, dirt in the second, and regular stone in the third, a chest in the next to last and coal in the very last. And I end up with a chest full of cobblestone, dirt, and stone along with all the other stuff. In this filtering portion, is it a single block or a stack I should be putting there, because so far it's just not filtering anything.

Wizaerd, this is because the turtle still has to mine out every third level regardless of your filter blocks, otherwise he cant get around. You will always get some stuff you don't want regardless, so i use a pipe filter system to clean it up and add extra storage for when im mining a larger area. I'll post some pics of my typical setup in a bit!

Well I knew the turtle would have to break the blocks regardless, I just thought with the filter in place, it wouldn't actually pick them up and carry them to the inventory chest, it'd just leave them. And I suppose I can understand that, but there are a whole lot of full stacks, not just a few. But I can live with it, I can pipe it out into a void pipe or a separate chest.
CraftyDrac #169
Posted 13 January 2013 - 09:23 AM
Hiya

i ran this program several times,no problems with running it with the size on 5

now i recently got a enderpearl and upgraded it to a chunkloading turtle,so i decided to ran it on a larger size and on a higher Y
i ran it in this way:
orequarry 20 110

it instantly printed out that it was mining at Y 5,and went down there too(i stupidly jumped after it,and had to be saved by a admin of the server im on)
so i'm not sure if this is intentional or a bug
after the turtle is done,i will comfirm i ran it correctly and screenhot the turtle GUI
Deor #170
Posted 13 January 2013 - 12:43 PM
Yeah thats intentional, the new versions start from the bottom and work up.

(you'd never catch me falling down the shaft after it, noooo sir ;)/> )
Deor #171
Posted 13 January 2013 - 12:48 PM
Austin, one thought i had this evening was the ability to specify the start level. Would be handy for resuming, once you rescue your turtle from level 20 and set him up a again, just add an additional paramiter that tells him to start at 20 again. May recover some ground, but better than starting from scratch.

Also maybe the ability to bracket? By that i mean tell him that the start position with the chests is at level 60, but to go down and mine levels 10 to 30 and then come back and stop.
Kusinagii #172
Posted 13 January 2013 - 10:10 PM
So I've run the turle OreQuarry twice thus far this morning, and I put a block of cobblestone in the first slot, dirt in the second, and regular stone in the third, a chest in the next to last and coal in the very last. And I end up with a chest full of cobblestone, dirt, and stone along with all the other stuff. In this filtering portion, is it a single block or a stack I should be putting there, because so far it's just not filtering anything.

Wizaerd, this is because the turtle still has to mine out every third level regardless of your filter blocks, otherwise he cant get around. You will always get some stuff you don't want regardless, so i use a pipe filter system to clean it up and add extra storage for when im mining a larger area. I'll post some pics of my typical setup in a bit!

Well I knew the turtle would have to break the blocks regardless, I just thought with the filter in place, it wouldn't actually pick them up and carry them to the inventory chest, it'd just leave them. And I suppose I can understand that, but there are a whole lot of full stacks, not just a few. But I can live with it, I can pipe it out into a void pipe or a separate chest.

You need to put Stone in the first slot, not cobblestone. The turtle checks the filter blocks against the block in the world, not the blocks it picks up. For instance, it looks up, checks the id of the block above it, then one by one checks to see if it matches any blocks in the filter slots. If it's under stone it will look for stone, if you have cobblestone in your filter it's only going to skip cobblestone.
Aeolun #173
Posted 13 January 2013 - 11:35 PM
Ok, since I thought this script was pretty epic, but I was feeling totally retarded constantly going back to pick up my turtle when it ran out of fuel (which it always, eventually, did). I modified it to check for fuel when it starts, and every time it's back at the chests. It goes back if it reaches it's emergency fuel levels, and then sits at the chests until you feed it more fuel.

http://pastebin.com/eUxK78su

AustinKK, my apologies for barging in and doing this, feel free to either include it or not, or modify it as you will, just thought it might be useful for more people than me.
CraftyDrac #174
Posted 14 January 2013 - 12:09 AM
Yeah thats intentional, the new versions start from the bottom and work up.

(you'd never catch me falling down the shaft after it, noooo sir ;)/> )

okay,thats good to know
the turtle got stuck after about 4 full inventories,so im currently trying to figure out why(digging into the earth and trying to find it)
it was a diamond pickaxe/chunloading turtle,so it shouldnt get stuck…
Deor #175
Posted 14 January 2013 - 01:51 AM
Ok, since I thought this script was pretty epic, but I was feeling totally retarded constantly going back to pick up my turtle when it ran out of fuel (which it always, eventually, did). I modified it to check for fuel when it starts, and every time it's back at the chests. It goes back if it reaches it's emergency fuel levels, and then sits at the chests until you feed it more fuel.

http://pastebin.com/eUxK78su

AustinKK, my apologies for barging in and doing this, feel free to either include it or not, or modify it as you will, just thought it might be useful for more people than me.

As far as i know, the turtle should already do this! Thats the point of the fuel chest to the left of the start position. I usually give mine a full stack of coal onboard, plus a couple more ready in the chest and ive not had him run out as yet. I always keep an eye on the fuel chest and top it up with stuff from the drop off chest as needed. After the first few runs i'm not at all short of coal!
Aeolun #176
Posted 14 January 2013 - 05:39 AM
As far as i know, the turtle should already do this! Thats the point of the fuel chest to the left of the start position. I usually give mine a full stack of coal onboard, plus a couple more ready in the chest and ive not had him run out as yet. I always keep an eye on the fuel chest and top it up with stuff from the drop off chest as needed. After the first few runs i'm not at all short of coal!

I think it worked like this. The turtle always refuels up to 64 when it is back at the start. So if you gave it 64 fuel to start with, it would be full of ores before the fuel ran out (and then return to the start), where it would fill itself up again. The situations where this went wrong, were where your turtle has too little fuel at the start to even finish it's first round, or where your fuel chest runs out, and your lovely turtle goes off again with near zero fuel.

I always put like 10 coal in my turtle at the start (I'm poor), then sent him off with some coal left in the chest, I'd dig 64x64 and it would end up sitting downstairs doing nothing. Checking up on it always yielded 'I am totally out of fuel' :P/> Arguably, that is my fault, after all, it was clear it worked like that. I just never bother to keep an eye on the fuel chest. I'm lazy, and I need my scripts to protect me against myself ;)/> rather have it sit at the top complaining about lack of fuel than at the bottom.
AustinKK #177
Posted 14 January 2013 - 08:06 AM
Austin, one thought i had this evening was the ability to specify the start level. Would be handy for resuming, once you rescue your turtle from level 20 and set him up a again, just add an additional paramiter that tells him to start at 20 again. May recover some ground, but better than starting from scratch.

Also maybe the ability to bracket? By that i mean tell him that the start position with the chests is at level 60, but to go down and mine levels 10 to 30 and then come back and stop.

Hey Deor,

I've been working on the ability for the turtle to resume. Hopefully if I get that sorted it will be less of a problem.

Being able to bracket would be a good idea though…
AustinKK #178
Posted 14 January 2013 - 08:23 AM
Hi guys (and gals),

I've been frantically working away over the weekend trying to add the ability for the Mining Turtle to resume, and I think I've finally finished it.

I haven't updated the standard program yet (in case there are some bugs that I haven't yet found), but have created a version on pastebin for anyone who wants to try it out.

The pastebin link is:
http://pastebin.com/TRtdTB19

To download the program onto a mining turtle, use the following command:

rom/programs/http/pastebin get TRtdTB19 OreQuarry

It's set up in exactly the same way as before (it automatically creates all of the files that it needs to be able to auto-resume), and the command line to run it is the same.

In the end, I decided against relying on GPS for the turtle's location because I think it's a bit of a pain to have to set up, and it's not 100% reliable due to the reduced distance in a storm.

Therefore, the turtle writes to a file every time it moves. Weirdly, I found no performance impact of doing this in my tests (although you can disable the auto-resume capability by adding "/r" to the end of the command line if you want). There is still a risk of a race condition (and therefore your turtle not quite knowing where it is), but I think (based on my maths) that the probability of this is less than 1%.

Let me know what you think.
Philderbeast #179
Posted 14 January 2013 - 08:46 AM
tp avpod that race condition could you not check with GPS once it goes back up to unloadto make sure its not the one block off? otherwise its going to make a mess by not being next to the chest when it trys to unload/

even if it sits there for a while waiting for gps signal 1 or 2 blocks from the start its going to be better then loosing a lot of ores in the event of the race condition.
AustinKK #180
Posted 14 January 2013 - 08:55 AM
tp avpod that race condition could you not check with GPS once it goes back up to unloadto make sure its not the one block off? otherwise its going to make a mess by not being next to the chest when it trys to unload/

even if it sits there for a while waiting for gps signal 1 or 2 blocks from the start its going to be better then loosing a lot of ores in the event of the race condition.

Yeah, maybe. I'm just not a big fan of requiring GPS (I guess your suggestion doesn't require it, it merely enhances the turtle).
CraftyDrac #181
Posted 14 January 2013 - 09:38 AM
the old version got stuck again for no apperant reason
so i'll find the turtle and try the new program
DjKiDD #182
Posted 14 January 2013 - 02:21 PM
Great program!
I have a suggestion however…
I was thinking the addition of a new function that could be called when the turtle is full that compares the inventory items to the noise blocks and if they are a match just drop those blocks on the ground

Yeah, that's been mentioned before. I'm not a huge fan of the idea to be honest (I don't like leaving blocks lying around for a variety of reasons). It would only work for dirt too (because stone when mined will be cobble in the inventory so wont match the noise block).

I don't think it would be that big a deal to put a cobble block in the static blocks…
acters124 #183
Posted 14 January 2013 - 04:18 PM
Great program!
I have a suggestion however…
I was thinking the addition of a new function that could be called when the turtle is full that compares the inventory items to the noise blocks and if they are a match just drop those blocks on the ground

Yeah, that's been mentioned before. I'm not a huge fan of the idea to be honest (I don't like leaving blocks lying around for a variety of reasons). It would only work for dirt too (because stone when mined will be cobble in the inventory so wont match the noise block).

I don't think it would be that big a deal to put a cobble block in the static blocks…
dont forget about the lag it could cause if too many of the noise blocks are dropped.
I would just feed them to lava or recycler.
even though it might waste inventory space, I would love to have my cobble and dirt there.
basically I wouldn't want it as a feature.
Philderbeast #184
Posted 14 January 2013 - 08:49 PM
tp avpod that race condition could you not check with GPS once it goes back up to unloadto make sure its not the one block off? otherwise its going to make a mess by not being next to the chest when it trys to unload/

even if it sits there for a while waiting for gps signal 1 or 2 blocks from the start its going to be better then loosing a lot of ores in the event of the race condition.

Yeah, maybe. I'm just not a big fan of requiring GPS (I guess your suggestion doesn't require it, it merely enhances the turtle).

if people want they can put the gps right at the home location to guarentee its in range regardless of weather as well.
Znubbis #185
Posted 14 January 2013 - 11:02 PM
Very nice program, and so easy to setup!

I had a few problems simular to Aeolun I also managed to get my bot to stall deep down, i like his suggestion that it goes back up top and wait for more fuel before it continues if its down to emergency fuel.

I also love the rednet messages, even if i have some problem with the range, maybe ill code som repeter for it some day :)/>

Thank you!
xInDiGo #186
Posted 16 January 2013 - 06:43 AM
so i've been trying out the script that can resume, and i noticed that every time i put that turtle down (it didn't finish its last job) it looks like its trying to resume were it was, but fails (times out) the thing is, it does it every time i put the turtle down, and the huge string of code goes flying about!

otherwise, this is a great and fantastic ore miner! its got MINIMAL setup, and works great! diging a large quarry can take a while, talking 8+ hours for a 40x40 excavation, but with a world anchor it makes no difference, i can literally let it go while i'm afk in a 1x1x3 hole in the ground! but all of it works amazingly!


::edited for clarity::
bruteman #187
Posted 16 January 2013 - 07:09 AM
so i've been trying out the script that can resume, and i noticed that every time i put that turtle down (it didn't finish its last job) it looks like its trying to resume were it was, but fails (times out) the thing is, it does it every time i put the turtle down, and the huge string of code goes flying about!

otherwise, this is a great and fantastic ore miner! its got MINIMAL setup, and works great! its a bit slow, talking 8+ hours for a 40x40 excavation, but with a world anchor it makes no difference, i can literally let it go while i'm afk in a 1x1x3 hole in the ground! but all of it works amazingly!

this would be because of the startup file that is written for the autoresume there's no real way around this other then when your done one quarry area delete the startup file before picking up the turtle and relocating it.
xInDiGo #188
Posted 16 January 2013 - 07:57 AM
alright, so whats causing the issue of the chest being deposited in w/ the loot?

and, if it runs out of fuel, how do i get it to resume upon refueling. when opened the turtle prompt it just says completely out of fuel, and i can't do anything. putting fuel in it's last slot doesn't make it refuel, and after breaking it and repositioning it, it wont resume, i get an error "149:to long with out yielding"
AustinKK #189
Posted 16 January 2013 - 08:26 AM
alright, so whats causing the issue of the chest being deposited in w/ the loot?

and, if it runs out of fuel, how do i get it to resume upon refueling. when opened the turtle prompt it just says completely out of fuel, and i can't do anything. putting fuel in it's last slot doesn't make it refuel, and after breaking it and repositioning it, it wont resume, i get an error "149:to long with out yielding"

I haven't implemented refuelling, the idea is that it's "set and forget" and therefore the fuel is put in a chest next to it at the start.

bruteman is right, you need to delete the startup file if it is restarting when it shouldn't.

Interesting that you say it is slow. Do you mean in relation to something else or just generally?
xInDiGo #190
Posted 16 January 2013 - 08:46 AM
I haven't implemented refuelling, the idea is that it's "set and forget" and therefore the fuel is put in a chest next to it at the start.

bruteman is right, you need to delete the startup file if it is restarting when it shouldn't.

Interesting that you say it is slow. Do you mean in relation to something else or just generally?

my problem was that it wasn't restarting at all. it just kept saying "to long with out yielding"

as for the fuel, i had plenty of fuel in the chest, what seemed to happen was the fuel got mixed around in the turtles inventory and it couldn't refuel. i'm assuming its cause it deposited the chest but what do i know?

also, i didn't mean it was slow. i meant that digging a large quarry will take a while, like 8+ hours on a 40x40. its probably a lot faster than the default excavate!
AustinKK #191
Posted 16 January 2013 - 07:39 PM
I haven't implemented refuelling, the idea is that it's "set and forget" and therefore the fuel is put in a chest next to it at the start.

bruteman is right, you need to delete the startup file if it is restarting when it shouldn't.

Interesting that you say it is slow. Do you mean in relation to something else or just generally?

my problem was that it wasn't restarting at all. it just kept saying "to long with out yielding"

as for the fuel, i had plenty of fuel in the chest, what seemed to happen was the fuel got mixed around in the turtles inventory and it couldn't refuel. i'm assuming its cause it deposited the chest but what do i know?

also, i didn't mean it was slow. i meant that digging a large quarry will take a while, like 8+ hours on a 40x40. its probably a lot faster than the default excavate!

Ah OK.

The turtle no longer deposits the chest (I fixed that bug)
Deor #192
Posted 16 January 2013 - 10:09 PM
Ran through the test version last night on my normal 15x15 starting at about level 60. Worked without a problem, tho I didn't have to resume so i cant comment on that yet :)/>
Wall #193
Posted 17 January 2013 - 12:26 AM
Any way too add the FTB ores to the program?
Ulthean #194
Posted 17 January 2013 - 12:28 AM
It already should work with FTB, since it digs all blocks that are not in the noise block slots, so if you only put in stone/dirt/gravel it will dig all the FTB ores just as well as the normal ores.
Deor #195
Posted 17 January 2013 - 12:39 AM
Yeah im running on FTB Mindcrack pack and it mines everything just fine.
Ethkl #196
Posted 17 January 2013 - 01:48 PM
Quick question. What happens if when the turtle goes to unload and the chest it is unloading into is full? Does it wait for space to open up? Does it drop the items?

I ask because im trying to build a quarry set up with 4 turtles leaving from one point. The idea is to be able to empty a 20x20 section in 40 or so min and keep the items localized.

so it would look like this
T = Turtle
C = Chest.
F = Fuel Chest

F T F
T C T
F T F

In this configuration there would only be 1 coulomb that would not be mined. Then I was going to have wood/Diamond pipes take the items from the central chest and filter them in to additional chests. My concern, as stated above, is that if 3 or more turtles return before the box is completely empty, what would happen to those items? Will they get dropped down the shaft?

EDIT: Also, when do you expect the "Resume" function to go into the final version? The server im on doesn't have the HTTP API so cant test your beta version. Currently I have to send the script to the adnim to be installed.
Znubbis #197
Posted 17 January 2013 - 11:28 PM
If i could suggest a small change, is it possible to move the refuel chest to above the turtle when he start? That can also stop me from falling down the hole by mistake :D/>
Aeolun #198
Posted 18 January 2013 - 01:34 AM
Been mucking around with this a bit more. I can't help the feeling that all my changes are terribly crude, but doing it mostly for myself. So, for people interested, it stops to refuel, you have a 5 second grace period on turtle startup that will allow you to cancel the resume function, and a startup parameter is added (3rd parameter, where the /r normally is) that allows you to select a level to start digging at (just in case you do not want to go completely bottom up).

Only issue is when you start it, it goes down, smashes the first block, then seems to remember something it's forgotten and returns to top, to run the empty/refuel/check procedure again before then going down again and actually starting the excavation, but I thought this was somewhat funny, and you only start it once in a while anyway :P/> though the real reason I didn't fix it is because I'm lazy of course.

http://pastebin.com/eUxK78su
Sheepbro #199
Posted 19 January 2013 - 09:28 AM
I'm getting the error "[string "Quarry"]:629: cannot use '…' outside a vararg function."
What do?
Never mind, see edit.

EDIT: to clarify, I'm playing on a mindcrack multiplayer server without http enabled, I typed over the whole program.
Also, it seems to be over that problem after I took away the dots, fixed three typos and put them back in, but it digs to underneath the chest that is behind it and then starts moving to the left. Not sure what's going on! Any idea?
ninjabelly #200
Posted 19 January 2013 - 02:20 PM
I'm having a problem of it not digging the top layer of the quarry out and random blocks are left, is it me or the program?
Deor #201
Posted 19 January 2013 - 09:32 PM
I'm having a problem of it not digging the top layer of the quarry out and random blocks are left, is it me or the program?

Is it going down to bedrock when you start and mining its way back up? If so that's as intended. It will only mine the top layer if there is something to mine that's not a noise block.
Deor #202
Posted 19 January 2013 - 09:34 PM
I'm getting the error "[string "Quarry"]:629: cannot use '…' outside a vararg function."
What do?
Never mind, see edit.

EDIT: to clarify, I'm playing on a mindcrack multiplayer server without http enabled, I typed over the whole program.
Also, it seems to be over that problem after I took away the dots, fixed three typos and put them back in, but it digs to underneath the chest that is behind it and then starts moving to the left. Not sure what's going on! Any idea?

This is almost certainly going to be more typos, its a huge amount of code to copy manually. No way to get http on or get an admin to load the code for you?
AustinKK #203
Posted 19 January 2013 - 10:10 PM
Been mucking around with this a bit more. I can't help the feeling that all my changes are terribly crude, but doing it mostly for myself. So, for people interested, it stops to refuel, you have a 5 second grace period on turtle startup that will allow you to cancel the resume function, and a startup parameter is added (3rd parameter, where the /r normally is) that allows you to select a level to start digging at (just in case you do not want to go completely bottom up).

Only issue is when you start it, it goes down, smashes the first block, then seems to remember something it's forgotten and returns to top, to run the empty/refuel/check procedure again before then going down again and actually starting the excavation, but I thought this was somewhat funny, and you only start it once in a while anyway :P/> though the real reason I didn't fix it is because I'm lazy of course.

http://pastebin.com/eUxK78su

Nice :D/>
AustinKK #204
Posted 19 January 2013 - 10:14 PM
Quick question. What happens if when the turtle goes to unload and the chest it is unloading into is full? Does it wait for space to open up? Does it drop the items?

I ask because im trying to build a quarry set up with 4 turtles leaving from one point. The idea is to be able to empty a 20x20 section in 40 or so min and keep the items localized.

so it would look like this
T = Turtle
C = Chest.
F = Fuel Chest

F T F
T C T
F T F

In this configuration there would only be 1 coulomb that would not be mined. Then I was going to have wood/Diamond pipes take the items from the central chest and filter them in to additional chests. My concern, as stated above, is that if 3 or more turtles return before the box is completely empty, what would happen to those items? Will they get dropped down the shaft?

EDIT: Also, when do you expect the "Resume" function to go into the final version? The server im on doesn't have the HTTP API so cant test your beta version. Currently I have to send the script to the adnim to be installed.

It will just dump stuff on the ground if the chest is full, so yes, you need to make sure that the chests don't fill up.

There are two versions of the code, you can download either. The only reason I haven't copied the resume functionality over the standard code is that I wanted some feedback here on how people were getting on.

The two versions are:

Normal version: 3mkeUzby
Version with Resume: TRtdTB19

Although bear in mind that the Version with Resume is still in beta
AustinKK #205
Posted 19 January 2013 - 10:16 PM
I'm getting the error "[string "Quarry"]:629: cannot use '…' outside a vararg function."
What do?
Never mind, see edit.

EDIT: to clarify, I'm playing on a mindcrack multiplayer server without http enabled, I typed over the whole program.
Also, it seems to be over that problem after I took away the dots, fixed three typos and put them back in, but it digs to underneath the chest that is behind it and then starts moving to the left. Not sure what's going on! Any idea?

You typed out the whole program!?!?!?

Wow, you must be some kind of typing ninja… :ph34r:/>

I'm having a problem of it not digging the top layer of the quarry out and random blocks are left, is it me or the program?

Does it make a difference which level you start the turtle on, or does it always do it?
Sheepbro #206
Posted 20 January 2013 - 12:32 AM
So no idea how to fix the problem that my lil turtle friend digs in the wrong direction?

And again, da neverminds. Now it's giving me a "attempt to call nil" on line 129. My googling says that it's because the function turtleForward() is called later, but I took over the code exactly as it says in the first post of this thread, so it shouldn't be a problem if it wasn't a problem for you, right? :/
Deor #207
Posted 20 January 2013 - 06:09 AM
Does it matter if i change from coal to charcoal in the fuel chest halfway through?
Deor #208
Posted 20 January 2013 - 06:10 AM
BTW, i've run the resume script through a few more times without a problem, but not had cause to have it resume! I will try to test it out for you by using a non-chunkloader turtle and logging off or something.
Deor #209
Posted 20 January 2013 - 10:39 PM
Hate to post 3 in a row, but last night i tested the resume function. Once with me logging off for 5 minutes and once with the server restarting. Both time the turtle carried on fine, no GPS btw.
Kadura #210
Posted 21 January 2013 - 08:30 AM
I am still running version 0.53 of the program, and I am wondering whether in addition to chests in an abandoned mine, whether the turtle will pick up wood and railroad tracks. I hope it does both, as my turtles are about to encounter their first abandoned mine, and I would love to end up with all the railroad tracks.
Ulthean #211
Posted 21 January 2013 - 08:51 AM
I am still running version 0.53 of the program, and I am wondering whether in addition to chests in an abandoned mine, whether the turtle will pick up wood and railroad tracks. I hope it does both, as my turtles are about to encounter their first abandoned mine, and I would love to end up with all the railroad tracks.

Each track should have about a 66% chance to be picked up: When the turtle digs either on the same level as the tracks or the one above it, if the turtle digs the level below the tracks it will instead destroy the supporting block and the track will fall on the ground.
acters124 #212
Posted 21 January 2013 - 11:29 AM
umm austinkk can you make it be able to mine all the way to level 2?
I got a flat bedrock mod which makes the first level have bedrock while the rest wont. :)/>
Tricker12345 #213
Posted 21 January 2013 - 04:52 PM
I love this program so much! Props Austin for making it :D/> It's helped me a ton! Here's how much stuff i got from a 40x40 at level 15. Unfortunately, I tried to upgrade the chest I had sitting right there, and it crashed my game :wacko:/> and stopped the turtle part way through. I haven't had a chance to try out the code where you can resume yet, so I can't continue my quarry. Over all this program is amazing, keep up the good work Austin ^_^/>
Javatech #214
Posted 22 January 2013 - 08:35 AM
Why is the ability to dig between the bedrock tied to the chest looting feature? Can you tell me how to modify the code to always clear between the bedrock without having to always stick a chest in and losing valuable inventory space?
Deamonsol #215
Posted 22 January 2013 - 03:19 PM
okay just registed to see if i can find a solution

been using your script on a FTB server, and both of them end up never returning
im using lava buckets as fuel and have an extra one stored in thier chests. is my issue that im using lava buckets

also with the (resume one) i found one of my turtles picked him up and now it just constantly wants to resume which is great but i dont know how to turn him off to reset him


now ive gone through 4 turtles all wireless but im clueless about computercraft ive managed to find one by goin digging dieing about 6 times because it was in a lava lake gave up on the others and its to time consuming
Znubbis #216
Posted 23 January 2013 - 01:15 AM
okay just registed to see if i can find a solution

been using your script on a FTB server, and both of them end up never returning
im using lava buckets as fuel and have an extra one stored in thier chests. is my issue that im using lava buckets

also with the (resume one) i found one of my turtles picked him up and now it just constantly wants to resume which is great but i dont know how to turn him off to reset him


now ive gone through 4 turtles all wireless but im clueless about computercraft ive managed to find one by goin digging dieing about 6 times because it was in a lava lake gave up on the others and its to time consuming

I had problems with lava, try use coal or coke coal. I think it might have problems with the bucket.
Deamonsol #217
Posted 23 January 2013 - 03:41 AM
@Znubbis will try that out though I will have to build another damn turtle lol wish there was an easy way to wipe a turtles memory till I can figure it out I have one dud turtle just constantly trying to resume

The resume feature needs a 10sec window where you can enter a Y or N to resume or not and if nothing's entered it resumes.

Apart from the issues I've had the program is a nice one on the turtle I managed to salvage he had some iron and 7 diamonds.
Tricker12345 #218
Posted 23 January 2013 - 05:42 AM
@Znubbis will try that out though I will have to build another damn turtle lol wish there was an easy way to wipe a turtles memory till I can figure it out I have one dud turtle just constantly trying to resume

The resume feature needs a 10sec window where you can enter a Y or N to resume or not and if nothing's entered it resumes.

Apart from the issues I've had the program is a nice one on the turtle I managed to salvage he had some iron and 7 diamonds.

If you go to the turtle and terminate the program (ctrl + T), you should be fine. It will terminate the mining program and you can move it and start a new one :D/>
Deamonsol #219
Posted 23 January 2013 - 09:39 AM
If you go to the turtle and terminate the program (ctrl + T), you should be fine. It will terminate the mining program and you can move it and start a new one :D/>


thanks for the tip tho its not working, ive tried right clicking then ctrl+t, ctrl+t while pointing at it, shft+t, alt+t. nothing just wants to resume. i should probably mention that when i right click to see the cmd screen it just tells me its resuming and i cant type anything


i know im doing something wrong just cant figure out what it is lol
sjkeegs #220
Posted 23 January 2013 - 11:26 AM
thanks for the tip tho its not working, ive tried right clicking then ctrl+t, ctrl+t while pointing at it, shft+t, alt+t. nothing just wants to resume. i should probably mention that when i right click to see the cmd screen it just tells me its resuming and i cant type anything

You should be able to terminate the app by pressing ctrl-t - right click to open the screen and hold down ctrl-t for a second or so.

If that doesn't work then you should be able to delete the resume file from the turtles directory. I haven't looked at the code for the resume for this program, but it's probably saving a data file in the directory for the turtle. if you know the ID of the turtle you can find the directory and delete the file. The turtles directory would be under .minecraft/saves/worldName/computer/ID#. You should see this application and any other programs you have on that turtle, plus a data file with the resume data.
Deamonsol #221
Posted 23 January 2013 - 04:48 PM
thanks all yeah ctrl+t worked server was just laggin real bad

also i switched to coal and its working like a charm even when server goes down (tho is did mess up its resume location abit but hey with not using GPS its pretty damn awesome)
AustinKK #222
Posted 23 January 2013 - 11:31 PM
umm austinkk can you make it be able to mine all the way to level 2?
I got a flat bedrock mod which makes the first level have bedrock while the rest wont. :)/>

If you change the line at the top of the file that says:

local bottomLayer = 5

to


local bottomLayer = 2


then it will mine all the way down to level 2 before looking for bedrock. This will only work in your example (if this was a normal map where bedrock goes up to level 4, then the turtle would get stuck)
Znubbis #223
Posted 23 January 2013 - 11:35 PM
Can you add a option for a top level to mine so you can set it to mine up to a certain level?
AustinKK #224
Posted 23 January 2013 - 11:37 PM
I am still running version 0.53 of the program, and I am wondering whether in addition to chests in an abandoned mine, whether the turtle will pick up wood and railroad tracks. I hope it does both, as my turtles are about to encounter their first abandoned mine, and I would love to end up with all the railroad tracks.

It should do - those items do not match the noise blocks, therefore it will return them. The only time it will fail if is it digs the block beneath the rail track, in which case the track will pop off and not be picked up.
AustinKK #225
Posted 23 January 2013 - 11:38 PM
I love this program so much! Props Austin for making it :D/> It's helped me a ton! Here's how much stuff i got from a 40x40 at level 15. Unfortunately, I tried to upgrade the chest I had sitting right there, and it crashed my game :wacko:/> and stopped the turtle part way through. I haven't had a chance to try out the code where you can resume yet, so I can't continue my quarry. Over all this program is amazing, keep up the good work Austin ^_^/>


Thanks :D/>
AustinKK #226
Posted 23 January 2013 - 11:40 PM
Why is the ability to dig between the bedrock tied to the chest looting feature? Can you tell me how to modify the code to always clear between the bedrock without having to always stick a chest in and losing valuable inventory space?

Just because I'm trying to keep the configuration simple. When I started the program, I wanted to avoid having a complex setup, therefore there are only two modes, one which is dig everything like a quarry, one which is dig as much as you can in the time allowed.

Changing the code to do what you are asking is not a one-liner. You need to update the miningOffset to be 0, set looking for chests to false and probably some other changes that I haven't thought of.
AustinKK #227
Posted 24 January 2013 - 09:30 AM
okay just registed to see if i can find a solution

been using your script on a FTB server, and both of them end up never returning
im using lava buckets as fuel and have an extra one stored in thier chests. is my issue that im using lava buckets

also with the (resume one) i found one of my turtles picked him up and now it just constantly wants to resume which is great but i dont know how to turn him off to reset him


now ive gone through 4 turtles all wireless but im clueless about computercraft ive managed to find one by goin digging dieing about 6 times because it was in a lava lake gave up on the others and its to time consuming

I had problems with lava, try use coal or coke coal. I think it might have problems with the bucket.

Yes, the turtle doesn't currently support lava buckets I'm afraid.
AustinKK #228
Posted 24 January 2013 - 09:33 AM
thanks for the tip tho its not working, ive tried right clicking then ctrl+t, ctrl+t while pointing at it, shft+t, alt+t. nothing just wants to resume. i should probably mention that when i right click to see the cmd screen it just tells me its resuming and i cant type anything

You should be able to terminate the app by pressing ctrl-t - right click to open the screen and hold down ctrl-t for a second or so.

If that doesn't work then you should be able to delete the resume file from the turtles directory. I haven't looked at the code for the resume for this program, but it's probably saving a data file in the directory for the turtle. if you know the ID of the turtle you can find the directory and delete the file. The turtles directory would be under .minecraft/saves/worldName/computer/ID#. You should see this application and any other programs you have on that turtle, plus a data file with the resume data.

That's right, the turtle writes a number of files to the same directory as the program file is in. You can stop the turtle from resuming simply by deleting the startup file. All the other files will be overwritten when the turtle starts again (and the startup file will be automatically created).
AustinKK #229
Posted 24 January 2013 - 09:36 AM
Can you add a option for a top level to mine so you can set it to mine up to a certain level?

Yes, I've got this on the list of features that it would be good to add.
acters124 #230
Posted 24 January 2013 - 12:57 PM
umm austinkk can you make it be able to mine all the way to level 2?
I got a flat bedrock mod which makes the first level have bedrock while the rest wont. :)/>

If you change the line at the top of the file that says:

local bottomLayer = 5

to


local bottomLayer = 2


then it will mine all the way down to level 2 before looking for bedrock. This will only work in your example (if this was a normal map where bedrock goes up to level 4, then the turtle would get stuck)
Thanks! :D/>
I thought you didn't notice( :ph34r:/>) my post. :P/>
AustinKK #231
Posted 25 January 2013 - 11:31 AM
umm austinkk can you make it be able to mine all the way to level 2?
I got a flat bedrock mod which makes the first level have bedrock while the rest wont. :)/>

If you change the line at the top of the file that says:

local bottomLayer = 5

to


local bottomLayer = 2


then it will mine all the way down to level 2 before looking for bedrock. This will only work in your example (if this was a normal map where bedrock goes up to level 4, then the turtle would get stuck)
Thanks! :D/>
I thought you didn't notice( :ph34r:/>) my post. :P/>

Sorry, been busy working.

Need to get my priorities straight don't I!! B)/>
Philderbeast #232
Posted 26 January 2013 - 12:47 AM
gave the resumeable quarry a go tonight, and it worked perfect;y over a few resumes, nice work!
Kylun #233
Posted 26 January 2013 - 12:30 PM
I used the resumable feature myself recently, and it worked fine for about 2 RL days (I was mining 64x64). Then for some reason my game locked up like 3 times in a row, and it got off by 2 on one of the axes, screwing up everything. I was able to use "go" to put the turtle back to where it thought it was and fix the issue, but I really think the turtle should use some sort of GPS fallback. Do you have this code on github anywhere? Maybe some people with skill in programming could help contribute to it? I have a few ideas i'd like to implement myself as soon as I'm done working on my other CC project.
Kylun #234
Posted 26 January 2013 - 12:32 PM
Also, out of curiosity, AustinKK, what do you do with your stripped levels after you are done? it would be nice/neat to backfill or torch the area, so that monsters dont spawn. I made the mistake of running this 10 levels below my base, and now I have tons of spiders and other monster spawns in mined-out areas.
uecasm #235
Posted 27 January 2013 - 02:26 AM
I've been using version 0.6 (with resume), and it's been working great for a while, but recently the turtle got completely stuck with an error "Too long without yielding".

I added a counter to the resume function so that it would do a "sleep(1)" after every 500 moves, and that seems to have sorted it out, though it takes a while for it to get started. (I didn't try other values, so this can probably be set much higher.) Might be worthwhile adding something like this to the standard program.
Webern #236
Posted 27 January 2013 - 04:50 AM
Do you think it would be doable to convert this to cc 1.3?
OmagaIII #237
Posted 27 January 2013 - 06:55 AM
Hey guys, need some help please.

I have a weird issue. I am currently running my own server on the FTB Direwolf20 pack. Everything works well, except for this program it seems. If I build a turtle and release it in to the wild it works all good and well, however, the minute that a second turtle is created and placed else where in the world and we run the orequarry app, they dig down to bedrock, and then all turtles just stop. No error, no nothing. Almost like they rebooted, as if the program never ran to start with.

We did not leave the server or reboot the server. It has now been active for over 5 hours. 1 turtle on this program is fine, the minute a second one is running this app, all turtles using it stops. Please help if you guys can?

Regards,
OmagaIII
thatirishguy #238
Posted 27 January 2013 - 06:08 PM
Stuff

Regards,
OmagaIII

just to check, they are named differently, under "label set [name]" right?
Gomun #239
Posted 30 January 2013 - 02:28 AM
Are there any plans on adding specified layers mining? Let's say I wanted to mine out the diamond layers only, or the copper layers etc. Guess I could change the bottomLayer to whatever is the lowest for the ores that I want, but then it wouldnt stop when it has mined past it. or I guess it would if I start the turtle at the top layer of the ore. Still, it would be a nice feature.
sjkeegs #240
Posted 30 January 2013 - 04:42 AM
Stuff

Regards,
OmagaIII

just to check, they are named differently, under "label set [name]" right?
What should that have to do with the issue that OmagaIII posted about? The turtles should be independent even if the labels aren't set.
Simon_Bitdiddle #241
Posted 30 January 2013 - 05:59 AM
As opposed to relying on GPS and/or manual input for the turtle's height, why not set it automatically by the depth that the turtle digs down before it hits bedrock?
Ethkl #242
Posted 31 January 2013 - 07:58 AM
As opposed to relying on GPS and/or manual input for the turtle's height, why not set it automatically by the depth that the turtle digs down before it hits bedrock?

Im guessing because bedrock varies in depth. If it managed to hit the lowest spot at 2, it then would break the program when it ran into more bedrock at 3.
Ethkl #243
Posted 31 January 2013 - 08:02 AM
Also, out of curiosity, AustinKK, what do you do with your stripped levels after you are done? it would be nice/neat to backfill or torch the area, so that monsters dont spawn. I made the mistake of running this 10 levels below my base, and now I have tons of spiders and other monster spawns in mined-out areas.

I would love this feature as well. At the end of the day I wonder if mining this way is better or worse for server performance. If you have a large enough aria and it is full of monsters, wouldn't it start adding to server load?
Ethkl #244
Posted 31 January 2013 - 08:33 AM
okay just registed to see if i can find a solution

been using your script on a FTB server, and both of them end up never returning
im using lava buckets as fuel and have an extra one stored in thier chests. is my issue that im using lava buckets

also with the (resume one) i found one of my turtles picked him up and now it just constantly wants to resume which is great but i dont know how to turn him off to reset him


now ive gone through 4 turtles all wireless but im clueless about computercraft ive managed to find one by goin digging dieing about 6 times because it was in a lava lake gave up on the others and its to time consuming

I had problems with lava, try use coal or coke coal. I think it might have problems with the bucket.
There are 2 reasons you cant use lava as an auto fill source of power.
  1. Buckets and lava buckets are considered different objects and can not be stacked.
  2. Lava buckets can not be stacked.
The system refills the fuel source from the chest each time it returns to the surface. It simply refills the stack in slot 16. No stack, no refill.

Here is my solution. I preload my turtles with about 16k fuel before mining begins. Here is what you need to do.
  1. Name Turtles - You need to name a turtle inorder for it to maintain fuel levels and any custom programing when you pick it up (pick axe). The script is "label set" and then enter the name you want.
  2. Lava - You will need a large source of lava, the nether works, but it helps to have it in a tank for speed.
  3. 16 buckets - Place 16 full lava buckets in the turtle. This is the max number that will fit in your turtle
  4. Refuel - The turtle has a handy "refuel all" program. It will gather all the lava from the buckets and then tell you how much fuel it has. When done remove the buckets.
  5. Prep for Mining - Now that you have fueled them, you can relocate them to wherever you wish to mine. I place one stack of coal in the turtle and one in the chest as a backup. I use coal since as the turtle is mining it has the potential to refill its own resource.

My current setup is 4 turtles running 20x20 (40x40 total) all backed up to an Ender chest that is emptied and sorted back at base. On average, starting at level 65, they burn through roughly 10000 F. Thats 40000 F per quarry or about 512 coal (8 stacks) or 40 lava buckets. That said, since I am constantly over filling they often are full enough that I may not even need to refuel between quarries.

It really comes down to which is more valuable to you. I dont have a ready supply of either coal or charcoal at the moment. But lava I have lots of.

Hope that is helpful.
ShuiDan #245
Posted 31 January 2013 - 06:45 PM
I always wondered how much power a turtle could hold :)/> Hooked one up to the charging station and also filled with lava, let is sit for hours. It was still taking on power at 450,000. That's right 450k. Anyone know what the upper limit is ?

Oh yea, wanted to post my turtle stopped for the first time today. The only thing I did differently was go to the nether while it was running. Yes it has a chunk loader, used the World Anchor.
Macondo #246
Posted 02 February 2013 - 06:51 AM
I have run the program a few times and my turtle keeps getting stuck at bedrock, it just idles there and all I can do is pick it up and re-run it somewhere else. Any ideas as to what could be wrong or what I can do to avoid this problem? thanks
Ethkl #247
Posted 02 February 2013 - 07:20 AM
I have run the program a few times and my turtle keeps getting stuck at bedrock, it just idles there and all I can do is pick it up and re-run it somewhere else. Any ideas as to what could be wrong or what I can do to avoid this problem? thanks

Can you describe your turtle setup (items, fuel, chests, GPS)? Are you staying with the turtle (same general aria)? Are you using a chunk loader?
shiphorns #248
Posted 02 February 2013 - 09:00 AM
There are 2 reasons you cant use lava as an auto fill source of power.
  1. Buckets and lava buckets are considered different objects and can not be stacked.
  2. Lava buckets can not be stacked.

I also play on FTB, and fill my lava into cells instead of buckets, so that I can stack 64 in the turtle. Making cells consumes Tin, but the convenience is worth it, and the turtle is going to find more tin so it pretty much pays for itself. To make lava cells you just hold the empty cell in your hand and right click on a lava pool. This is a lot less work than crafting them from lava buckets–just go to the nether, and click away with a full stack of cells in your hotbar.
Ethkl #249
Posted 02 February 2013 - 09:41 AM
Nice,
There are 2 reasons you cant use lava as an auto fill source of power.
  1. Buckets and lava buckets are considered different objects and can not be stacked.
  2. Lava buckets can not be stacked.

I also play on FTB, and fill my lava into cells instead of buckets, so that I can stack 64 in the turtle. Making cells consumes Tin, but the convenience is worth it, and the turtle is going to find more tin so it pretty much pays for itself. To make lava cells you just hold the empty cell in your hand and right click on a lava pool. This is a lot less work than crafting them from lava buckets–just go to the nether, and click away with a full stack of cells in your hotbar.
Nice, this should also work in place of coal. Do you know how much fuel you get from one lava cell? I'd be curios to do the math and see how much fuel it takes to make one vs how much you get out of it.
ShuiDan #250
Posted 02 February 2013 - 02:54 PM
It’s not the nether, I will continue to investigate. Had to do a turtle rescue, after pumping out the lava he was pretty easy to find.

Just tried aluminum cans of lava instead of tin cans, they work just fine to refuel a turtle. 1000 units of power, like a bucket of lava.
MacDaddyPro #251
Posted 03 February 2013 - 05:13 AM
Austin KK!

Just want to say thanks for this!

It rocks! YEAH BABY!!!!!!

B)/>
Macondo #252
Posted 03 February 2013 - 04:34 PM
I have run the program a few times and my turtle keeps getting stuck at bedrock, it just idles there and all I can do is pick it up and re-run it somewhere else. Any ideas as to what could be wrong or what I can do to avoid this problem? thanks

Can you describe your turtle setup (items, fuel, chests, GPS)? Are you staying with the turtle (same general aria)? Are you using a chunk loader?

I got it to finally come back to the chests and unload after resetting the server, however it is still returning cobblestone and dirt. I set it up just like on the video and I am standing on the same spot. There is no chunk loader.

Thanks for the help!
AustinKK #253
Posted 05 February 2013 - 02:53 AM
gave the resumeable quarry a go tonight, and it worked perfect;y over a few resumes, nice work!

Phew! :D/>
AustinKK #254
Posted 05 February 2013 - 02:54 AM
Also, out of curiosity, AustinKK, what do you do with your stripped levels after you are done? it would be nice/neat to backfill or torch the area, so that monsters dont spawn. I made the mistake of running this 10 levels below my base, and now I have tons of spiders and other monster spawns in mined-out areas.

I do nothing with them at the moment. I did consider lighting them up, but for now they are left empty
AustinKK #255
Posted 05 February 2013 - 02:57 AM
Do you think it would be doable to convert this to cc 1.3?

Not planned. Why are you using an old version?

Are there any plans on adding specified layers mining? Let's say I wanted to mine out the diamond layers only, or the copper layers etc. Guess I could change the bottomLayer to whatever is the lowest for the ores that I want, but then it wouldnt stop when it has mined past it. or I guess it would if I start the turtle at the top layer of the ore. Still, it would be a nice feature.

This has been requested in various forms a few times, so yes, I plan to look into it
AustinKK #256
Posted 05 February 2013 - 02:58 AM
As opposed to relying on GPS and/or manual input for the turtle's height, why not set it automatically by the depth that the turtle digs down before it hits bedrock?

Because it depends which bit of bedrock it hits (it can be at level 1-5). To search around for the top of the bedrock would be time consuming, and in my opinion unnecessary given that you can just tell it where it is starting from
theoriginalbit #257
Posted 05 February 2013 - 03:05 AM
-snip-
-snip-
-snip-
-snip-
Wow… just wow… Maybe use MultiQuote or edit? o.O
AustinKK #258
Posted 05 February 2013 - 03:16 AM
I have run the program a few times and my turtle keeps getting stuck at bedrock, it just idles there and all I can do is pick it up and re-run it somewhere else. Any ideas as to what could be wrong or what I can do to avoid this problem? thanks

Can you describe your turtle setup (items, fuel, chests, GPS)? Are you staying with the turtle (same general aria)? Are you using a chunk loader?

I got it to finally come back to the chests and unload after resetting the server, however it is still returning cobblestone and dirt. I set it up just like on the video and I am standing on the same spot. There is no chunk loader.

Thanks for the help!

It will always return some cobble and dirt because it needs to dig out the layers. As long as its not digging out the entire area, then I'm sure its fine.
Permutation #259
Posted 05 February 2013 - 09:02 AM
Thanks for all the work on this script. Please add my name to those who would like to see a cap on the max height this would mine. I'd like to leave the top 3 or 4 layers pristine as opposed to having layers or odd blocks that appear to be floating on air. (In other words, if I set the start level at 62, the turtle will mine to 58, or so, then complete its task.)

Thanks again.
ShuiDan #260
Posted 05 February 2013 - 01:53 PM
Finally tracked down my issue with the turtle stopping. I had to many chunk loaders running so when the turtle started mining there was no room for its chunk loader. In other words it is equipped with a chunk loader but it was not working because I was already maxed on chunk loaders. I took down the 2 chunk loaders out by the tree farms, the turtle is good to go now.

This has me thinking about base design and efficient use of chunk space. Not straddling chunks but being within chunk boundaries. Also vertical building. These sorts of design steps would greatly reduce how many chunks need to be kept loaded.
A quick way to check if a turtle chunk loader is working, run tunnel 5, if the chunk loader is not working there will be a red line around the chunk loader on the side of the turtle.

I could have changed config files to allow for more chunks but my computer is a little underpowered as it is.
roflstein #261
Posted 06 February 2013 - 02:54 AM
dont hate me if my question is stupid… Is this going to work with Computercraft 1.481 on a FTB server?
themiker384 #262
Posted 06 February 2013 - 07:35 PM
For some reason I put the chests in the second to last slot and when my turtles are done, the chest has disappeared from it's inventory. Why is this?
roflstein #263
Posted 07 February 2013 - 06:31 AM
okay, I just tried the program, and I typed 'OreQuarry 8 75' and it responded with "Mining Layer: 6" and then it just went down to layer 6… Why? :o/>
Gomun #264
Posted 07 February 2013 - 07:34 AM
okay, I just tried the program, and I typed 'OreQuarry 8 75' and it responded with "Mining Layer: 6" and then it just went down to layer 6… Why? :o/>
it starts mining from the bottom. gets you all the good stuff first
Simon_Bitdiddle #265
Posted 08 February 2013 - 05:17 AM
Found a little bug that relates to servers which are set to not require fueling for turtles; moveTo() attempts to compare turtle.getFuelLevel() to the amount of fuel needed but if getFuelLevel() returns "unlimited", the script dies.

I wrapped an 'if not' around each time this gets called that checks to see if getFuelLevel is a string.
theoriginalbit #266
Posted 08 February 2013 - 05:48 AM
I wrapped an 'if not' around each time this gets called that checks to see if getFuelLevel is a string.
Alternatively instead of doing that a checkFuel() function could be added, means if any changes are made in the future it will be nice and easy to change.
AustinKK #267
Posted 08 February 2013 - 06:30 AM
:D/> lol - I'll give it a try…

I have run the program a few times and my turtle keeps getting stuck at bedrock, it just idles there and all I can do is pick it up and re-run it somewhere else. Any ideas as to what could be wrong or what I can do to avoid this problem? thanks

Can you describe your turtle setup (items, fuel, chests, GPS)? Are you staying with the turtle (same general aria)? Are you using a chunk loader?

I got it to finally come back to the chests and unload after resetting the server, however it is still returning cobblestone and dirt. I set it up just like on the video and I am standing on the same spot. There is no chunk loader.

Thanks for the help!

It will always return some cobble and dirt because it needs to dig out the layers. As long as its not digging out the entire area, then I'm sure its fine.
Thanks for all the work on this script. Please add my name to those who would like to see a cap on the max height this would mine. I'd like to leave the top 3 or 4 layers pristine as opposed to having layers or odd blocks that appear to be floating on air. (In other words, if I set the start level at 62, the turtle will mine to 58, or so, then complete its task.)

Thanks again.
Looks like I'm not going to get away with not making this change for much longer. I was hoping for some feedback on whether the turtle with resume was working correctly before adding this. I guess no news is good news, so I'll work on this.


Finally tracked down my issue with the turtle stopping. I had to many chunk loaders running so when the turtle started mining there was no room for its chunk loader. In other words it is equipped with a chunk loader but it was not working because I was already maxed on chunk loaders. I took down the 2 chunk loaders out by the tree farms, the turtle is good to go now.

This has me thinking about base design and efficient use of chunk space. Not straddling chunks but being within chunk boundaries. Also vertical building. These sorts of design steps would greatly reduce how many chunks need to be kept loaded.
A quick way to check if a turtle chunk loader is working, run tunnel 5, if the chunk loader is not working there will be a red line around the chunk loader on the side of the turtle.

I could have changed config files to allow for more chunks but my computer is a little underpowered as it is.
Sorry, not with you. What's the problem with the chunk loading??
Cozzimoto #268
Posted 08 February 2013 - 06:48 AM
my quick question to you AustinKK is how do you resume a turtle if you left and the chunk unloaded or say your game crashed or server restarted??
Minithra #269
Posted 08 February 2013 - 08:21 PM
Using this on a FTB Server, tried using it in the Twilight Forest. It said went all the way down to level 5, then stopped. There are a couple of mobs above it. Will killing them and restarting the turtle work? Or did it stop due to something else?
Znubbis #270
Posted 08 February 2013 - 10:53 PM
Using this on a FTB Server, tried using it in the Twilight Forest. It said went all the way down to level 5, then stopped. There are a couple of mobs above it. Will killing them and restarting the turtle work? Or did it stop due to something else?

Did you use the beta resume code? if not you need to use a chunkloader if you had one i'm not sure why it stopped.
Minithra #271
Posted 09 February 2013 - 08:18 AM
Did you use the beta resume code? if not you need to use a chunkloader if you had one i'm not sure why it stopped.

I was there while it was working. It just dug down, didn't even reach y=5, then stopped. I was almost above it, so it didn't unload. Only thing I can think of is the odd blocks, or the mobs. Would getting rid of the mobs make it work next time?
Cozzimoto #272
Posted 09 February 2013 - 08:59 AM
are you sure you had enough fuel?
Kaidenyo #273
Posted 09 February 2013 - 09:16 AM
Hey Austin,
I just registered to thank you so much for that program. Im using it a while now and it is just such a great tool for every game stage. I built a quarry and went back to using just more turtles with your program, so good.

One question tho, I switched to a whitelisted private server and every restart those turtles just stop at the location they had before the restart. Is there a way to remotely start them up again ?
rik #274
Posted 09 February 2013 - 10:19 AM
Hi Austin, fellow Leeds-ian here :)/>

For reasons unknown to me, the turtle stops whenever no-one is online on the server, even though there is a chunk loader up and running at ground level that covers the entire x and z. It's currently about half way through mining out a 25x25 and just sat there. Is there a way to restart it from where it is and it continue doing its thang or is it properly broken and needs putting back at the start? :(/>

Is there a way for it to always run even if no-one is online? It runs just fine when no-one is near it but online on the server, it just stops when no-one is online. For reference we don't have GPS and configured the Y value manually.

When it works it works brilliantly and as it's my first venture with turtles I rather like it :lol:/> .

TIA.
Minithra #275
Posted 09 February 2013 - 01:15 PM
are you sure you had enough fuel?

A stack of charcoal, yes. It went maybe 10 blocks down, maybe less.
OmagaIII #276
Posted 09 February 2013 - 11:15 PM
Good Day,

I am using the beta v6 code with resume. I keep getting the 'Too long without yielding' error. Can someone please advise me where to place a sleep() function or something to prevent this from stopping my turtle every 10min and having to restart the whole mining process again. Also, with this error the turtle cannot resume at all, it gives me an error when trying to resume s well.

Thanks
Minithra #277
Posted 10 February 2013 - 09:58 AM
are you sure you had enough fuel?

A stack of charcoal, yes. It went maybe 10 blocks down, maybe less.

Found the issue! My luck, I found the bedrock box of the second level of the Maze in Twilight Forest. The turtle kept trying to mine the bedrock. Perhaps a bedrock check can be added? Or if it doesn't break, move on?
rik #278
Posted 10 February 2013 - 10:27 AM
Does the author still read this thread? :(/>
Aeolun #279
Posted 10 February 2013 - 07:55 PM
Does the author still read this thread? :(/>

I assume he does, he replied just 2 days ago.

As to your problem, do you use the 0.6 version, or the 0.53 version? I'm thinking the 0.6 version should continue regardless of what happens in regards to players or chunkloaders, the link is hidden somewhere within the thread though, not the one in the first post (here: http://pastebin.com/TRtdTB19).

Another reason it could stop is being out of fuel. It'll just give up and stop, you should see messages though.

Perhaps a bedrock check can be added? Or if it doesn't break, move on?

I believe it is impossible to distinguish bedrock from any other block unless you have the block in your inventory. That said, it should be possible to just have it continue after x tries (assuming this is a block 'under' the turtle, if it's in front it obviously cannot continue). I'm fairly certain this situation should not happen unless you give the turtle an incorrect y at the beginning though.

I switched to a whitelisted private server and every restart those turtles just stop at the location they had before the restart. Is there a way to remotely start them up again ?

See the script above, it's no remote restart, but they should restart on their own as soon as the server comes up again (and the chunk is loaded).
rik #280
Posted 11 February 2013 - 03:58 AM
Does the author still read this thread? :(/>

I assume he does, he replied just 2 days ago.

As to your problem, do you use the 0.6 version, or the 0.53 version? I'm thinking the 0.6 version should continue regardless of what happens in regards to players or chunkloaders, the link is hidden somewhere within the thread though, not the one in the first post (here: http://pastebin.com/TRtdTB19).

Another reason it could stop is being out of fuel. It'll just give up and stop, you should see messages though.

Hi, thanks. Not sure which version it is, but I am playing FTB DW20 latest version (v5.0.1) if that helps you. There is plenty of coal still in the chest so I don't think it was out of fuel. When I open the turtle it just says the usual TurtleOS line and nothing else. But is there a way to resume it from where it's stopped rather than have to restart it from the surface again? That it more important at the moment.
Mav #281
Posted 12 February 2013 - 12:26 AM
it would be good if there was an option for the turtle to drop the cobblestone, which would also reduce a lost of congestion in the machines inventory.

PS really great program, thanks!
PaidLeber #282
Posted 14 February 2013 - 01:14 PM
Has anyone been able to mine a 64x64 block quarry with a 5x5 chunk loader? I can complete 8x8,16x16,32x32 no problem, but my turtle will reset itself halfway through layer 5 on a 64x64 quarry.

I'm still using v0.53 however. I'll first try adjusting my forgeChunkLoading.cfg.. but if anyone had similiar issues, a tip would be appreciated.

Edit: Was my chunkloader "chickenchunks" will try railcraft loader.
AustinKK #283
Posted 15 February 2013 - 05:05 AM
Hey Austin,
I just registered to thank you so much for that program. Im using it a while now and it is just such a great tool for every game stage. I built a quarry and went back to using just more turtles with your program, so good.

One question tho, I switched to a whitelisted private server and every restart those turtles just stop at the location they had before the restart. Is there a way to remotely start them up again ?
Not remotely. If you use the beta version 0.6, then it should auto-resume, but it's still in beta so might not work every time.

Hi Austin, fellow Leeds-ian here :)/>

For reasons unknown to me, the turtle stops whenever no-one is online on the server, even though there is a chunk loader up and running at ground level that covers the entire x and z. It's currently about half way through mining out a 25x25 and just sat there. Is there a way to restart it from where it is and it continue doing its thang or is it properly broken and needs putting back at the start? :(/>

Is there a way for it to always run even if no-one is online? It runs just fine when no-one is near it but online on the server, it just stops when no-one is online. For reference we don't have GPS and configured the Y value manually.

When it works it works brilliantly and as it's my first venture with turtles I rather like it :lol:/> .

TIA.
I think the term for us is "Loiners"!

Not sure about it not running when no-ones online. I'm playing on a server too, and I log off and when I come back the turtle's have finished. Stupid question, but I assume that the server is still running when there are no connections?

are you sure you had enough fuel?

A stack of charcoal, yes. It went maybe 10 blocks down, maybe less.

Found the issue! My luck, I found the bedrock box of the second level of the Maze in Twilight Forest. The turtle kept trying to mine the bedrock. Perhaps a bedrock check can be added? Or if it doesn't break, move on?

What level does bedrock start at in the twilight forest?

Does the author still read this thread? :(/>
Yes, still here! :D/>

Does the author still read this thread? :(/>

I assume he does, he replied just 2 days ago.

As to your problem, do you use the 0.6 version, or the 0.53 version? I'm thinking the 0.6 version should continue regardless of what happens in regards to players or chunkloaders, the link is hidden somewhere within the thread though, not the one in the first post (here: http://pastebin.com/TRtdTB19).

Another reason it could stop is being out of fuel. It'll just give up and stop, you should see messages though.

Hi, thanks. Not sure which version it is, but I am playing FTB DW20 latest version (v5.0.1) if that helps you. There is plenty of coal still in the chest so I don't think it was out of fuel. When I open the turtle it just says the usual TurtleOS line and nothing else. But is there a way to resume it from where it's stopped rather than have to restart it from the surface again? That it more important at the moment.
it would be good if there was an option for the turtle to drop the cobblestone, which would also reduce a lost of congestion in the machines inventory.

PS really great program, thanks!
A couple of people have asked for that. It's on my list, but below adding things like the ability to only mine certain layers and any fixes I need to do to the auto-resume code
Minithra #284
Posted 15 February 2013 - 05:30 AM
Found the issue! My luck, I found the bedrock box of the second level of the Maze in Twilight Forest. The turtle kept trying to mine the bedrock. Perhaps a bedrock check can be added? Or if it doesn't break, move on?

What level does bedrock start at in the twilight forest?

It's still 0-5 like in the overworld. But in the twilight forest, the Mazes have a second level that's encased in a box of bedrock. I think the height depends, the one I found covered from 9-16. I didn't use a gps, so I gave the turtle the coords, it told me it was going down to level 5… and got stopped when it hit bedrock ten layers early :D/>
PhilHibbs #285
Posted 15 February 2013 - 05:56 AM
I had a minor problem the other day, I generated a "flat" Mystcraft world and discovered that the bedrock is also flat. So I just lied to the turtle about which level it was starting from, I think I added 5 to the Y-level. I might modify the code to allow a third parameter for Target Y-Level, as I usually lie by 1 anyway so that it just skims over the surface of the highest bedrock and gets slightly more ores than the default.
AustinKK #286
Posted 15 February 2013 - 10:37 AM
Found the issue! My luck, I found the bedrock box of the second level of the Maze in Twilight Forest. The turtle kept trying to mine the bedrock. Perhaps a bedrock check can be added? Or if it doesn't break, move on?

What level does bedrock start at in the twilight forest?

It's still 0-5 like in the overworld. But in the twilight forest, the Mazes have a second level that's encased in a box of bedrock. I think the height depends, the one I found covered from 9-16. I didn't use a gps, so I gave the turtle the coords, it told me it was going down to level 5… and got stopped when it hit bedrock ten layers early :D/>

Hmm, I see the problem - I'll add it to the list of enhancements (I haven't added anything in a while though - been too busy working…)
AustinKK #287
Posted 15 February 2013 - 10:41 AM
If anyone's interested, the script has been downloaded about 7,500 (if you include both the normal and beta version with resume).

Some of those downloads are me ( :D/>), but just wanted to say thanks for the support. I wasn't sure whether to post the script in the first place as I was expecting to receive a mixture of flaming and trolling, but this Forum seems to be full of a really friendly bunch.

Maybe it's just because it's Valentine's Day :wub:/>
Cozzimoto #288
Posted 15 February 2013 - 02:03 PM
yea we are all here to help. and i love the program you made, it really is one of a kind. you may have started a new kind of standard for mining programs out there. =)
PaidLeber #289
Posted 16 February 2013 - 01:58 PM
The coding is well done also. Good work.
rik #290
Posted 17 February 2013 - 05:37 PM
@ Austin, yes the server still runs when no-one is online, but the original pastebin in your OP doesn't auto resume unfortunately. However the pastebin pasted by aeolun on the previous page works great and I deliberately stopped and restarted the server to test it. The turtle carried on when it had stopped and completed its job.
Madster #291
Posted 17 February 2013 - 06:55 PM
Nice program
gabriel209 #292
Posted 18 February 2013 - 12:10 AM
So for some reason I cannot download the program from pastebin. Every time I try it comes back with "connecting to pastebin.com… Failed" Any ideas?
AustinKK #293
Posted 19 February 2013 - 01:11 AM
So for some reason I cannot download the program from pastebin. Every time I try it comes back with "connecting to pastebin.com… Failed" Any ideas?

You need to enable http. This is done in the computercraft config file, so if you are on a server, you will need your admin to do it for you.
gabriel209 #294
Posted 19 February 2013 - 02:30 PM
So for some reason I cannot download the program from pastebin. Every time I try it comes back with "connecting to pastebin.com… Failed" Any ideas?

You need to enable http. This is done in the computercraft config file, so if you are on a server, you will need your admin to do it for you.

Actually I did enable it and it is still giving me the error message. Im able to download other programs from pastebin without problem… Hmmm…
fentiger #295
Posted 20 February 2013 - 11:52 AM
Hi there 1st off I love your program since I introduced it on my friends server it has replaced quarries altogether Recently I have come across a problem when setting up a turtle to run I get a error message reading "rednet:17: no modem on right side" any idea what could be causing this
Cozzimoto #296
Posted 20 February 2013 - 12:55 PM
you need wireless mining turtles, and it is throwing an error because the program is trying to wrap/open a modem that is not there if you are using just a standard mining turtle without a modem attached to it/
Dekken #297
Posted 23 February 2013 - 05:56 AM
My turtles keep going out of fuel for no reason.
I put fuel in the last slot, one block in the first, and a chest full of charcoal on the left side of the turtle.
I always have to go down and find them because they either run out of fuel, or just get stuck.
I tried running them with a chunk loader, still the same.
Any ideas? running Mindcrack.
Shredus #298
Posted 24 February 2013 - 05:10 PM
Great program! Successfully used it for a 8x8 and 32x32 and 16x16 however this morning, i tried another 16x16 it just went straight down to bedrock and stops there with the turtle inventory GUI working up - selection jumps rapidly around and randomly -
with a text ' Mining Layer 5 ' and that's it. Just sits there on bedrock :o/> Any clue??
AustinKK #299
Posted 24 February 2013 - 10:13 PM
you need wireless mining turtles, and it is throwing an error because the program is trying to wrap/open a modem that is not there if you are using just a standard mining turtle without a modem attached to it/

You shouldn't need a wireless turtle. Weird.

Can you confirm your setup?
AustinKK #300
Posted 24 February 2013 - 10:14 PM
My turtles keep going out of fuel for no reason.
I put fuel in the last slot, one block in the first, and a chest full of charcoal on the left side of the turtle.
I always have to go down and find them because they either run out of fuel, or just get stuck.
I tried running them with a chunk loader, still the same.
Any ideas? running Mindcrack.
Not sure, I run using Mindcrack and it works fine. Maybe upload a video showing the problem!?

Great program! Successfully used it for a 8x8 and 32x32 and 16x16 however this morning, i tried another 16x16 it just went straight down to bedrock and stops there with the turtle inventory GUI working up - selection jumps rapidly around and randomly -
with a text ' Mining Layer 5 ' and that's it. Just sits there on bedrock :o/> Any clue??
Sounds to me like you specified the starting height as 1 lower than the actual value. Can you check?
Shredus #301
Posted 25 February 2013 - 02:38 AM
You shouldn't need a wireless turtle. Weird. Can you confirm your setup?
If you do not use a wireless mining turtle, you'll get the rednet:17 error. :/

Sounds to me like you specified the starting height as 1 lower than the actual value. Can you check?

And i think that's my mistake, i'll have to go try tomorrow morning! Thanks for your response ;)/>
Kotawolf #302
Posted 25 February 2013 - 08:11 AM
If you do use the wireless turtle (converted mine cause, I was getting the error also, just downloaded the program via the pastebin get command)…
I get..
"Can't locate GPS"
Dekken #303
Posted 25 February 2013 - 09:20 AM
My turtles keep going out of fuel for no reason.
I put fuel in the last slot, one block in the first, and a chest full of charcoal on the left side of the turtle.
I always have to go down and find them because they either run out of fuel, or just get stuck.
I tried running them with a chunk loader, still the same.
Any ideas? running Mindcrack.
Not sure, I run using Mindcrack and it works fine. Maybe upload a video showing the problem!?
I will try.
But it just goes out of fuel for no reason, not much to video here?
Does it have anything to do with too large quarries? is there a limit?
Can I edit the code to make the turtle refuel more often or something like that?
Prehensile #304
Posted 25 February 2013 - 10:12 PM
Running a turtle with the program as I type, and it works! Thanks AustinKK for releasing it.

Regarding optimizing the speed of the turtle, would it be possible to to do (left and right blocks) or (only left block) or (only right block) checks so that the turtle doesn't have to mine every single row/column and instead skip every other, or every other two rows/columns? This could potentially not only reduce the amount of time spent mining, but also reduce the number of trips taken on the way up, due to the fact that less blocks are mined as a whole.

Edit: I realize now after reading more threads that you have larger priorities than pure optimization. Keep up the good work!
Hawkertech #305
Posted 26 February 2013 - 12:55 PM
I get the rednet error also it is turtle os 1.5
Shadow_Assailant #306
Posted 27 February 2013 - 05:45 PM
Any chance we can get a function that will not allow a turtle destroy another turtle under any circumstance? I've been running a 48x16 setup (3 turtles in a row running 16x16 with enough space in between so they don't intersect, yet I keep losing Turtles. I've lost 3 already. The awkward part is, though, that I don't lose any until they are just about done with the quarry.
unobtanium #307
Posted 28 February 2013 - 01:02 AM
I cant watch the video, because of the music it is used in it :(/>
leftler #308
Posted 28 February 2013 - 03:24 PM
I really love the program, I saw that you are working on a auto resume a few weeks ago, I was just wondering if it was still being planned on being added in?
Minithra #309
Posted 01 March 2013 - 05:48 PM
I really love the program, I saw that you are working on a auto resume a few weeks ago, I was just wondering if it was still being planned on being added in?

The resume exists, the link is in the thread somewhere.

And speaking of that, there's a problem with it. How do I stop it? If I want to move the turtle without letting it finish or such. Because not even changing worlds did it. And every time I place it, it starts mining. I have it flying through air now to let it finish, but for the future? Terminate stops it only until the area reloads, reboot doesn't even make it stutter.
NightKev #310
Posted 02 March 2013 - 07:41 AM
Delete "startup".
SCDoGo #311
Posted 02 March 2013 - 07:47 PM
I love the program, and signed up just to help the project by reporting this bug and fix. In a server I play on the bedrock generation starts at level 0 and has occasional spaces at y-level 1 which can be dug to. If detectDown is performed from such a spot it returns false, even though there is bedrock underneath. This leaves the turtle in an endless attackDown loop as it thinks there is a mob blocking its path (no seen block in the way and can't moveDown). To fix the issue I changed line 1360 from:

while (moveDownSuccess == true) do

to

while ((moveDownSuccess == true) and (currY > 1)) do

This alleviated the problem.
leftler #312
Posted 03 March 2013 - 05:30 PM
I really love the program, I saw that you are working on a auto resume a few weeks ago, I was just wondering if it was still being planned on being added in?

The resume exists, the link is in the thread somewhere.

And speaking of that, there's a problem with it. How do I stop it? If I want to move the turtle without letting it finish or such. Because not even changing worlds did it. And every time I place it, it starts mining. I have it flying through air now to let it finish, but for the future? Terminate stops it only until the area reloads, reboot doesn't even make it stutter.

I will return the favor, I use a remote shell like nsh to run the quarry (set to start with startup in case the turtle gets unloaded), I can then tell the turtle to stop, I also modified my script to save the X Y Z at startup then from nsh I can run another program that makes my turtle go to the starting X Z then go up to the starting Y.
OmagaIII #313
Posted 04 March 2013 - 04:55 AM
Since no one has answered me in weeks…

I am using the beta v0.6 and keep getting "Too long without yielding"

Any assistance please?
OmagaIII #314
Posted 04 March 2013 - 10:27 PM
Been mucking around with this a bit more. I can't help the feeling that all my changes are terribly crude, but doing it mostly for myself. So, for people interested, it stops to refuel, you have a 5 second grace period on turtle startup that will allow you to cancel the resume function, and a startup parameter is added (3rd parameter, where the /r normally is) that allows you to select a level to start digging at (just in case you do not want to go completely bottom up). Only issue is when you start it, it goes down, smashes the first block, then seems to remember something it's forgotten and returns to top, to run the empty/refuel/check procedure again before then going down again and actually starting the excavation, but I thought this was somewhat funny, and you only start it once in a while anyway :P/>/> though the real reason I didn't fix it is because I'm lazy of course. http://pastebin.com/eUxK78su

Hi Aeolun,

Since my luck has run out with finding something that runs the resume code correctly, I tried your variations of the code as well. Yours wants to resume but after the 5 second wait it prints out;

1
rednet:350: string expected

Any advice on how I could fix this, or where I can look?

Regards,
Robert
jimbo #315
Posted 04 March 2013 - 10:28 PM
I am finding the turtle does not mine down to bedrock. I have tried both the standard and the auto-recover programs with the same result… It starts off on layer 6, mines that level out and just keeps going up. Am I missing something? I had a look through the code but could not see a switch for that function. - Great program BTW, I spent about a week writing my own, I saw this one and was gutted to see how much faster it was :wacko:/> I've ditched my one for yours now.
AustinKK #316
Posted 05 March 2013 - 02:07 AM
If you do use the wireless turtle (converted mine cause, I was getting the error also, just downloaded the program via the pastebin get command)…
I get..
"Can't locate GPS"
It only looks for GPS if you haven't specified the start height. If you don't specify it then it will try and use rednet/GPS to determine its start height.

My turtles keep going out of fuel for no reason.
I put fuel in the last slot, one block in the first, and a chest full of charcoal on the left side of the turtle.
I always have to go down and find them because they either run out of fuel, or just get stuck.
I tried running them with a chunk loader, still the same.
Any ideas? running Mindcrack.
Not sure, I run using Mindcrack and it works fine. Maybe upload a video showing the problem!?
I will try.
But it just goes out of fuel for no reason, not much to video here?
Does it have anything to do with too large quarries? is there a limit?
Can I edit the code to make the turtle refuel more often or something like that?
If you are doing a 64x64 quarry, then yes, it might run out of fuel before it has returned to the surface. I tend to refuel with lava at the nether and that seems to work. What size quarry are you doing?


I really love the program, I saw that you are working on a auto resume a few weeks ago, I was just wondering if it was still being planned on being added in?
The pastebin code is TRtdTB19.

Since no one has answered me in weeks…

I am using the beta v0.6 and keep getting "Too long without yielding"

Any assistance please?
I'm not sure what causes this problem I'm afraid. I think somebody said it can be fixed by putting a sleep(1) in somewhere in the code, but not sure where (sorry!) - either way, if it's doing that I think it's broken whether you put a sleep(1) in or not. Remind me what the context is where this issue occurs?

I am finding the turtle does not mine down to bedrock. I have tried both the standard and the auto-recover programs with the same result… It starts off on layer 6, mines that level out and just keeps going up. Am I missing something? I had a look through the code but could not see a switch for that function. - Great program BTW, I spent about a week writing my own, I saw this one and was gutted to see how much faster it was :wacko:/> I've ditched my one for yours now.
No idea I'm afraid. When you say keeps going up, what do you mean? Normally it will go back up to empty out its inventory, but should resume mining once it has finished.
OmagaIII #317
Posted 05 March 2013 - 05:06 AM
stuff

Hi Austin. Well, it isn't happening in any odd context. The normal v0.53 code works perfectly, but when I use the v0.6 code, the turtle starts off mining like normal, but at random intervals it simply stops and gives the 'Too long without yielding' error. Also, when this happens, resume seems to fail entirely. But there is no specific point when it decides to fail, nor a specific context, it just mines and at random intervals fails with the said message. Also, quarry size and starting height makes no difference either.

Regards,
OmagaIII
jimbo #318
Posted 05 March 2013 - 12:14 PM
I am finding the turtle does not mine down to bedrock. I have tried both the standard and the auto-recover programs with the same result… It starts off on layer 6, mines that level out and just keeps going up. Am I missing something? I had a look through the code but could not see a switch for that function. - Great program BTW, I spent about a week writing my own, I saw this one and was gutted to see how much faster it was :wacko:/> I've ditched my one for yours now.

No idea I'm afraid. When you say keeps going up, what do you mean? Normally it will go back up to empty out its inventory, but should resume mining once it has finished.

I posted a video on youtube if you wouldnt mind having a quick look… its only a couple of minutes long, just to demonstrate how it leaves the lower 5 blocks.

http://www.youtube.com/watch?v=jgIs4oTbpVo&feature=youtu.be
odorf07 #319
Posted 06 March 2013 - 10:07 AM
I get a error message reading "rednet:17: no modem on right side" any idea what could be causing this

I get this same thing. I've used your awesome script before, one day I tried running it and got the same message. Same setup as always.
Mining turtle with a chest behind and to the left. Smooth Dirt in top left, Coal in far bottom right, chest next to coal.
Place turtle, typ "OreQuarry 8 16", get error.


Also, I know next to nothing on the coding, but I found this in the coding at line 1103, and if I type rednet.open("right") I get the same error… not sure if that helps.


Edit: I added a modem to make it a wireless mining turtle, and it now runs.
AustinKK #320
Posted 07 March 2013 - 11:21 PM
I get a error message reading "rednet:17: no modem on right side" any idea what could be causing this

I get this same thing. I've used your awesome script before, one day I tried running it and got the same message. Same setup as always.
Mining turtle with a chest behind and to the left. Smooth Dirt in top left, Coal in far bottom right, chest next to coal.
Place turtle, typ "OreQuarry 8 16", get error.


Also, I know next to nothing on the coding, but I found this in the coding at line 1103, and if I type rednet.open("right") I get the same error… not sure if that helps.


Edit: I added a modem to make it a wireless mining turtle, and it now runs.

Wierd. Yeah, the rednet.open("right") will be causing the problem because it tries to access the modem, and if the turtle doesn't have one attached, then it will error. The wierd thing is that if you have specified the height, then it shouldn't try and access the modem at all, and hence shouldn't error.

Which version are you running? Is it 0.6 or 0.53?
AustinKK #321
Posted 07 March 2013 - 11:29 PM
I am finding the turtle does not mine down to bedrock. I have tried both the standard and the auto-recover programs with the same result… It starts off on layer 6, mines that level out and just keeps going up. Am I missing something? I had a look through the code but could not see a switch for that function. - Great program BTW, I spent about a week writing my own, I saw this one and was gutted to see how much faster it was :wacko:/> I've ditched my one for yours now.

No idea I'm afraid. When you say keeps going up, what do you mean? Normally it will go back up to empty out its inventory, but should resume mining once it has finished.

I posted a video on youtube if you wouldnt mind having a quick look… its only a couple of minutes long, just to demonstrate how it leaves the lower 5 blocks.

[media]http://www.youtube.com/watch?v=jgIs4oTbpVo&feature=youtu.be[/media]

So much easier to diagnose when you upload a video - thanks for that!! :D/> Yes, that's working as expected. The reason its not digging down into the bedrock is because you have it in "get as much ore as possible as quickly as you can even if you miss some" mode. You need to put it in "get all the ore that you can, plus empty any chests that you find on the way" mode.

To put it in the second mode, you need to put a chest in slot 15. If you do that, it should work as you are expecting.
acc1dent #322
Posted 08 March 2013 - 01:49 PM
I get a error message reading "rednet:17: no modem on right side" any idea what could be causing this

I get this same thing. I've used your awesome script before, one day I tried running it and got the same message. Same setup as always.
Mining turtle with a chest behind and to the left. Smooth Dirt in top left, Coal in far bottom right, chest next to coal.
Place turtle, typ "OreQuarry 8 16", get error.


Also, I know next to nothing on the coding, but I found this in the coding at line 1103, and if I type rednet.open("right") I get the same error… not sure if that helps.


Edit: I added a modem to make it a wireless mining turtle, and it now runs.

Wierd. Yeah, the rednet.open("right") will be causing the problem because it tries to access the modem, and if the turtle doesn't have one attached, then it will error. The wierd thing is that if you have specified the height, then it shouldn't try and access the modem at all, and hence shouldn't error.

Which version are you running? Is it 0.6 or 0.53?

I have tried both 0.6 and 0.53 and both give that error.
AustinKK #323
Posted 08 March 2013 - 11:08 PM
I get a error message reading "rednet:17: no modem on right side" any idea what could be causing this

I get this same thing. I've used your awesome script before, one day I tried running it and got the same message. Same setup as always.
Mining turtle with a chest behind and to the left. Smooth Dirt in top left, Coal in far bottom right, chest next to coal.
Place turtle, typ "OreQuarry 8 16", get error.


Also, I know next to nothing on the coding, but I found this in the coding at line 1103, and if I type rednet.open("right") I get the same error… not sure if that helps.


Edit: I added a modem to make it a wireless mining turtle, and it now runs.

Wierd. Yeah, the rednet.open("right") will be causing the problem because it tries to access the modem, and if the turtle doesn't have one attached, then it will error. The wierd thing is that if you have specified the height, then it shouldn't try and access the modem at all, and hence shouldn't error.

Which version are you running? Is it 0.6 or 0.53?

I have tried both 0.6 and 0.53 and both give that error.

Anyone else getting this problem with turtles without modems? I'm running the Mindcrack version myself, and my turtle's don't have modems and I get no error. Interested if it is because of the version of ComputerCraft and the different mod version combinations.

By the way, does anybody know how to get a turtle to break a hive and take the contained bees rather than just breaking it and getting nothing?
PhilHibbs #324
Posted 08 March 2013 - 11:42 PM
By the way, does anybody know how to get a turtle to break a hive and take the contained bees rather than just breaking it and getting nothing?
You'd need a Scoop Turtle for that, I don't think anyone's implemented that as a peripheral. It's been suggested before though. And if you wanted your Mining Turtle to gather bees that it happens across, well, it'd have to identify that the block is a hive, which is impossble as you couldn't put a hive into its inventory to compare against. Or, you'd have to use a Mining Scoop Turtle (which is even equally as nonexistent as a Scoop Turtle) and get it to try the scoop on every block first just in case. Not terribly efficient.
NIckodemus #325
Posted 09 March 2013 - 02:19 AM
Having some strange happenings. Right in the middle of mining the turtles run out of fuel from time to time, just out of nowhere. Everything's set up the way it is, with extra fuel in the top chest. :/
Cozzimoto #326
Posted 09 March 2013 - 08:58 AM
it may be that the modem functionality has changed in computercraft 1.5
Shirkit #327
Posted 09 March 2013 - 09:19 AM
Maybe it needs somehow to make an estimate of how much fuel it's going to consume. Say it's going to layer 1 (bottom most layer), and you are starting at height 90, and the quarry size is of 20x20, you need at least 90 * 2 + 20*20 + 20 * 2 fuel to complete this job in the worst case scenario only for this layer. Assuming you need to go up and down, that's 90*2, and you need to cover the whole layer, 20*20, and 20*2 to get back to the elevator hole. So, or you come back after every layer, or you add a maximum amount of layers for it to cover before going up again, let's say, 3 layers. So you need 90*2 + 20*20*3 + 20*2 and, even if the inventory is not full, you must go back to refuel if you don't have enough fuel.

Or you can do a detection, when it's low on fuel, say current fuel < 90 + 20*2 + 5, you need to refuel (+5 just to have a safe zone), it goes back to refuel.
Cozzimoto #328
Posted 09 March 2013 - 09:51 AM
well you can go beyond that and predict how many times the turtle will need to fuel for a quarry job. you can expand that formula to use the maxium amount of items a turtle can carry for the inventory being full and devide that with the maxium amount of fuel you would need to complete the job and add that to how many times the turtle will run out of its current fuel supply whichever you have it set to refuel at. and that would give you a rough idea of how many times a turtle would need to refuel and at whatever amount of fuel per refuel action. i would have to run a turtle that would log how much it would mine to get an average of how much it could mine before the turtles inventory would fill up, cause you will not get 64 stacks of whatever item in all of the slots.
CoolisTheName007 #329
Posted 09 March 2013 - 02:12 PM
I like the program for the originality in leaving unwanted layers undigged. Here's a version which makes sure that if fuel runs out, the turtle is at the dock. http://pastebin.com/aHW8xdGj
It is based off an old version of the original.
raptrmastr #330
Posted 09 March 2013 - 05:47 PM
I'm running the most recent mindcrack build and V0.60 of your excellent program. I can confirm the rednet:17:no modem on right side error. It's certainly not deterring me, modems being relative cheap.
Viper007Bond #331
Posted 09 March 2013 - 08:10 PM
Anyone else getting this problem with turtles without modems? I'm running the Mindcrack version myself, and my turtle's don't have modems and I get no error. Interested if it is because of the version of ComputerCraft and the different mod version combinations.

Yep, I'm getting this error. I'm using the latest (presumably) version of Mindcrack.

I built a wireless version of the turtle and it's working fine now.
odorf07 #332
Posted 12 March 2013 - 07:02 AM
Anyone else getting this problem with turtles without modems? I'm running the Mindcrack version myself, and my turtle's don't have modems and I get no error. Interested if it is because of the version of ComputerCraft and the different mod version combinations.

I got this both on Direwolf's pack and after my server reset and went to Ultimate. So ComputerCraft1.5 on direwolfs, and I'm not home so I don't know Ultimate's version. Adding a modem did fix tho.

Edit: Version is 1.5 on both.
Nalkrien #333
Posted 12 March 2013 - 07:29 AM
The cant find rednet error has to do something with your GPS coding, because it the the only part that has rednet open right.
leftler #334
Posted 12 March 2013 - 11:57 AM
For everyone who is getting the rednet error, here is a fixed version of v0.6 that solves the rednet problem. It checks that the modem exists before attempting to make any of the 3 rednet calls.

Racjwrk9
Fuzzlewhumper #335
Posted 12 March 2013 - 12:21 PM
These two things would be nice to have. :)/>

1. Detect for redstone signal to Turtle when returning to base. If redstone signal is off, continue program. If on, enter a do while true loop sleep(10) end. This way I can tell my turtles to stop at base and wait for me to either pick them up and move them elsewhere, or prepare for a server shutdown. This way I don't have to go hunt them down. Also since default is off to continue, it doesn't interfere with the current way your turtles function. If they don't know to put down a signal, it'll continue as normal.
2. Command line arguments add
OreQuarry [dimension of quarry (this exists now)] [y value of turtle (this exists now)] [(new item)y value to consider the floor of the quarry not to be less than bedrock layer value]
This goes hand in hand with 1, when server shuts down, I don't want turtle to go all the way back to where it already dug out and start over.
Also if they don't enter a value for it, default behavior should be exhibited.

Basically the adding of these two things shouldn't affect the previous way the turtle functioned.

I'll look over the code and see if I can figure out how to pull it off. :)/>

Item 1 was easy, put it in between routine where turtle drops stuff off at chest and before refuels. If redstone signal above turtle, it just sits there and waits sleeping for 10 seconds.

Now to figure out how to make it start mining at a level I want instead of heading down to bedrock. :)/>

Done, here is pastbin of modification

http://pastebin.com/c0gBQqY8

Hopefully this is okay. Tried it out with and without added argument, encountered no errors. Placed a block above turtle and put lever, with redpower on the turtle stops working when it comes back from digging until lever is switched off. Using the third argument starts digging at selected level. Told it to start at level 50, and it said now digging level 50. Heh, worked better than I had expected. Again, thanks for this program, it's so darn cool!!!

(final edit of pastebin occurred at 1:15am 3/12/2013 central time. Had to add a comment here, remove one there, and verify variables were properly used. Version tested with and without use of third argument, redstone tested, proper function of turtle was observed. Woot, don't think I broke it. :)/>
subzero22 #336
Posted 14 March 2013 - 03:58 AM
Fuzzlewhumper


It's a good idea but I mainly use turtles with wireless routers and gps. So maybe it would also be a good idea to have it so we can use a computer to send them a message to return to it's original spot. If for some reason server already restarted we could tell it to go to x, y, z.

I like how the turtles tell you which layer they are mining and I got a computer that listens for them so I know which layer they are on. So having a turtle start at a certain layer would be a cool idea instead of starting all over again.

I would also like for it to send messages when the turtle is coming back up to refuel or drop stuff off. I like to know what my turtles are doing lol.
Fuzzlewhumper #337
Posted 14 March 2013 - 06:56 AM
Fuzzlewhumper


It's a good idea but I mainly use turtles with wireless routers and gps. So maybe it would also be a good idea to have it so we can use a computer to send them a message to return to it's original spot. If for some reason server already restarted we could tell it to go to x, y, z.

I like how the turtles tell you which layer they are mining and I got a computer that listens for them so I know which layer they are on. So having a turtle start at a certain layer would be a cool idea instead of starting all over again.

I would also like for it to send messages when the turtle is coming back up to refuel or drop stuff off. I like to know what my turtles are doing lol.

Ooooooo, that's brilliant. So, deploy a gps, and also have a computer program monitoring the turtles to boot. That sounds pretty cool. Well beyond a script kiddie like myself, but that's definitely drool material right there. :)/>
Partyfriend #338
Posted 14 March 2013 - 11:12 AM
cool programm
gadams999 #339
Posted 14 March 2013 - 01:01 PM
Brilliant program. I'm still playing around with the 0.5x version from pastebin right now, and I'm hooked on computercraft. Curious on a couple things:

1) In some tests, with a chest to the south and west, the turtle responds with a lot of "x less than 0" messages, and when it returns to the surface dumps to a location where the chests are not at. Is there a specific direction that the chests should be located? drop off chest to west, fuel chest to north?

2) Do turtles keep state when they are picked up and repositioned? I'm still getting used to computercraft, and have seen references to deleting startup files and such. Any good wiki's on the technical aspects of the mod that would cover this?

Austinkk, my world is feeling the pinch of your turtle contol! :)/>
allbad #340
Posted 14 March 2013 - 01:32 PM
Not sure if this has been reported yet, but I'd like some way to kill the program. I'm on 0.60 can't get my turtle to stop mining. Ctrl-T doesn't kill it. Thanks.
Fuzzlewhumper #341
Posted 14 March 2013 - 03:36 PM
ctrl-t kills the program if you hold ctrl-t for three seconds.

Type label set NameOfYourTurtle if you want the turtle to keep it's programs when you pick it up and the turtle will also keep it's fuel level in tact.

I've not encountered any problems with turtles saying x less than 0, but I suggest you use Austin's turtle program in the first post of this thread - I know his code is solid. My modified one could be buggy (but so far, hasn't caused me trouble yet).

When you place the turtle down, it's facing the same direction you are.
Back up one step (if you're too close) and place a chest behind the turtle (in front of you). You should be facing the turtle you placed down and a chest is in front of you and behind the turtle. This is the chest the turtle stores stuff in.
Next place a chest directly to the left of the turtle. This chest is where the fuel you will use is stored.

The turtle should have smooth stone in slot 1, dirt in 2 (if you don't want dirt or a ton of cobble), a chest in 15 (optional), and the fuel you want to use in 16 (also put the same fuel in the fuel chest).

Then you can activate the program, telling it how big a pit you want to excavate and the Y position of your feet - not your eyes.

With that the turtle should be off and running and will come back from time to time to dump off stuff and get more fuel.

To stop the turtle you can right click it and hold ctrl-t for three seconds to get it to stop. Ya gotta kinda position yourself in such a way as to stay in range of the turtle for that three seconds. :)/> It may mine right by ya and get out of range before you had a chance to ctrl-t it. :)/>

Thats all I can think of right now. Have fun.
gadams999 #342
Posted 15 March 2013 - 05:17 AM
Thanks for the summary Fuzzle. I ran a couple more tests last night and think it may be to a bad initial Y level setting. I quickly viewed AustinKK's video and the mention of using REI's mini-map for the Y level. I'm running FTB Ultimate with VoxelMap and think maybe the value in parens is one too many or few (REI would .

I took the value from feet position using F3 and that worked for one run. I'll position over an area where I had problems and see if that works correctly.

"label set" - thanks for saving me some time. :)/>

Still using the 3mbe… pastebin code, works well enough for what I'm doing. Next up, turtles to mine tram tunnels and lay down track.
Nicklasa #343
Posted 15 March 2013 - 06:22 AM
Hey , first of all i would like to thank you for the awesome video.

Second i am having some problems and thought you might be able to help


I set everything up exactly like you had, but it mines the stone , sand , dirt and gravel anyways. It also went down to the bottom of the world and started from there. Is there anything that i can do wrong when i "program" it to ignore certain ores ?


It does keep those 4 , even when stuff stacks with it , then it empties everything except 1 of each. But i thought it was supposed to delete those
AustinKK #344
Posted 15 March 2013 - 11:46 AM
Hi guys,

Just to let you know that I'm still here, just lurking at the moment :ph34r:/>

I've been very much pre-occupied with the birth of my first child, so have had other priorities as you might imagine!! :D/>

Couple of quick points - yes the rednet logic has changed, when the script was written you could try and open the modem on a turtle without one and it would just do nothing - that has now changed to raise an error. As someone said, modems are cheap, so for now the workaround is to use a wireless mining turtle.

Thanks to those of you who are updating the script directly to add functionality and fix bugs. It helps a lot as I don't have the time to do it myself at the moment. As I've said before I'm really not precious about the code - please feel free to copy, change, amend, basically do whatever you like to it. It would be great if you do make changes to upload the new version to your own pastebin site and share the link for everybody else's use. I know some of you are already doing that, so thanks. :)/>

I'm sure I'll make some updates to the code when things settle down a bit, but I don't think that's going to be very soon to be honest! :rolleyes:/>
trishume #345
Posted 16 March 2013 - 11:55 AM
I made a version that dumps into an ender chest in slot 15 if there is one instead of wasting time going back to the surface. It is based of the version of Ore Quarry with resume capability but I have not tested wether the resume functionality still works.

http://pastebin.com/YmHxPvnW
rondogboy #346
Posted 17 March 2013 - 01:41 PM
Registered here just to post this. I am just getting into turtle programming and I and definitely going to use this program as one of my learning tools. I really appreciate your implementation tutorial and I really really appreciate how well commented your code is! Thanks for doing all of this!
Hawkertech #347
Posted 18 March 2013 - 09:09 AM
Fuzzlewhumper

I am getting a "1156: attempt to compare _ _lt on nil and number" error when i try to tell it what level to start at
Fuzzlewhumper #348
Posted 19 March 2013 - 01:39 AM
Fuzzlewhumper

I am getting a "1156: attempt to compare _ _lt on nil and number" error when i try to tell it what level to start at

I type startingMiningHeight instead of startMiningHeight. It's corrected in the pastebin now, sorry for that. I had fixed it on my end but didn't update the pastebin.
bomanski #349
Posted 22 March 2013 - 02:29 AM
Thumps up on this program!
Saw your youtube quarry vs this program and I was like this :o/> I need one of these.
I decided to make a 64x64 hole and dig out everything, was going fine until I had to restart minecraft, had to search that freakin bot :rolleyes:/> set it up again and it finnished after a while. Then mc crashed and my save file rerolled back a couple of days. Ragequit.
Did a new world and the 1st thing I made was a turtle+ur script.

Cheap and effectiv machine to get ur ores!
Tyken132 #350
Posted 22 March 2013 - 03:10 AM
First off I want to say that this is an amazing program and I gave you a shoutout on the video I did showing it off.

Secondly, I was wondering how to customize it so it doesn't go all the way to bedrock. Currently I have tons of materials and all I find that I need at the moment is copper, which is at much higher levels.

I assume its as simple as changing "bottomLayer = 5" to the height I desire but I almost feel that's too simple.

Lastly, is there a way to edit the code to make it start-up and continue where it left off in the case of a crash or I log off in the middle of the process? Having to hunt for my turtles is a bit of a pain.
huldu #351
Posted 22 March 2013 - 04:10 AM
Great quarry script!

I was wondering if someone has made a "progress" percentage display for this? Ie it would send back to the terminal how much percent it has dug out of the total. I don't know how to do it myself but the most simple way I could think of was just to check the layer count against the total amount?

Also had another request, anyone have a nice looking terminal script? Basically right now the turtle just spams everything to the terminal. It would be really cool if the terminal would paste each line from a turtle on its own line and update it instead of filling the entire screen. For example:

– Turtles active: 1/3
turtle1: doing this and that
turtle2: waiting for fuel
turtle3: done with quarry

The above would be updated per its own line so you could easily have a bunch of turtles without cluttering up the entire screen and missing vital information from the turtles. I have no idea how to do this tho :(/>
TheKeyn #352
Posted 22 March 2013 - 05:40 AM
As of probably 5 days ago on the FTB Ultimate pack my turtles with this program are completely running out of fuel and never coming back up to refuel. Also some are losing their attachments like their wireless modem and mining pick and changing to normal turtles after a server reset. I'm an LUA noob so I posted this on FTB's support site as well.

I'm using the updated rednet version of the pastebin Racjwrk9
CypSteel #353
Posted 22 March 2013 - 06:44 AM
Thanks so much for the script Austin. Worked great the 3 times I have used it so far…I just started with turtles yesterday, so I have a couple usability questions (which could probably be answered by anyone)…

1) Has anyone used a computer with this? I did a rednet open loop script to listen, but he had to be within 50 blocks. I would think it would be a great way to monitor MinerWilly's status at the mining site. What are other people doing for this?
2) Huldu said something in a post above about multiple turtles?!?!? I must have missed this in the video? Is there multiple turtle support?
3) How does the GPS work? Does it provide any value besides not having to type starting elevation?
CypSteel #354
Posted 22 March 2013 - 06:51 AM
I made a version that dumps into an ender chest in slot 15 if there is one instead of wasting time going back to the surface. It is based of the version of Ore Quarry with resume capability but I have not tested wether the resume functionality still works.

If you are using slot 15 for the ender chest, how does it handle chests it finds and the contents? Austin had programmed some logic to open chests (example found in slot 15) and retrieve the contents. How does it work with an ender chest there?
huldu #355
Posted 22 March 2013 - 10:19 AM
You can run a bunch of these, just set computer labels and you're set. I was just wondering if someone had a fancy terminal script that allowed for multiple turtles running without cluttering the entire screen. Basically each turtle would get its own line and would only update that specific line. Would make it a lot easier to keep track of all your quarry turtles. I already posted an example but I'll do it again:

turtle1: 50% completed
turtle2: 75% completed - emptying loot
turtle3: 100% completed - waiting at drop-off

So in other words each turtle would appear in the list, once something happens it would update that specific line for that turtle. The thing is I don't know how one would do that since it has *nothing* to do with this turtle script but rather a terminal script that relays what the turtles are "saying" back to the computer. I'll figure something out tho, would be pretty fancy to have a computer setup where you can check on the screen what the turtles are doing/if any is done, or any problems have happened and so forth. Currently the turtles don't have a "progress" bar, but they return their current layer back to the terminal.
CypSteel #356
Posted 22 March 2013 - 11:29 AM
Wouldn't they have to be pretty close together since the max range is like 60 blocks or something?
Stormcrown #357
Posted 22 March 2013 - 11:45 AM
Works fantastically, my only issue is the following:

The server I play on restarts often, sometimes without warning. every 12 hours or so.

When the server comes back up, how would I restart the script efficiently?

Also, when the server goes down the mining turtle sometimes gets reverted into a regular turtle. This is because while the turtle is moving, it is an entity. Is there a automate the situation of a server crash?
bugmcw #358
Posted 25 March 2013 - 08:54 AM
Hey all, program V 0.6 worked perfectly for me yesterday… unfortunately today my turtles keep unloading the noise block in slot 1 (smooth stone) and then throwing an error as it is trying to compare to nothing.

Error reads: Turtle:18: Item count -1 out of range.

Any ideas what happened and why it worked yesterday no problem?



EDIT: I have figured out how to stop the error from happening, so maybe someone can figure out how to remove it? I have the turtle dropping into a chest that is being emptied by a retriever…. it seems if the retriever is OFF the turtle carries on, but if it is on, it pulls out the smooth stone from Turtle slot 1. Does the turtle put noise block 1 in the chest on unload and then pick it back up? I can't think of any other reason it would keep losing this block.
CupricWolf #359
Posted 26 March 2013 - 06:24 AM
Might I suggest a third operation mode, "remove everything in the entire region specified" mode. I like having the all of the "noise blocks" because I can use them in my giant castles and dirt can be recycled up to other more useful things. Currently if I want to get every single block out of the region I have to put glass, or some other non-natural block in the first slot. I think this third mode should be activated by putting no noise blocks in what so ever. Just a thought.
sjkeegs #360
Posted 26 March 2013 - 05:34 PM
Might I suggest a third operation mode, "remove everything in the entire region specified" mode.
There are plenty of other programs that do a simple quarry type mine. You could use the built-in excavate program.
CupricWolf #361
Posted 26 March 2013 - 06:35 PM
Might I suggest a third operation mode, "remove everything in the entire region specified" mode.
There are plenty of other programs that do a simple quarry type mine. You could use the built-in excavate program.
Yes but this is much more efficient, as has been proven earlier in the thread. It moves once for 3 blocks rather than once per block. Plus if a chest is put in the 15th slot it empties chests too, great for quarries over mine-shafts.
sjkeegs #362
Posted 27 March 2013 - 12:19 AM
Might I suggest a third operation mode, "remove everything in the entire region specified" mode.
There are plenty of other programs that do a simple quarry type mine. You could use the built-in excavate program.
Yes but this is much more efficient, as has been proven earlier in the thread. It moves once for 3 blocks rather than once per block. Plus if a chest is put in the 15th slot it empties chests too, great for quarries over mine-shafts.
Here is a 3 level per pass quarry http://www.computercraft.info/forums2/index.php?/topic/10106-yet-another-quarry-my-3-layers-per-pass-variable-sized-hole-excavator/ It doesn't pull stuff out of chests, but it would be easy to modify it to do that.
AustinKK #363
Posted 27 March 2013 - 02:16 AM
First off I want to say that this is an amazing program and I gave you a shoutout on the video I did showing it off.

Secondly, I was wondering how to customize it so it doesn't go all the way to bedrock. Currently I have tons of materials and all I find that I need at the moment is copper, which is at much higher levels.

I assume its as simple as changing "bottomLayer = 5" to the height I desire but I almost feel that's too simple.

Lastly, is there a way to edit the code to make it start-up and continue where it left off in the case of a crash or I log off in the middle of the process? Having to hunt for my turtles is a bit of a pain.

Hi Tyken,

Thanks for the mention - I will check out the video.

Yes you can just change the bottomLayer = 5 to a different row. That defines the lowest layer that the turtle will go to, so if you set it higher, then you will get only the top layers.

There is a version that auto resumes. It has a pastebin id of TRtdTB19
AustinKK #364
Posted 27 March 2013 - 02:41 AM
First off I want to say that this is an amazing program and I gave you a shoutout on the video I did showing it off.

Secondly, I was wondering how to customize it so it doesn't go all the way to bedrock. Currently I have tons of materials and all I find that I need at the moment is copper, which is at much higher levels.

I assume its as simple as changing "bottomLayer = 5" to the height I desire but I almost feel that's too simple.

Lastly, is there a way to edit the code to make it start-up and continue where it left off in the case of a crash or I log off in the middle of the process? Having to hunt for my turtles is a bit of a pain.

Tyken,

I watched your video, and a couple of comments:

1) You need to put a wooden chest in slot 15 - I think you were using an iron chest, which I'm pretty sure won't work
2) I normally fill my turtles up with lava in the nether rather than using coal these days. Unless the turtle is low on fuel, it won't even check the fuel slot so you can put anything in there (usually a block of dirt)
AustinKK #365
Posted 27 March 2013 - 03:23 AM
First off I want to say that this is an amazing program and I gave you a shoutout on the video I did showing it off.

Secondly, I was wondering how to customize it so it doesn't go all the way to bedrock. Currently I have tons of materials and all I find that I need at the moment is copper, which is at much higher levels.

I assume its as simple as changing "bottomLayer = 5" to the height I desire but I almost feel that's too simple.

Lastly, is there a way to edit the code to make it start-up and continue where it left off in the case of a crash or I log off in the middle of the process? Having to hunt for my turtles is a bit of a pain.

Tyken,

I watched your video, and a couple of comments:

1) You need to put a wooden chest in slot 15 - I think you were using an iron chest, which I'm pretty sure won't work
2) I normally fill my turtles up with lava in the nether rather than using coal these days. Unless the turtle is low on fuel, it won't even check the fuel slot so you can put anything in there (usually a block of dirt)

Oh, and by the way, the reason that 3 of the turtles went funny is that you specified the start height incorrectly for turtles 2, 3 &amp; 4.
CupricWolf #366
Posted 27 March 2013 - 10:38 AM
Might I suggest a third operation mode, "remove everything in the entire region specified" mode.
There are plenty of other programs that do a simple quarry type mine. You could use the built-in excavate program.
Yes but this is much more efficient, as has been proven earlier in the thread. It moves once for 3 blocks rather than once per block. Plus if a chest is put in the 15th slot it empties chests too, great for quarries over mine-shafts.
Here is a 3 level per pass quarry http://www.computerc...hole-excavator/ It doesn't pull stuff out of chests, but it would be easy to modify it to do that.
Thanks! I'll just have to edit it a bit to empty chests and also fuel from a chest on the left. Though at some point I wonder if it's worth it to just put glass in the first slot and have it return ever so slightly more often.
Bigglesworth #367
Posted 28 March 2013 - 08:19 AM
Have I done something wrong? here are the steps I took…

1. Put stone in slot 1 dirt in slot 2 wood chest in 15 and coal in 16
2. put chest behind turtle and to the left
3. Looked at F3, turtles level was 70. put turtle down and selected Quarry 8 70
4. Turtle goes down to bedrock and mines every 3rd layer…

problem starts

5. turtle comes up and places all the stuff in chest (a lot of cobble i didnt want…)
6. Turtle goes back down and now is no longer doing every 3rd layer, does all layers

???

For some reason it seems to dump everything into teh chest the first time it visits the chest. So teh dirt block stone, coal and chest i put in it arnt in it the next time it goes down.

Im in 1.5.1 with OS 1.5
AustinKK #368
Posted 28 March 2013 - 10:28 PM
Works fantastically, my only issue is the following:

The server I play on restarts often, sometimes without warning. every 12 hours or so.

When the server comes back up, how would I restart the script efficiently?

Also, when the server goes down the mining turtle sometimes gets reverted into a regular turtle. This is because while the turtle is moving, it is an entity. Is there a automate the situation of a server crash?

Hi, you need to use the version that supports auto-restart. The pastebin id is TRtdTB19
AustinKK #369
Posted 28 March 2013 - 10:30 PM
Have I done something wrong? here are the steps I took…

1. Put stone in slot 1 dirt in slot 2 wood chest in 15 and coal in 16
2. put chest behind turtle and to the left
3. Looked at F3, turtles level was 70. put turtle down and selected Quarry 8 70
4. Turtle goes down to bedrock and mines every 3rd layer…

problem starts

5. turtle comes up and places all the stuff in chest (a lot of cobble i didnt want…)
6. Turtle goes back down and now is no longer doing every 3rd layer, does all layers

???

For some reason it seems to dump everything into teh chest the first time it visits the chest. So teh dirt block stone, coal and chest i put in it arnt in it the next time it goes down.

Im in 1.5.1 with OS 1.5

Not sure, that's an odd one. Don't suppose you can record a video of what's happening? Might be able to help better if I can see it in action
Bigglesworth #370
Posted 29 March 2013 - 10:09 AM
Not sure, that's an odd one. Don't suppose you can record a video of what's happening? Might be able to help better if I can see it in action

I'll give it a go if I can reproduce the problem.

Edit: Yeah it is putting the stone and dirt block/chest/coal in the chest when it comes up for its first empty, then it goes back dont and just starts mining all the stone (into cobble). Ill post a vid possibly later but this is pretty much exactly what is happening. Again 1.5.1 Computercraft OS 1.5
bugmcw #371
Posted 30 March 2013 - 03:44 AM
Have I done something wrong? here are the steps I took…

1. Put stone in slot 1 dirt in slot 2 wood chest in 15 and coal in 16
2. put chest behind turtle and to the left
3. Looked at F3, turtles level was 70. put turtle down and selected Quarry 8 70
4. Turtle goes down to bedrock and mines every 3rd layer…

problem starts

5. turtle comes up and places all the stuff in chest (a lot of cobble i didnt want…)
6. Turtle goes back down and now is no longer doing every 3rd layer, does all layers

???

For some reason it seems to dump everything into teh chest the first time it visits the chest. So teh dirt block stone, coal and chest i put in it arnt in it the next time it goes down.

Im in 1.5.1 with OS 1.5

Not sure, that's an odd one. Don't suppose you can record a video of what's happening? Might be able to help better if I can see it in action

This happened to me too, i posted it earlier- Important thing to note, it is not mining every layer, it is still "mining" every 3rd, but it is dumping its noise blocks (therefore mining above and below on each pass).

Mine keeps dumping the smooth stone (slot 1) and then posting an error about comparing something to -1. Here is how you can replicate what I am seeing::

I am in FTB and i have the turtle unloading to a chest that is instantly being emptied by a retriever. I think somehow the stone is being sucked out of the turtle (or the chest) right away throwing the error. I have temporarily solved the problem by adding a filter to the chest, so stone will not be removed no matter what. This has worked, but it is not as elegant as my old system-

Bug
Bigglesworth #372
Posted 30 March 2013 - 08:24 AM
The retriever shouldent matter unless its sucking from the turtle itself. The turtle, as you said, is emptying the noise/filter blocks, and as you said, is going back down and mining ALL the blocks by going every three rows as normal.


The fix would be to make sure the filter/noise blocks do not get pooped out into the chest, and all I can assume is a change happened in 1.5(OS/MC version) that is not letting that part of the code work properly.

Even with this bug, it is still way better than the default excavate.

Ill try and post a vid if AustinKK still needs one..
Bigglesworth #373
Posted 30 March 2013 - 09:44 AM
Okay here is a vid. This is its first time coming up.

[media]http://www.youtube.com/watch?v=J_SSAP8EIyc&feature=youtu.be[/media]


One thing to note that wasnt seen here is that all the stuff (stone/dirt/chest) were put into the left chest. teh chest containing the extra fuel. Strange…
AustinKK #374
Posted 30 March 2013 - 09:55 PM
Okay here is a vid. This is its first time coming up.

[media]http://www.youtube.com/watch?v=J_SSAP8EIyc&feature=youtu.be[/media]


One thing to note that wasnt seen here is that all the stuff (stone/dirt/chest) were put into the left chest. teh chest containing the extra fuel. Strange…

Hmm, very strange.

Can you try something for me?

Can you change lines 27 &amp; 28:

local messageOutputLevel = messageLevel.INFO
local messageOutputFileName

to

local messageOutputLevel = messageLevel.DEBUG
local messageOutputFileName = "log.txt"


and re-run it. It should create a file on the turtle called "log.txt" with more detailed information in it.

Can you then post that (or send me a message with the contents).

It would also be useful if you could try version 0.6 (pastebin link TRtdTB19) and see if that has the same problem.
Bigglesworth #375
Posted 31 March 2013 - 05:07 AM

----------------------------------
** Ore Quarry v0.53 by AustinKK **
----------------------------------
Looking for chests...
Mining Layer: 5
Mining Level: 5, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 8
Mining Level: 8, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 11
Mining Level: 11, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 14
Mining Level: 14, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 17
Mining Level: 17, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 20
Mining Level: 20, Bottom Layer: 5, Mining Offset: 0
returnToStartAndUnload called
Return to start, return level: 20
Dropping (n-1) from slot 1 [1]
Dropping (n-1) from slot 2 [5]
Dropping (all) from slot 3 [64]
Dropping (all) from slot 4 [4]
Dropping (all) from slot 5 [64]
Dropping (all) from slot 6 [64]
Dropping (all) from slot 7 [4]
Dropping (all) from slot 8 [64]
Dropping (all) from slot 9 [64]
Dropping (all) from slot 10 [13]
Dropping (all) from slot 11 [64]
Dropping (all) from slot 12 [64]
Dropping (all) from slot 13 [64]
Dropping (all) from slot 14 [1]
Dropping (n-1) from slot 15 [1]
Stored X: 3, currX: 0
Orienting right
Moving in x direction
Stored Z: 2, currZ: 0
Orienting forward
Moving in z direction
Have returned to the mining point
Mining Layer: 23
Mining Level: 23, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 26
Mining Level: 26, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 29
Mining Level: 29, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 32
Mining Level: 32, Bottom Layer: 5, Mining Offset: 0
Mining Layer: 35
Mining Level: 35, Bottom Layer: 5, Mining Offset: 0
returnToStartAndUnload called
Return to start, return level: 32
Dropping (n-1) from slot 1 [64]
Dropping (n-1) from slot 2 [64]
Dropping (all) from slot 3 [30]
Dropping (all) from slot 4 [64]
Dropping (all) from slot 5 [49]
Dropping (all) from slot 6 [64]
Dropping (all) from slot 7 [64]
Dropping (all) from slot 8 [5]
Dropping (all) from slot 9 [64]
Dropping (all) from slot 10 [64]
Dropping (all) from slot 11 [64]
Dropping (all) from slot 12 [64]
Dropping (all) from slot 13 [64]
Dropping (all) from slot 14 [1]
Dropping (n-1) from slot 15 [64]
Stored Z: 7, currZ: 0
Orienting forward
Moving in z direction
Stored X: 5, currX: 0
Orienting right
Moving in x direction
Have returned to the mining point

Where it says Dropping (n-1) it is just dropping everything in the (wrong (fuel not item)) chest rather than all but 1. =/ Ill try v.6 today, but last time I used it it was being even more odd, it started mining EVERYTHING at level 16 and below in a column manner. Thats to say it got to lvl 16, then mined down, went one block to the side, up 16, one block to the side, down 16, ect
chood601 #376
Posted 31 March 2013 - 05:57 AM
Austin,

I am running MC 1.51 with CC 1.52 and I can confirm that this behavior is the same in OreQuarry v0.6. The turtle will descend to bedrock and will function normally until it returns to the chests for the first time. There it will dump the noise blocks and chest into the fuel chest. Once it returns to mining it will mine out all of the blocks since it no longer has any noise blocks to compare against.

I've captured video of the initial unloading which might be helpful.

[media]http://youtu.be/DoM3QrBxEZw[/media]
AustinKK #377
Posted 01 April 2013 - 01:32 AM
Bigglesworth, chood601,

Thanks for picking up on this - you're right, the program was broken in version 1.52 of ComputerCraft.

Fixed now - new download can be retrieved from the normal pastebin download link (3mkeUzby). As part of the update, I've now made the version that supports auto-resume the standard version, and fixed the change to the modem functionality (so the program now works on either Wireless Mining Turtles or regular Mining Turtles without a modem without erring).

For those that are interested, the change to the API that broke the turtle is that the "turtle.drop()" function now works in a different way. Previously, it would drop everything in the current slot, and if there was nothing in the current slot it would do nothing. Now, if there is nothing in the current slot and you call turtle.drop() it drops everything from the first slot if finds that contains items (even if that is not the current slot).

Not sure if that's an intentional change or a bug (I guess it's intentional) - either way, now fixed and with backwards compatibility so shouldn't break any previous versions.

Thanks again guys.
Bigglesworth #378
Posted 01 April 2013 - 08:56 AM
AustinKK is the man. Thanks! :D/>
Bigglesworth #379
Posted 03 April 2013 - 08:43 AM
I have a few suggestions for additions:
  1. Ladders down to bedrock on the initial hole (a man can drown using water lol) I know, just make a jetpack, right? Sure, but I think this addition would make the script that much more elegant.
  2. Ability to use lava found when turtle is mining as fuel.
  3. Some sort of rational torch placement at bedrock maybe? Not really needed above that.

Regardless, thanks again. Even if this is only about 1/2 as fast as the current top-speed of a Quarry it is still 3x+ as fast as a normal excavate, the plus side of this is that this is 1. far easier to setup 2. far cheaper 3. far more agile. 4. far easier to fuel 5. can simply add turtles to makeup for speed 6. gets the GOOD ore FIRST 7. Doesn't leave massive holes even if I mine over land.

I may not even make a quarry on my next world.
hansondr #380
Posted 04 April 2013 - 06:52 AM
I'm finding that even though I'm placing cobblestone and dirt into slots 1 and 2 respectively I'm still getting many stacks of cobble along with dirt placed into the collection chest. Do I need to include a smoothstone block along with the cobble and dirt as noise blocks? I'm using version 0.7 (http://pastebin.com/3mkeUzby), downloaded last evening (-14 hours at time of writing)
sjkeegs #381
Posted 04 April 2013 - 07:21 PM
I'm finding that even though I'm placing cobblestone and dirt into slots 1 and 2 respectively I'm still getting many stacks of cobble along with dirt placed into the collection chest.

The ignore blocks are there to tell the turtle which blocks should not be considered an "ore" block. This does not mean that during the process of digging tunnels to look for "ore" blocks that the turtle won't dig a bunch of stone and dirt, putting cobble and dirt into the inventory.

You should use smoothstone as an ignore block instead of cobble, since cobble is typically not found while digging a quarry. If the turtle considers the ore blocks as cobble and dirt, then any smoothstone it comes across will be dug, as it would be considered an ore block.
Aptik #382
Posted 04 April 2013 - 10:52 PM
Is there a chance that future versions of this program will works without BuildCraft?
For example turtle can place chests from chest storage to the start position one by one (if needed).
Bigglesworth #383
Posted 04 April 2013 - 11:12 PM
What does that have to do with buildcraft? And if youre using buildcraft, start sorting your items through automation. The chest the turtle uses to fuel and place items are only buffers. Maybe im not getting what you mean?
Aptik #384
Posted 05 April 2013 - 02:14 AM
Maybe im not getting what you mean?
Sorry it was a bad question.
0pteron #385
Posted 05 April 2013 - 08:38 AM
How do I get it to not go in restart mode? Sometimes I manually stop the turtle, and whenever I go to use it again it continued where it left off. I don't want it to do this sometimes.

Edit: Looking at the /r in the code seems to show that it disables restart mode.

However, I still have 5 turtles who want to restart. Do I have to just let them run through? I don't own the server.
LazyBoot #386
Posted 06 April 2013 - 12:32 AM
How do I get it to not go in restart mode? Sometimes I manually stop the turtle, and whenever I go to use it again it continued where it left off. I don't want it to do this sometimes.

Edit: Looking at the /r in the code seems to show that it disables restart mode.

However, I still have 5 turtles who want to restart. Do I have to just let them run through? I don't own the server.
All you should need to do is to delete the startup file on each of the turtles…
Aptik #387
Posted 06 April 2013 - 04:29 AM
All you should need to do is to delete the startup file on each of the turtles…
Looks like he can't:
I don't own the server.
AliveGhost #388
Posted 06 April 2013 - 08:11 AM
Hey.

I'm loving the quarry. It's awesome! However, when the Turtle runs out of fuel, or begins to, it doesn't return to the surface. It just waits until it dies, and then I have to go and search for it. Has anyone else had the same problem? Thanks :)/>

-AliveGhost
AustinKK #389
Posted 07 April 2013 - 02:30 AM
Hey.

I'm loving the quarry. It's awesome! However, when the Turtle runs out of fuel, or begins to, it doesn't return to the surface. It just waits until it dies, and then I have to go and search for it. Has anyone else had the same problem? Thanks :)/>

-AliveGhost

How big a quarry are you digging?
chood601 #390
Posted 07 April 2013 - 02:46 AM
I have this problem as well (running out of fuel). I had the idea of starting a 64 block quarry starting at level 16. Did great while I was able to stay awake and could tend the chests. However, left on its own the ore chest and the fuel chest both filled up and, for some reason, even though there was remaining fuel in the fuel chest, the turtle ended up with cobble blocks in slot 16 and it stopped with a "Ran out of fuel" message.

Two questions here… What is the correct procedure to get the turtle to start back up from its present stopped position? And, would it be possible in OreQuarry for the turtle to detect if the ore chest is full and to have it pause (with a "press any key to resume" or something similar) until the ore chest can be emptied?

Thanks!!
AliveGhost #391
Posted 07 April 2013 - 03:04 AM
Mine was just a small 10 block quarry
AustinKK #392
Posted 07 April 2013 - 10:01 PM
I have this problem as well (running out of fuel). I had the idea of starting a 64 block quarry starting at level 16. Did great while I was able to stay awake and could tend the chests. However, left on its own the ore chest and the fuel chest both filled up and, for some reason, even though there was remaining fuel in the fuel chest, the turtle ended up with cobble blocks in slot 16 and it stopped with a "Ran out of fuel" message.

Two questions here… What is the correct procedure to get the turtle to start back up from its present stopped position? And, would it be possible in OreQuarry for the turtle to detect if the ore chest is full and to have it pause (with a "press any key to resume" or something similar) until the ore chest can be emptied?

Thanks!!
The turtle only picks up fuel when it returns to base to drop off other items - it can therefore run out of fuel whilst mining. If you are digging a 64x64 quarry, you need to fill it up on fuel beforehand (I normally do this in the nether with lava).

You need to automatically empty the ore chest, a bit like a quarry, if the chest if full the items will be dumped on the floor.

Mine was just a small 10 block quarry
Wierd, how much fuel did you give it? If you give it 64 coal/charcoal in slot 16, then it shouldn't run out of fuel digging a 10x10 quarry
Stormcrown #393
Posted 09 April 2013 - 07:46 AM
Hey Austin, do you know how much fuel would be necessary for running various quarry sizes? 16/32/64?
pacfish #394
Posted 10 April 2013 - 12:32 AM
I was wondering if there was a easy way to add for the turtle to pickup items on it's forward dig. (specifically rails)
Currently it's set to head back to the surface if it's full on block break. Adding the the pickup command after and then repeating the inventory works but 1 it's not efficient and 2 if the turtle heads back after picking up a block he won't try and pick up exactly where he left off. Adding that in as like a chest feature would be nice.

While this isn't what your intentions where with the quarry program it be nice to see someone do it as well as yours (I'll try) but that diamond ore under the bedrock needs to get mined! I'm currently working on a 3D maze solver for just this purpose in java. It stays in it's legal limits but tries every way possible to get to the finish, in this case below bedrock.

Already modified it to accept different side lengths rectangles.
Aptik #395
Posted 11 April 2013 - 03:06 AM
@AustinKK may I edit your program for my own needs (or integrate it as part of my program)? I'll leave all copyright labels and will not distribute it (except a few of my friends which will get it for free).
diogo #396
Posted 11 April 2013 - 07:16 PM
How do I get it to not go in restart mode? Sometimes I manually stop the turtle, and whenever I go to use it again it continued where it left off. I don't want it to do this sometimes.

Edit: Looking at the /r in the code seems to show that it disables restart mode.

However, I still have 5 turtles who want to restart. Do I have to just let them run through? I don't own the server.

1. Stop your turtle holding ctrl+t for a few seconds. (don't use ctrl+r, that will just keep rebooting the thing).
2. Type: delete startup
4. Break your turtle.


Ps. I don't know the difference between code and giberish, so I'm just trying to reproduce to problem and fix it. That seems to do it.
Ps2. Lotsa edits.
AustinKK #397
Posted 11 April 2013 - 10:50 PM
Hey Austin, do you know how much fuel would be necessary for running various quarry sizes? 16/32/64?
Well it digs every third layer in full (so 64x64 moves for a 64 width quarry). So take the total depth x 64^2 / 3 to get the moves required to dig the layers. It moves down to the bottom and back up again in a single column, and will typically require approximately the number of moves required to dig a further two layers when mining bedrock.

Add to that a bit of allowance for returning to the surface

Rough estimates from all that (starting from layer 70):

64x64: 150,000
32x32: 38,000
16x16: 10,000

I think they're in the right sort of ballpark…

I was wondering if there was a easy way to add for the turtle to pickup items on it's forward dig. (specifically rails)
Currently it's set to head back to the surface if it's full on block break. Adding the the pickup command after and then repeating the inventory works but 1 it's not efficient and 2 if the turtle heads back after picking up a block he won't try and pick up exactly where he left off. Adding that in as like a chest feature would be nice.

While this isn't what your intentions where with the quarry program it be nice to see someone do it as well as yours (I'll try) but that diamond ore under the bedrock needs to get mined! I'm currently working on a 3D maze solver for just this purpose in java. It stays in it's legal limits but tries every way possible to get to the finish, in this case below bedrock.

Already modified it to accept different side lengths rectangles.
Hi. Not on my planned list of additions - good luck with the changes though!!

@AustinKK may I edit your program for my own needs (or integrate it as part of my program)? I'll leave all copyright labels and will not distribute it (except a few of my friends which will get it for free).
You can edit, distribute, remove my name, change, steal, make out that it's your own, basically do whatever you like!! I'm really not precious about anybody taking the code (in its entirety or part) and using it for whatever they want. I wrote it for the community, and if people can move the code forward, then great! :D/>
firerebel #398
Posted 12 April 2013 - 12:21 AM
I have a bug/problem with this script. Often when I start it, it will for some reason get to bedrock, then go in a hole in the bedrock and sit there. And do nothing else.
Aptik #399
Posted 12 April 2013 - 12:53 AM
I have a bug/problem with this script. Often when I start it, it will for some reason get to bedrock, then go in a hole in the bedrock and sit there. And do nothing else.
Did you defined second argument (height)?
CupricWolf #400
Posted 12 April 2013 - 01:17 PM
Is there a chance that future versions of this program will works without BuildCraft?
For example turtle can place chests from chest storage to the start position one by one (if needed).

You can use hoppers in vanilla. :)/>


All you should need to do is to delete the startup file on each of the turtles…
Looks like he can't:
I don't own the server.

turtles can still delete files in their storage space by running delete i think
Aptik #401
Posted 12 April 2013 - 07:07 PM
All you should need to do is to delete the startup file on each of the turtles…
Looks like he can't:
I don't own the server.

turtles can still delete files in their storage space by running delete i think
You are right
firerebel #402
Posted 13 April 2013 - 04:57 AM
My turtle always does this and I'm doing to my knowledge exactly what you do in your videos and what you have said to do.

http://i.imgur.com/1ilbGel.png

After a while of mining these vertical layers, it gets stuck in the bedrock.
SyberSmoke #403
Posted 15 April 2013 - 10:46 PM
I have been enjoying your turtle code for a while. The nice things about turtles is the cost and this allows me to run multiple turtles at the same time to clear a larger area faster than I could otherwise. Having 4 turtles clear four 20x20 areas is a fast way to get resources.

That said, I have a few issues and suggestions. Issues wise, I have found that in 1.4.7 (Playing on a Feed the Beast MindCrack server) the turtle running 0.7 will not restart after a server restart. I waited 30 minutes and had to go hunting for the little guy. Found him and right clicking him showed he was trying to "resume…." but the turtle was not.

As for suggestions and questions.

1. Do you have any plans to allow the turtle to use a resupply upgrade and station (link)? This just seems to be a good way to get the turtle supplied with fuel without it having to trek around.

2. Could you consider adding a function that changes what way the turtle goes. Currently the turtle goes forward and to the right. I would very much like to have a parameter, may be OreQuarry [R/L] (Distance) {Current Height}, where selecting R allows a right turn, and L offers a left turn. Going left would swap where the fuel chest is to the right, allowing two turtles to share one chest of fuel.

3. Could it also be considered to have a rednet recall command tool. I do dislike going after turtles and most of mine have a wireless component. It would be nice to be able to use a computer to return the turtle to its starting position.


Ok, done…thank you for this excellent tool and please keep up the excellent work.
AustinKK #404
Posted 18 April 2013 - 10:54 PM
I have been enjoying your turtle code for a while. The nice things about turtles is the cost and this allows me to run multiple turtles at the same time to clear a larger area faster than I could otherwise. Having 4 turtles clear four 20x20 areas is a fast way to get resources.

That said, I have a few issues and suggestions. Issues wise, I have found that in 1.4.7 (Playing on a Feed the Beast MindCrack server) the turtle running 0.7 will not restart after a server restart. I waited 30 minutes and had to go hunting for the little guy. Found him and right clicking him showed he was trying to "resume…." but the turtle was not.

As for suggestions and questions.

1. Do you have any plans to allow the turtle to use a resupply upgrade and station (link)? This just seems to be a good way to get the turtle supplied with fuel without it having to trek around.

2. Could you consider adding a function that changes what way the turtle goes. Currently the turtle goes forward and to the right. I would very much like to have a parameter, may be OreQuarry [R/L] (Distance) {Current Height}, where selecting R allows a right turn, and L offers a left turn. Going left would swap where the fuel chest is to the right, allowing two turtles to share one chest of fuel.

3. Could it also be considered to have a rednet recall command tool. I do dislike going after turtles and most of mine have a wireless component. It would be nice to be able to use a computer to return the turtle to its starting position.


Ok, done…thank you for this excellent tool and please keep up the excellent work.

Thanks for this - I'll need to look into the restart issue - not something that I had been experiencing so not aware of it.

I'm afraid I don't currently have any plans to implement any of your suggestions! The next thing on the features list is to define which layers the turtle mines, but I still haven't got round to that….

Out of interest, why would you like the turtle to be able to go left as well as right?
Aptik #405
Posted 18 April 2013 - 11:46 PM
My turtle always does this and I'm doing to my knowledge exactly what you do in your videos and what you have said to do.

http://i.imgur.com/1ilbGel.png

After a while of mining these vertical layers, it gets stuck in the bedrock.

You specified a bad height value (second argument).
SyberSmoke #406
Posted 19 April 2013 - 01:45 PM
I have been enjoying your turtle code for a while. The nice things about turtles is the cost and this allows me to run multiple turtles at the same time to clear a larger area faster than I could otherwise. Having 4 turtles clear four 20x20 areas is a fast way to get resources.

That said, I have a few issues and suggestions. Issues wise, I have found that in 1.4.7 (Playing on a Feed the Beast MindCrack server) the turtle running 0.7 will not restart after a server restart. I waited 30 minutes and had to go hunting for the little guy. Found him and right clicking him showed he was trying to "resume…." but the turtle was not.

As for suggestions and questions.

1. Do you have any plans to allow the turtle to use a resupply upgrade and station (link)? This just seems to be a good way to get the turtle supplied with fuel without it having to trek around.

2. Could you consider adding a function that changes what way the turtle goes. Currently the turtle goes forward and to the right. I would very much like to have a parameter, may be OreQuarry [R/L] (Distance) {Current Height}, where selecting R allows a right turn, and L offers a left turn. Going left would swap where the fuel chest is to the right, allowing two turtles to share one chest of fuel.

3. Could it also be considered to have a rednet recall command tool. I do dislike going after turtles and most of mine have a wireless component. It would be nice to be able to use a computer to return the turtle to its starting position.


Ok, done…thank you for this excellent tool and please keep up the excellent work.

Thanks for this - I'll need to look into the restart issue - not something that I had been experiencing so not aware of it.

I'm afraid I don't currently have any plans to implement any of your suggestions! The next thing on the features list is to define which layers the turtle mines, but I still haven't got round to that….

Out of interest, why would you like the turtle to be able to go left as well as right?

Simplicity of setup. Right now I have to space two turtle out by their distance value. I like 20 x 20 areas so I have to place two fuel chests, two gather chests, 21 lengths of pipe, two redstone engines…etc. The idea I had was to have the turtle side by side almost, one goes 20 forward and to the left, the other goes 20 and to the right. They could share a fuel chest and it would reduce setup and piping. Plus I could pick both up in close proximity to one another. It is an efficiency thing really, and just an idea…but from my use of turtles…one that makes some sense.
AustinKK #407
Posted 21 April 2013 - 10:23 AM
I have been enjoying your turtle code for a while. The nice things about turtles is the cost and this allows me to run multiple turtles at the same time to clear a larger area faster than I could otherwise. Having 4 turtles clear four 20x20 areas is a fast way to get resources.

That said, I have a few issues and suggestions. Issues wise, I have found that in 1.4.7 (Playing on a Feed the Beast MindCrack server) the turtle running 0.7 will not restart after a server restart. I waited 30 minutes and had to go hunting for the little guy. Found him and right clicking him showed he was trying to "resume…." but the turtle was not.

As for suggestions and questions.

1. Do you have any plans to allow the turtle to use a resupply upgrade and station (link)? This just seems to be a good way to get the turtle supplied with fuel without it having to trek around.

2. Could you consider adding a function that changes what way the turtle goes. Currently the turtle goes forward and to the right. I would very much like to have a parameter, may be OreQuarry [R/L] (Distance) {Current Height}, where selecting R allows a right turn, and L offers a left turn. Going left would swap where the fuel chest is to the right, allowing two turtles to share one chest of fuel.

3. Could it also be considered to have a rednet recall command tool. I do dislike going after turtles and most of mine have a wireless component. It would be nice to be able to use a computer to return the turtle to its starting position.


Ok, done…thank you for this excellent tool and please keep up the excellent work.

Thanks for this - I'll need to look into the restart issue - not something that I had been experiencing so not aware of it.

I'm afraid I don't currently have any plans to implement any of your suggestions! The next thing on the features list is to define which layers the turtle mines, but I still haven't got round to that….

Out of interest, why would you like the turtle to be able to go left as well as right?

Simplicity of setup. Right now I have to space two turtle out by their distance value. I like 20 x 20 areas so I have to place two fuel chests, two gather chests, 21 lengths of pipe, two redstone engines…etc. The idea I had was to have the turtle side by side almost, one goes 20 forward and to the left, the other goes 20 and to the right. They could share a fuel chest and it would reduce setup and piping. Plus I could pick both up in close proximity to one another. It is an efficiency thing really, and just an idea…but from my use of turtles…one that makes some sense.

Have you tried putting an ender chest down and placing four turtles each with their backs to the chest, but facing in the four different directions? That way, each turtle mines to the right and you cover a large area without any of them colliding. Only issue is that you don't mine directly below the chest itself, but normally that's not too much of a problem.
SyberSmoke #408
Posted 21 April 2013 - 12:08 PM
I have been enjoying your turtle code for a while. The nice things about turtles is the cost and this allows me to run multiple turtles at the same time to clear a larger area faster than I could otherwise. Having 4 turtles clear four 20x20 areas is a fast way to get resources.

That said, I have a few issues and suggestions. Issues wise, I have found that in 1.4.7 (Playing on a Feed the Beast MindCrack server) the turtle running 0.7 will not restart after a server restart. I waited 30 minutes and had to go hunting for the little guy. Found him and right clicking him showed he was trying to "resume…." but the turtle was not.

As for suggestions and questions.

1. Do you have any plans to allow the turtle to use a resupply upgrade and station (link)? This just seems to be a good way to get the turtle supplied with fuel without it having to trek around.

2. Could you consider adding a function that changes what way the turtle goes. Currently the turtle goes forward and to the right. I would very much like to have a parameter, may be OreQuarry [R/L] (Distance) {Current Height}, where selecting R allows a right turn, and L offers a left turn. Going left would swap where the fuel chest is to the right, allowing two turtles to share one chest of fuel.

3. Could it also be considered to have a rednet recall command tool. I do dislike going after turtles and most of mine have a wireless component. It would be nice to be able to use a computer to return the turtle to its starting position.


Ok, done…thank you for this excellent tool and please keep up the excellent work.

Thanks for this - I'll need to look into the restart issue - not something that I had been experiencing so not aware of it.

I'm afraid I don't currently have any plans to implement any of your suggestions! The next thing on the features list is to define which layers the turtle mines, but I still haven't got round to that….

Out of interest, why would you like the turtle to be able to go left as well as right?

Simplicity of setup. Right now I have to space two turtle out by their distance value. I like 20 x 20 areas so I have to place two fuel chests, two gather chests, 21 lengths of pipe, two redstone engines…etc. The idea I had was to have the turtle side by side almost, one goes 20 forward and to the left, the other goes 20 and to the right. They could share a fuel chest and it would reduce setup and piping. Plus I could pick both up in close proximity to one another. It is an efficiency thing really, and just an idea…but from my use of turtles…one that makes some sense.

Have you tried putting an ender chest down and placing four turtles each with their backs to the chest, but facing in the four different directions? That way, each turtle mines to the right and you cover a large area without any of them colliding. Only issue is that you don't mine directly below the chest itself, but normally that's not too much of a problem.

This assumes access to enderchests. Starting in a new MindCrack realm can make that path rather difficult with out having a Minium stone to make the blaze rods. Plus I am also a little new to the game so fighting blazes no less finding them is…a learning experience. Yeah I know Nether Fortresses.

Plus…isn;t the fuel chest to the left of the turtle with the dump chest to the rear? How would the turtle get fuel out of the dump chest?
Jazzer_Dude #409
Posted 22 April 2013 - 06:57 AM
I have a problem where the turtle doesn't go to the chest to unload all its items. It just spits out them on the floor. Any ideas for help?

Also in v0.7 does the turtle go left instead of right like in your youtube videos?

Thanks for any help in advance! Love the quarry program a lot! Keep up the good work!
AustinKK #410
Posted 22 April 2013 - 10:25 PM
I have a problem where the turtle doesn't go to the chest to unload all its items. It just spits out them on the floor. Any ideas for help?

Also in v0.7 does the turtle go left instead of right like in your youtube videos?

Thanks for any help in advance! Love the quarry program a lot! Keep up the good work!

What's the context of the turtle not dropping items into the chest - can you upload an image or a screenshot?

In v0.7 the turtle still goes right.
trollsama #411
Posted 23 April 2013 - 10:38 AM
Hay, Will start by saying thanks for creating and maintaining this program. it is fantastic! basically everyone on the FTB server i play on run this program for our mining needs.
But as you can probably guess, thats not what i came here to say :P/>….

Recently me, and a few others on the server have been getting 2 issues rather frequently.
1) "Too long without yielding"
none of us are completely sure what is causing this error. it seems to just pop up at random. its not too frequent but it has happened more than once so i have noted it here.

2)"Failed To Resume"
the Turtle, whenever it "force stops", be it from a server restart or what have you. it does not resume, but rather tosses the failed to resume error (twice oddly when the system does a restart, once if you manually try to restart)
This has been happening commonly across all the turtles, using both of the pastebin links you provide (mind you, i think they have been merged and have the same code in both, so that's likely irrelevant)
It appears to create the files needed for the restart properly, (orequarrylocation.txt, orequarryparams.txt, orequarryreturn.txt, startup, startup_bak) but doesn't want to execute.
any idea how we could fix this issue?

(p.s. the quarries are all being run in mystcraft worlds… I don't think this should be relevent as how or why the world restarts shouldn't really impact the code, but i could be wrong so i noted it just in case.)
stonecold913 #412
Posted 30 April 2013 - 09:18 PM
on the server with my friends we were having some issues with the latest build of the quarry.

We would set them up, and as they were digging they would either die mid dig, not come up for fuel or anything, or they would loose their way in the world and forget where home is.

Any ideas about this?
Bigglesworth #413
Posted 01 May 2013 - 07:58 PM
How fast does a single turtle quarry out 8x8x64 now? Hmmm I suppose Ill edit this after trying it out again myself.

Id assume it would go 10-15% faster with the enderchest drop method too.
SyberSmoke #414
Posted 04 May 2013 - 02:26 PM
AustinKK: I had one last thought for your program, take it, leave it…either is cool. The idea is simple, the ability to set a depth range for the turtle to work. May be say OreQuarry <Area> <Mine Ceiling> <Mine Floor>.

Reasoning: Some times I am just looking for a single thing, say diamonds or Redstone. I know the ranges for those, but do not need any minerals that may be higher. So in this way I can set the turtle to mine a certain depth to get the minerals I need with out getting a billion stacks of other goods.

Additionally, This makes mining out a lake or an ocean area possible. By setting the turtle to a ceiling height below the ocean floor, the turtle will not waste time swimming for no reason. And since the turtle only makes a few small holes, latency from the running water is minimal. Bee even cooler if the holes could be plugged as a final action…but one thing at a time. B)/>


on the server with my friends we were having some issues with the latest build of the quarry.

We would set them up, and as they were digging they would either die mid dig, not come up for fuel or anything, or they would loose their way in the world and forget where home is.

Any ideas about this?

Where did you set them up, was it outside of where you typically were? If you leave the area and the chunks the turtles are in unload, then the turtle may not resume and will just stop. To prevent this, you need either a Chunk loader, World Anchor, or Chunk Loader Mining Turtles so that the chunks they are in stay active.
Sn3akr #415
Posted 06 May 2013 - 04:18 AM
First of all.. This is an AWESOME program, which i've been using for a long time and have followed it's development. KEEP UP THE GOOD JOB :D/> ;)/>

What i'd like to see for changes???

First of all, i would like to see REDNET support for remote turtle control, something like the ULTIMATE WOOD CHOPPER (u can propably peak at his code for ease of workload or perhaps u could help eachother out?? :D/> ) has added recently, that would be really awesome, i would love to be able to control 2+ turtles at the same time.

My dream scenario would be:

I put down 2-6 turtles on a line evenly spaced out, then i put down my computer and type in OreQuarry..

Then a menu pops up and says:


OreQuary

———————

by AustinKK


Quarry Programs

Turtle Controls

Help

Credits


Exit


Quarry programs:
This shoud hold the different program options for running digging programs, e.g.

Normal quarry (for digging everything)

Layer dig (for digging for specific ores 1-16 for diamonds, top-30 for copper (not sure of the layers off the top of my head) etc. this would also be handy for digging out rooms/caves for players if u leave out the noiseblocks in the turtle)
(Normal or flat bedrock options in both programs (in FTB ultimate, the bedrock is flat at level 1), and also option for normal setup or endechest supported digging, so turtle doesn't have to go up)

Insert good idea here!

Insert good idea here!


Turtle Controls:

This should be used for moving control for the turtles, up down forward, back, left, right, go to coords (if people have done GPS system (i personally use the GPS-launcher found on this forum aswell for easy setup)
option for moving single or all turtles at once, for easier moving all turtles to next dig site (if u dug out 20x20 u could have turtles pick up the ender-/chest and move forward 20, place ender-/chest behind, turn around and be rdy for the next dig, all u had to do then, is to move the computer in range)


Terminate option (if u want to move out of where u currently are and setup in a new location/mystcraft world. This should also bring the turtle back to top)

Status (this should call the turtle to let u know if it's still running or if u need to go retrieve it (the only reason u would ever have to go down and look for ur turtle would be if anything broke))

Help:

Support (make turtle send a link to this site to the chat, (not sure if that's even possible?) otherwise just show the link :P/>


Credits:

This is where u tell ur user how hard u have worked on this and how much we should appreciate it, and that we should all worship u :huh:/> :lol:/> (then u can make a small not on who else contributed if any)


Exit:

If this need further explanation, plz take a break from programming, go on a vacation and come back once ur rested :D/>

Regards Sn3akr
SyberSmoke #416
Posted 08 May 2013 - 04:22 PM
Due to an error on my part (I placed the fuel chest on the wrong side) my turtle ran out of fuel running the program. I am wondering how often it will check if there is fuel. I have put more fuel into the turtle and it has stated "Completely out of Fuel!!" five times.

As a suggestion though, it would be nice in moments like this to have a message that says say:

"The turtle has run out of fuel and can not go further. Please place fuel in slot 16 and press enter to resume"

:-)


Note: Placing a block under a turtle in the state described above gets it working again…go figure.
Feyriin #417
Posted 09 May 2013 - 02:24 AM
I'm having a problem where the turtle runs out of fuel and stops mid run, and doesn't get more from the chest. I'm using an enderchest. Any clue what I'm doing wrong? Does it -have- to be a normal chest next to the turtle?

Thanks
MonthOLDpickle #418
Posted 10 May 2013 - 09:26 AM
Okay I have an issue. Program worked fine the first time. Now I go to do it again elsewhere..and it just goes off on by itself without any setup..like size and direction…how do I have it not go on its own everytime I place it down? Its really annoying..it doesn't even go the RIGHT way lol (AS in takes a right when it should go left).
LazyNub #419
Posted 11 May 2013 - 03:39 AM
Long time user of this great turtle program, great work and thank you!

I just wanted to mention a possible area for future updates..

You see I hate the cobble and dirt and gravel with a passion.. I hate sorting them out, toting them around. overflowing an inventory too fast .. so on..

So I added a "compression" loop in your inventory check function that does a quick drop of all "noiseBlocks" and repacks that ores to make 100% sure it needs

to abandon the quarrying and burn time and fuel and storage space dropping off at the surface.

It may not save much time but it ensures zero noiseBlocks and saves a pretty good percentage on fuel costs too.

Just a thought..

Thanks again!
SyberSmoke #420
Posted 11 May 2013 - 03:13 PM
Okay I have an issue. Program worked fine the first time. Now I go to do it again elsewhere..and it just goes off on by itself without any setup..like size and direction…how do I have it not go on its own everytime I place it down? Its really annoying..it doesn't even go the RIGHT way lol (AS in takes a right when it should go left).

It sounds like the program was interrupted at some point. See if the turtle has a "startup" program by using ls at the command prompt. if startup is one of the listed programs, type "rm startup"…no quotes. rm is the remove command and will delete the startup program.

Also, to force terminate a program if the moment the turtle is placed it runs off, hold left ctrl + T, this will terminate the program and allow you to remove the startup file.


Long time user of this great turtle program, great work and thank you!

I just wanted to mention a possible area for future updates..

You see I hate the cobble and dirt and gravel with a passion.. I hate sorting them out, toting them around. overflowing an inventory too fast .. so on..

So I added a "compression" loop in your inventory check function that does a quick drop of all "noiseBlocks" and repacks that ores to make 100% sure it needs

to abandon the quarrying and burn time and fuel and storage space dropping off at the surface.

It may not save much time but it ensures zero noiseBlocks and saves a pretty good percentage on fuel costs too.

Just a thought..

Thanks again!

I would be interested in getting your version. Why not pastebin it and also list the section of code here for Austin to use if he wishes.
SyberSmoke #421
Posted 11 May 2013 - 07:58 PM
I am having a issue with the program. For some reason, with out warning the turtle will change it's dump location. this has happened a couple times so far and it is a little annoying as it will destroy the dump chest or fuel chest. I do not know if this has to do with some server issues we have been having…but if this helps to make a more stable tool, then I am for it.

In the most recent incident, the turtle started at -2185, 65, 1850. But when I found it it had moved on space south to -2186.

I retrieved the three txt files.

Location
Spoiler

OreQuarryLocation.txt
3.0
0.0
65.0
0.0
2.0

Params
Spoiler

20.0
65.0
3.0
14.0

Return
Spoiler

n
y
19.0
47.0
17.0
2.0
44.0
1.0
3.0

If there is any more I can help with I am open to it and will be watching this thread.
LazyNub #422
Posted 11 May 2013 - 08:57 PM
I would be interested in getting your version. Why not pastebin it and also list the section of code here for Austin to use if he wishes.

Sounds like a plan..

The pastebin for the full program with the changes is: http://pastebin.com/KGK73dHn

The bulk of changes are in this one function:


function ensureInventorySpace()

– If already returning to start, then don't need to do anything
if (returningToStart == false) then
– If the last inventory slot is full, then need to return to the start and empty
if (turtle.getItemCount(lastEmptySlot) > 0 and hascompressed) then
returnToStartAndUnload(true)
end
if (turtle.getItemCount(lastEmptySlot) > 0 and not hascompressed) then

– Compress Inventory before leaving to unload

– print ("Attempting Compression")

– drop noise blocks

for i = 1,noiseBlocksCount do
turtle.select(i)
for j = noiseBlocksCount+1,lastEmptySlot do
if turtle.compareTo(j) then
turtle.select(j)
turtle.dropDown()
turtle.select(i)
end
end
end

– compress empty slots to top

for i = noiseBlocksCount+1,lastEmptySlot do
if turtle.getItemCount(i) then
for j = noiseBlocksCount+1,i do
if turtle.getItemCount(j) == 0 then
turtle.select(i)
turtle.transferTo(j)
end
end
end
end
– set one time compress per circuit to true

if turtle.getItemCount(lastEmptySlot-1)>0 then
– print ("Compressing done")
hascompressed = true
else
– print ("Compression sucessful")
end
end
if (turtle.getItemCount(lastEmptySlot) > 0 ) then
– Return to the starting point and empty the inventory, then go back to mining
returnToStartAndUnload(true)
end
end
end

Rather sloppy bolt on coding there but it does what I wanted. No need to alter the way you use the
program it just works.

I hope someone will fix it up and make it "pretty"
Irru #423
Posted 12 May 2013 - 06:49 AM
I am having a bit of a problem with the program. Two times now my turtle have stopped in the middle of the dig.
This is the error the program produces when it stops: http://i.imgur.com/ZbulZkS.png
The chuck was loaded the whole time.
I forgot to take note of what level it stopped on last quarry I made but it was about the same.
Anyone know whats wrong?

EDIT: Restarted Minecraft and the turtle continued mining from where it broke down.

EDIT2: Made a new quarry and so far it has stoppe twice. Once when digging out around the bedrock and once when going back from depositing stuff in the chest. Still the same error message.
LazyNub #424
Posted 12 May 2013 - 05:18 PM
529 is where it attempts to update the location file.

I would start fresh by deleting all the files , make sure you label the turtle and redownload the pastebin and see if that helps.

Other than that I don't know :/
LazyNub #425
Posted 12 May 2013 - 09:09 PM
I always wanted the option to set how far down the mining would start.

For instance say I want only level 25 to bedrock mined.

Well I added a new argument to the command line.

Now you can specify how many layers from the top you DONT want mined out.

Example: I'm at lvl 100 and I only want to mine a 9 x 9 area from lvl 25 to bedrock my command line would be

Quarry 9 100 75

That would mine out a 9x9 area starting 75 levels down going to bedrock ONLY.

If you dont want to define a starting layer just leave it out and it will function as original.

http://pastebin.com/KGK73dHn
SyberSmoke #426
Posted 13 May 2013 - 02:20 PM
I always wanted the option to set how far down the mining would start.

For instance say I want only level 25 to bedrock mined.

Well I added a new argument to the command line.

Now you can specify how many layers from the top you DONT want mined out.

Example: I'm at lvl 100 and I only want to mine a 9 x 9 area from lvl 25 to bedrock my command line would be

Quarry 9 100 75

That would mine out a 9x9 area starting 75 levels down going to bedrock ONLY.

If you dont want to define a starting layer just leave it out and it will function as original.

http://pastebin.com/KGK73dHn

Instead of having to work the math and find how many levels down the program will end, what about using defined layers as things do seem (from my limited perspective) to know a layer value. So what about a way to select a specific range of layers instead of just bedrock. So say a minimum depth and maximum depth for more targeted mining and targeted mining like in oceans? Really…why try to mine 10 layers of water. And with the addition of Abysal Geodes from Railcraft…oceanic mining is very profitable.
LazyNub #427
Posted 13 May 2013 - 08:17 PM
Instead of having to work the math and find how many levels down the program will end, what about using defined layers as things do seem (from my limited perspective) to know a layer value. So what about a way to select a specific range of layers instead of just bedrock. So say a minimum depth and maximum depth for more targeted mining and targeted mining like in oceans? Really…why try to mine 10 layers of water. And with the addition of Abysal Geodes from Railcraft…oceanic mining is very profitable.

You know, I was thinking about it this morning and you already have this ability with this change..

So youre standing on lvl 100 and you want to mine a 9x9 area at only level 50 to 75 all you have to enter is

quarry 9 75 50

I do agree its a weird math problem to do but without breaking the original argument entry method

I don't know how to make the changes.

I'll think on it. I hate math.. It's not the LazyNub way of things.


On another note, the new functionality I added is NOT persistent yet either.
marceloclp #428
Posted 13 May 2013 - 09:56 PM
Hey! So, I've been using this program, but when I need to turn off the program, I just… can't. Well, at my singleplayer world, I just hold Ctrl+T and it turn off, but as soon as I place the turtle back to the ground, it starts running again. At the multiplayer, even when I hold Ctrl+T, it does not happen anything. Is there a secret way to turn it off? Thanks for the program, it's really nice :D/>
SyberSmoke #429
Posted 14 May 2013 - 03:27 AM
Hey! So, I've been using this program, but when I need to turn off the program, I just… can't. Well, at my singleplayer world, I just hold Ctrl+T and it turn off, but as soon as I place the turtle back to the ground, it starts running again. At the multiplayer, even when I hold Ctrl+T, it does not happen anything. Is there a secret way to turn it off? Thanks for the program, it's really nice :D/>

Well if you can wrangle the turtle and use ctrl+T, you also need to remove the startup program using "rm startup" this will keep the turtle from self activating.
SyberSmoke #430
Posted 14 May 2013 - 03:50 AM
Instead of having to work the math and find how many levels down the program will end, what about using defined layers as things do seem (from my limited perspective) to know a layer value. So what about a way to select a specific range of layers instead of just bedrock. So say a minimum depth and maximum depth for more targeted mining and targeted mining like in oceans? Really…why try to mine 10 layers of water. And with the addition of Abysal Geodes from Railcraft…oceanic mining is very profitable.

You know, I was thinking about it this morning and you already have this ability with this change..

So youre standing on lvl 100 and you want to mine a 9x9 area at only level 50 to 75 all you have to enter is

quarry 9 75 50

I do agree its a weird math problem to do but without breaking the original argument entry method

I don't know how to make the changes.

I'll think on it. I hate math.. It's not the LazyNub way of things.


On another note, the new functionality I added is NOT persistent yet either.

What about using what is there? I mean as I understand it, he has it goes in that it goes to bedrock, but if it is looking for chests it also uses a different level. So with out the chest search it heads to lvl 6. With the chest search it goes to five and has a different pattern. Could you tap into that and say with chest off (probably a simple query there: "Would you like to look for chests? Y/N" "Please place a chest in slot 15 and press space to continue" on yes. Any way…Could you inject a new bas height into the system so that on entering a value the turtle will choose that as it's starting depth.

I love the program, I think Austin or another need to also make it a little user friendly. GPSExcavate (link) is great for user friendliness, literally walking you through each necessary step. Love that about that program.
LazyNub #431
Posted 14 May 2013 - 05:21 AM
[
What about using what is there? I mean as I understand it, he has it goes in that it goes to bedrock, but if it is looking for chests it also uses a different level. So with out the chest search it heads to lvl 6. With the chest search it goes to five and has a different pattern. Could you tap into that and say with chest off (probably a simple query there: "Would you like to look for chests? Y/N" "Please place a chest in slot 15 and press space to continue" on yes. Any way…Could you inject a new bas height into the system so that on entering a value the turtle will choose that as it's starting depth.

I love the program, I think Austin or another need to also make it a little user friendly. GPSExcavate (link) is great for user friendliness, literally walking you through each necessary step. Love that about that program.

I will just change it to 4 entries..
1st : size of quarry square
2nd: number of levels to bedrock
3rd: level to start digging from
4th: level to dig up to

I plan to add ender chest usage to it after this too. I see turtles as a great way to automate early game and
I always saw ender chests as mid to later game, but the more I use turtles the more I've changed my mind.

once they have 2 ender chests they can both send ore back and receive fuel. I know they make chunkloaders
for them now so there would never be a reason for them to stop. Just finish one quarry move over another 64
blocks and keep going, forever.

My lazy dreams come true.
SyberSmoke #432
Posted 14 May 2013 - 03:22 PM
[
What about using what is there? I mean as I understand it, he has it goes in that it goes to bedrock, but if it is looking for chests it also uses a different level. So with out the chest search it heads to lvl 6. With the chest search it goes to five and has a different pattern. Could you tap into that and say with chest off (probably a simple query there: "Would you like to look for chests? Y/N" "Please place a chest in slot 15 and press space to continue" on yes. Any way…Could you inject a new bas height into the system so that on entering a value the turtle will choose that as it's starting depth.

I love the program, I think Austin or another need to also make it a little user friendly. GPSExcavate (link) is great for user friendliness, literally walking you through each necessary step. Love that about that program.

I will just change it to 4 entries..
1st : size of quarry square
2nd: number of levels to bedrock
3rd: level to start digging from
4th: level to dig up to

I plan to add ender chest usage to it after this too. I see turtles as a great way to automate early game and
I always saw ender chests as mid to later game, but the more I use turtles the more I've changed my mind.

once they have 2 ender chests they can both send ore back and receive fuel. I know they make chunkloaders
for them now so there would never be a reason for them to stop. Just finish one quarry move over another 64
blocks and keep going, forever.

My lazy dreams come true.

I hope Ender Chests will be optional. In the current world I am playing in…I can not find a blaze rod to save my life. Now killing Endermen…that is easy and I have been using Tesseracts. :-)
LazyNub #433
Posted 15 May 2013 - 02:41 AM
I plan to add ender chest usage to it after this too. I see turtles as a great way to automate early game and
I always saw ender chests as mid to later game, but the more I use turtles the more I've changed my mind.

once they have 2 ender chests they can both send ore back and receive fuel. I know they make chunkloaders
for them now so there would never be a reason for them to stop. Just finish one quarry move over another 64
blocks and keep going, forever.

My lazy dreams come true.

I hope Ender Chests will be optional. In the current world I am playing in…I can not find a blaze rod to save my life. Now killing Endermen…that is easy and I have been using Tesseracts. :-)

Yeah, optional for sure.

I will move out of AustinKK's thread now as to not confuse my thoughts on features with Austin's fine work.
If/when I make any changes I'll make a separate post entry.
AustinKK #434
Posted 16 May 2013 - 12:35 PM
Instead of having to work the math and find how many levels down the program will end, what about using defined layers as things do seem (from my limited perspective) to know a layer value. So what about a way to select a specific range of layers instead of just bedrock. So say a minimum depth and maximum depth for more targeted mining and targeted mining like in oceans? Really…why try to mine 10 layers of water. And with the addition of Abysal Geodes from Railcraft…oceanic mining is very profitable.

You know, I was thinking about it this morning and you already have this ability with this change..

So youre standing on lvl 100 and you want to mine a 9x9 area at only level 50 to 75 all you have to enter is

quarry 9 75 50

I do agree its a weird math problem to do but without breaking the original argument entry method

I don't know how to make the changes.

I'll think on it. I hate math.. It's not the LazyNub way of things.


On another note, the new functionality I added is NOT persistent yet either.
If you want to change the level to which the turtle mines, you can change the line:

local bottomLayer = 5 – The y co-ords of the layer immediately above bedrock




to a higher number. If you want it only to mine to level 30 for instance, change it to:


local bottomLayer = 30 – The y co-ords of the layer immediately above bedrock

Maybe it should be a command-line parameter, but I'm afraid for now, it isn't :rolleyes:/>




I plan to add ender chest usage to it after this too. I see turtles as a great way to automate early game and
I always saw ender chests as mid to later game, but the more I use turtles the more I've changed my mind.

once they have 2 ender chests they can both send ore back and receive fuel. I know they make chunkloaders
for them now so there would never be a reason for them to stop. Just finish one quarry move over another 64
blocks and keep going, forever.

My lazy dreams come true.

I hope Ender Chests will be optional. In the current world I am playing in…I can not find a blaze rod to save my life. Now killing Endermen…that is easy and I have been using Tesseracts. :-)

Yeah, optional for sure.

I will move out of AustinKK's thread now as to not confuse my thoughts on features with Austin's fine work.
If/when I make any changes I'll make a separate post entry.

No need to go elsewhere unless you want to :D/>



I plan to add ender chest usage to it after this too. I see turtles as a great way to automate early game and
I always saw ender chests as mid to later game, but the more I use turtles the more I've changed my mind.

once they have 2 ender chests they can both send ore back and receive fuel. I know they make chunkloaders
for them now so there would never be a reason for them to stop. Just finish one quarry move over another 64
blocks and keep going, forever.

My lazy dreams come true.

I hope Ender Chests will be optional. In the current world I am playing in…I can not find a blaze rod to save my life. Now killing Endermen…that is easy and I have been using Tesseracts. :-)

Yeah, optional for sure.

I will move out of AustinKK's thread now as to not confuse my thoughts on features with Austin's fine work.
If/when I make any changes I'll make a separate post entry.
Instead of having to work the math and find how many levels down the program will end, what about using defined layers as things do seem (from my limited perspective) to know a layer value. So what about a way to select a specific range of layers instead of just bedrock. So say a minimum depth and maximum depth for more targeted mining and targeted mining like in oceans? Really…why try to mine 10 layers of water. And with the addition of Abysal Geodes from Railcraft…oceanic mining is very profitable.

You know, I was thinking about it this morning and you already have this ability with this change..

So youre standing on lvl 100 and you want to mine a 9x9 area at only level 50 to 75 all you have to enter is

quarry 9 75 50

I do agree its a weird math problem to do but without breaking the original argument entry method

I don't know how to make the changes.

I'll think on it. I hate math.. It's not the LazyNub way of things.


On another note, the new functionality I added is NOT persistent yet either.

What about using what is there? I mean as I understand it, he has it goes in that it goes to bedrock, but if it is looking for chests it also uses a different level. So with out the chest search it heads to lvl 6. With the chest search it goes to five and has a different pattern. Could you tap into that and say with chest off (probably a simple query there: "Would you like to look for chests? Y/N" "Please place a chest in slot 15 and press space to continue" on yes. Any way…Could you inject a new bas height into the system so that on entering a value the turtle will choose that as it's starting depth.

I love the program, I think Austin or another need to also make it a little user friendly. GPSExcavate (link) is great for user friendliness, literally walking you through each necessary step. Love that about that program.

In terms of the usability of the app - I guess it's a personal preference, but I'm not a big fan of a step-by-step approach to configuring a program. It might help the first time you do it, but every subsequent time it is a pain (IMHO).

I tried to make the application as simple as possible so that you only needed to specify a couple of command line parameters. I'm afraid I won't be adding a user interface…
SyberSmoke #435
Posted 17 May 2013 - 02:23 AM
Simple is fine, but simple can only go so far. I would not mind a smidgen of guidance where typing in OreQuarry gets you at least:

"Welcome to OreQuarry. Would you like help with setting me up? Y/N"

NO: "Please make sure I am set up properly, have noise blocks in my inventory, and enter the proper parameters below."

Yes: This would be the guided tour.

This would be simple, but remove the need for people to hunt for info on how to use the program. AND the process could be skipped by people just entering parameters as they are now also. I have fielded many questions from people using this in my guilds private server. So a tutorial in the program or in the master post would be very good.
AustinKK #436
Posted 20 May 2013 - 06:03 AM
Simple is fine, but simple can only go so far. I would not mind a smidgen of guidance where typing in OreQuarry gets you at least:

"Welcome to OreQuarry. Would you like help with setting me up? Y/N"

NO: "Please make sure I am set up properly, have noise blocks in my inventory, and enter the proper parameters below."

Yes: This would be the guided tour.

This would be simple, but remove the need for people to hunt for info on how to use the program. AND the process could be skipped by people just entering parameters as they are now also. I have fielded many questions from people using this in my guilds private server. So a tutorial in the program or in the master post would be very good.

Hmm, maybe.

The standard programs have the same interface as this program. For instance the excavate program doesn't give you a guided tour of how it works.

I'm not saying that perhaps it shouldn't be better documented (although personally, I never read documents - hence the YouTube video!! :)/>), but actually putting that documentation in the program itself - not sure.

I'd be interested in other views. Also, if someone wants to add it, then be my guest!!
SyberSmoke #437
Posted 20 May 2013 - 01:24 PM
Simple is fine, but simple can only go so far. I would not mind a smidgen of guidance where typing in OreQuarry gets you at least:

"Welcome to OreQuarry. Would you like help with setting me up? Y/N"

NO: "Please make sure I am set up properly, have noise blocks in my inventory, and enter the proper parameters below."

Yes: This would be the guided tour.

This would be simple, but remove the need for people to hunt for info on how to use the program. AND the process could be skipped by people just entering parameters as they are now also. I have fielded many questions from people using this in my guilds private server. So a tutorial in the program or in the master post would be very good.

Hmm, maybe.

The standard programs have the same interface as this program. For instance the excavate program doesn't give you a guided tour of how it works.

I'm not saying that perhaps it shouldn't be better documented (although personally, I never read documents - hence the YouTube video!! :)/>), but actually putting that documentation in the program itself - not sure.

I'd be interested in other views. Also, if someone wants to add it, then be my guest!!

I can see the point of not seeing the value in adding material like this. It takes time and effort and there is no clear gain. But having worked with people or talked with people about turtles and CC, many find it imposing.

Your program is as fast if not faster then using a quarry. In Mindcrack a quarry costs allot of resources and setup where as a turtle is far less. The problem is perception, That silly command line interface they have scare people off. CC is a great mod with allot of functionality and versatility…but there is a curve and many people do not wish to work through it.

I just feel that accessibility should be a goal for many people that program CC programs. That way it can attract more people to it and may be get more people interested in adding to it. That is my peace.
AustinKK #438
Posted 23 May 2013 - 04:57 PM
Simple is fine, but simple can only go so far. I would not mind a smidgen of guidance where typing in OreQuarry gets you at least:

"Welcome to OreQuarry. Would you like help with setting me up? Y/N"

NO: "Please make sure I am set up properly, have noise blocks in my inventory, and enter the proper parameters below."

Yes: This would be the guided tour.

This would be simple, but remove the need for people to hunt for info on how to use the program. AND the process could be skipped by people just entering parameters as they are now also. I have fielded many questions from people using this in my guilds private server. So a tutorial in the program or in the master post would be very good.

Hmm, maybe.

The standard programs have the same interface as this program. For instance the excavate program doesn't give you a guided tour of how it works.

I'm not saying that perhaps it shouldn't be better documented (although personally, I never read documents - hence the YouTube video!! :)/>), but actually putting that documentation in the program itself - not sure.

I'd be interested in other views. Also, if someone wants to add it, then be my guest!!

I can see the point of not seeing the value in adding material like this. It takes time and effort and there is no clear gain. But having worked with people or talked with people about turtles and CC, many find it imposing.

Your program is as fast if not faster then using a quarry. In Mindcrack a quarry costs allot of resources and setup where as a turtle is far less. The problem is perception, That silly command line interface they have scare people off. CC is a great mod with allot of functionality and versatility…but there is a curve and many people do not wish to work through it.

I just feel that accessibility should be a goal for many people that program CC programs. That way it can attract more people to it and may be get more people interested in adding to it. That is my peace.

How about we meet in the middle and I make a new "Quick Start" video and stick it on YouTube? :rolleyes:/>
SyberSmoke #439
Posted 23 May 2013 - 05:02 PM
Add a quick reference guide in the post and it sounds like a good deal for those that need to look something up quick.

Or may be an OreQuarry help command… ;-)

On a less harping note, I do have one technical suggestion:

I would like to suggest that if a turtle using this program does not have a diamond pickaxe, it is hard coded that it will not collect Iridium Ore. A turtle using a Gem Pickaxe will destroy the iridium ore instead of mine it. And Iridium is…pricey.

I would like to also suggest that if a turtle does fine iridium, that the option be given to have it mined or to note where it was and at the end of the mining cycle print that location "Iridium found at X, Y, Z" for each instance. That way a player can go and harvest the iridium them selves using a silk touch item.
CupricWolf #440
Posted 23 May 2013 - 06:14 PM
Add a quick reference guide in the post and it sounds like a good deal for those that need to look something up quick.

Or may be an OreQuarry help command… ;-)

On a less harping note, I do have one technical suggestion:

I would like to suggest that if a turtle using this program does not have a diamond pickaxe, it is hard coded that it will not collect Iridium Ore. A turtle using a Gem Pickaxe will destroy the iridium ore instead of mine it. And Iridium is…pricey.

I would like to also suggest that if a turtle does fine iridium, that the option be given to have it mined or to note where it was and at the end of the mining cycle print that location "Iridium found at X, Y, Z" for each instance. That way a player can go and harvest the iridium them selves using a silk touch item.
How will the turtle know that it has encountered Iridium? Also how will it know what tool it has? This program has to work with "vanilla" minecraft too, where Iridium doesn't exist, nor do gem pickaxes.
SyberSmoke #441
Posted 23 May 2013 - 06:54 PM
All of the items have an item id. A Gem Turtle has a different ID then a Diamond turtle (I think…some where). You could also tell the program in a setup that it has a gem or diamond. This will of coarse get easier when slots and tool damage are added to CC.

As for the ore, all that the turtle needs is the ore blocks ID. If I understand it, we place noise blocks in so the turtle has an ID value to compare when it is digging. The ID for Iridium Ore (The block, not the drop) is static and so could be hard coded into the compare system. If the ID is never encountered….you would never know it was there.

As for vanilla…heh.Vanilla is dull, get some chocolate, a few sprinkles, and a banana.
AustinKK #442
Posted 24 May 2013 - 04:08 AM
All of the items have an item id. A Gem Turtle has a different ID then a Diamond turtle (I think…some where). You could also tell the program in a setup that it has a gem or diamond. This will of coarse get easier when slots and tool damage are added to CC.

As for the ore, all that the turtle needs is the ore blocks ID. If I understand it, we place noise blocks in so the turtle has an ID value to compare when it is digging. The ID for Iridium Ore (The block, not the drop) is static and so could be hard coded into the compare system. If the ID is never encountered….you would never know it was there.

As for vanilla…heh.Vanilla is dull, get some chocolate, a few sprinkles, and a banana.

Not sure that's going to work I'm afraid. You're right that all items have a block Id, but the way the turtle works is that it that it can only compare a block with an item in its inventory - it doesn't check for block Ids directly. That is why you need the comparison blocks in its inventory at the start.

In terms of the help command - I'll put the text of the QuickStart YouTube video in the error message that is printed if it's started with the wrong command line. I'll also put a brief text in the video description.
Lextan #443
Posted 24 May 2013 - 12:50 PM
I have a somewhat odd question, I tried using the program in a Flat Extreme Hills Mystcraft world, with a flat y of 180. It would error out when I entered 180 as the y location for the position of the turtle. Any ideas on the best way to support it, or perhaps set a max height for it to mine, from flat bedrock.

Lextan
MonthOLDpickle #444
Posted 24 May 2013 - 09:59 PM
Worked once..I go over to do the next area..it digs to bedrock and just sits there….

More indepth. I used it once already and it worked great. Did a 20x20 from like 72. I move it over and i had to go up a bit..to 88. Well it digs to bedrock than just..sits there.
MonthOLDpickle #445
Posted 24 May 2013 - 11:03 PM
I am going to have to find a different program I tried editing it etc etc but I can't wait forever lol
MonthOLDpickle #446
Posted 25 May 2013 - 05:33 AM
Hours later it still doesn't work no matter what I do. This is 1.4.7 Mindcrack (Recommended).
AustinKK #447
Posted 25 May 2013 - 04:28 PM
Hours later it still doesn't work no matter what I do. This is 1.4.7 Mindcrack (Recommended).

Can you upload a video of what it is doing?
AustinKK #448
Posted 25 May 2013 - 04:30 PM
I have a somewhat odd question, I tried using the program in a Flat Extreme Hills Mystcraft world, with a flat y of 180. It would error out when I entered 180 as the y location for the position of the turtle. Any ideas on the best way to support it, or perhaps set a max height for it to mine, from flat bedrock.

Lextan

If you change the code starting at line 1645:

  • if ((startHeight < 6) or (startHeight > 128)) then
  • writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
  • paramsOK = false
  • end

to

  • if ((startHeight < 6) or (startHeight > 256)) then
  • writeMessage("turtleY must be between 6 and 256", messageLevel.FATAL)
  • paramsOK = false
  • end

then it should work fine.

There's nothing special about the upper limit that I set for the y co-ordinate, I just wanted to set a figure that would prevent people getting the number significantly wrong, but it seems that you have a different situation that makes sense. Try the above and it should work.
dybukk #449
Posted 25 May 2013 - 07:07 PM
The pastebin for the full program with the changes is: http://pastebin.com/KGK73dHn

Nice changes LazyNub.
kingthero #450
Posted 26 May 2013 - 12:13 PM
I'm having to long to yield errors…. What is this?

And after it the program is messed up.

So messed up I can't even use it.

"Failed to resume"
Lextan #451
Posted 27 May 2013 - 10:01 AM
I have a somewhat odd question, I tried using the program in a Flat Extreme Hills Mystcraft world, with a flat y of 180. It would error out when I entered 180 as the y location for the position of the turtle. Any ideas on the best way to support it, or perhaps set a max height for it to mine, from flat bedrock.

Lextan

If you change the code starting at line 1645:
  • if ((startHeight < 6) or (startHeight > 128)) then
  • writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
  • paramsOK = false
  • end
to
  • if ((startHeight < 6) or (startHeight > 256)) then
  • writeMessage("turtleY must be between 6 and 256", messageLevel.FATAL)
  • paramsOK = false
  • end
then it should work fine.

There's nothing special about the upper limit that I set for the y co-ordinate, I just wanted to set a figure that would prevent people getting the number significantly wrong, but it seems that you have a different situation that makes sense. Try the above and it should work.


Thank you, that worked, Also I set the bedrock level to 2 to account for the flat bedrock. Running FTB Ultimate.
SyberSmoke #452
Posted 27 May 2013 - 04:01 PM
I'm having to long to yield errors…. What is this?

And after it the program is messed up.

So messed up I can't even use it.

"Failed to resume"

The Yield error means that for some reason the turtle did not take a break. So it did not stop, sleep, or what ever with in the specific loop. If it was mining when you got this, it could be a sign that your server (computer or otherwise) glitched or lagged and when it caught up, it read the program had not yielded and so threw the error to keep the server from crashing.

As for failed to resume, yeah something broke. The fix is find the turtle, hold ctrl + t if there is no command prompt. If there is a command prompt, type in "rm startup". You may need to clear the program and reload it, if you did not label the turtle, just break him. If you did label the turtle…you can RM each txt file or use "label clear" and then break the turtle. This will wipe the files and reset the turtle.
mrchbx #453
Posted 27 May 2013 - 05:58 PM
AustinKK, thanks for your great program, you are a genius :)/>

I want to share my little modification, I should say that some features copied from here already laid out the programs for which my thanks to you)

Here's a video review:
[media]http://youtu.be/dXjYx4UXh_c[/media]
PS: if the video does not show, download (41 MB): http://yadi.sk/d/HsBV_rNh5Etxa


Features:
-Support EnderChest
-Pause turtle on redstone signal
-Auto Drop dump(cobblestobe,gravel,dirt etc…)
-GPS Control (Get fuel level in turtles, send command "back" for return turtles on starting point)
-Auto refill mined coal
-The ability to specify a minimum height (OreQuarry [width quarry] [current height] [minimum height])

Programs:
OreQuarry
http://pastebin.com/8zWST7An
GPSControl
http://pastebin.com/aSne2b6n

PS: Sorry for my english :)/>
Flipz #454
Posted 27 May 2013 - 09:20 PM
Hello,

I've been trying to run OreQuarry on a server running the Direwolf20 mudpack of Feed the Beast. Unfortunately, the turtle keeps mining the Iron Chest I'm using as an output chest–why? Are there any special steps or code alterations I can make in order to fix this problem?

Thanks,

–Flipz

EDIT: Also, your tutorial video mentions that OreQuarry is compatible with a GPS system–is there one in particular that needs to be used, or will any old GPS system do?
LazyNub #455
Posted 28 May 2013 - 01:53 AM
The pastebin for the full program with the changes is: http://pastebin.com/KGK73dHn

Nice changes LazyNub.

Glad you liked it.. :)/>
Flipz #456
Posted 28 May 2013 - 03:36 PM
I am having a issue with the program. For some reason, with out warning the turtle will change it's dump location. this has happened a couple times so far and it is a little annoying as it will destroy the dump chest or fuel chest. I do not know if this has to do with some server issues we have been having…but if this helps to make a more stable tool, then I am for it.

In the most recent incident, the turtle started at -2185, 65, 1850. But when I found it it had moved on space south to -2186.

I retrieved the three txt files.

Location
Spoiler

OreQuarryLocation.txt
3.0
0.0
65.0
0.0
2.0

Params
Spoiler

20.0
65.0
3.0
14.0

Return
Spoiler

n
y
19.0
47.0
17.0
2.0
44.0
1.0
3.0

If there is any more I can help with I am open to it and will be watching this thread.

This seems to be the same problem I'm experiencing. While the change in position is annoying, what's dangerous is that it's destroying the drop chest, meaning I could potentially be losing a LOT of resources to this bug. Were you using an Iron Chest or another chest from a mod? Would it perhaps be possible to set the type of chest you're using as a "do not mine" block of some sort in the code?

Also, I'm new to coding in Lua, but I've taken a peek at the code; is there a way to make the turtle call the returnToStartAndUnload function but then wait for an input before resuming mining? I know this wouldn't be that helpful for most people, but for me it would be VERY helpful. (I'd also like the turtle to return to the start EVERY time it has to resume mining (i.e. after a server reset or being unloaded from a chunk), so I can perhaps resolve some of the problems I've been having.
SyberSmoke #457
Posted 28 May 2013 - 05:04 PM
Hello,

I've been trying to run OreQuarry on a server running the Direwolf20 mudpack of Feed the Beast. Unfortunately, the turtle keeps mining the Iron Chest I'm using as an output chest–why? Are there any special steps or code alterations I can make in order to fix this problem?

Thanks,

–Flipz

EDIT: Also, your tutorial video mentions that OreQuarry is compatible with a GPS system–is there one in particular that needs to be used, or will any old GPS system do?

An image of how you have the turtle set up would be good.

As for the GPS, there is only one GPS system and it is built into CC. So all you need to a deployment program that will do the work for you.
SyberSmoke #458
Posted 28 May 2013 - 05:27 PM
AustinKK, thanks for your great program, you are a genius :)/>

I want to share my little modification, I should say that some features copied from here already laid out the programs for which my thanks to you)

Here's a video review:
[media]http://youtu.be/dXjYx4UXh_c[/media]
PS: if the video does not show, download (41 MB): http://yadi.sk/d/HsBV_rNh5Etxa


Features:
-Support EnderChest
-Pause turtle on redstone signal
-Auto Drop dump(cobblestobe,gravel,dirt etc…)
-GPS Control (Get fuel level in turtles, send command "back" for return turtles on starting point)
-Auto refill mined coal
-The ability to specify a minimum height (OreQuarry [width quarry] [current height] [minimum height])

Programs:
OreQuarry
http://pastebin.com/8zWST7An
GPSControl
http://pastebin.com/aSne2b6n

PS: Sorry for my english :)/>

Can the turtle be told not to use gathered coal? I use the coal for the production of gregtech items and diamonds…so having the turtle eat it is not all that good for how I have been playing.
Flipz #459
Posted 28 May 2013 - 06:45 PM
Hello,

I've been trying to run OreQuarry on a server running the Direwolf20 mudpack of Feed the Beast. Unfortunately, the turtle keeps mining the Iron Chest I'm using as an output chest–why? Are there any special steps or code alterations I can make in order to fix this problem?

Thanks,

–Flipz

EDIT: Also, your tutorial video mentions that OreQuarry is compatible with a GPS system–is there one in particular that needs to be used, or will any old GPS system do?

An image of how you have the turtle set up would be good.

As for the GPS, there is only one GPS system and it is built into CC. So all you need to a deployment program that will do the work for you.

Ah, OK. I'll check the wiki, then.

Setup: The cinnabar ore represents the turtle (the torch is the front). It's inset a layer into the ground so I could cover the top and let it be hidden from potential theft.


As I saw in the tutorial video, the turtle should dig a 1x1 tunnel to bedrock, and then take that same tunnel back up to the surface. Instead, I get:


And of course, normally the iron chest has been mined out and all the drops fall to the bottom of the shaft (thankfully no lava).

*snip*

Can the turtle be told not to use gathered coal? I use the coal for the production of gregtech items and diamonds…so having the turtle eat it is not all that good for how I have been playing.

I second this suggestion.
SyberSmoke #460
Posted 28 May 2013 - 07:03 PM
I would suggest that you clear the turtle. Some times things go weird and the only way to deal with it is to clear the turtle. I find this happens if the chunk unloads and even a little if you go to bed to change the night to day.

Assuming the turtle is labeled. Just use "label clear" in the turtles interface and then break the turtle. This will wipe it clean, then just give it a new label. You will have to get the program again. But you should try to avoid letting the chunk the turtle is in unload by using a chunk loader or world anchor. The Chunk loader is awesome though. Once I started to keep my turtles in loaded chunks…I had little issue with this problem.
Flipz #461
Posted 28 May 2013 - 07:19 PM
Ah, I see. I'll have to save up for an anchor, then. Thanks for the help! (I didn't even know how to un-set a label on a turtle. :blush: )

If you get any news/make any breakthroughs on preventing coal eating from mrcbhx's modification, though, let me know–I'm especially pleased by the "stops with a redstone signal" and "drops items to enderchest" options. ;-)
LazyNub #462
Posted 28 May 2013 - 09:04 PM
I have not looked at the code but I'm pretty sure if you dont put coal as the fuel sources at start it cant search for coal to replenish with..
so just put charcoal or something in to start it with and it will not be able to refill from inventory.

Just a thought.. I'll double check this when I can.
hackmodford #463
Posted 29 May 2013 - 09:07 AM
I'm having the same issue. Where I moved it to a new location, it goes straight down and then stops once it hits bedrock.

Also is there a way to reset it so it doesn't try to resume? I'll dig it up and move it back to the top and try to put the filters back in the inventory but it automatically starts moving. I'll terminate the program with CTRL+T but when it's placed again away it goes!
AustinKK #464
Posted 29 May 2013 - 11:55 AM
AustinKK, thanks for your great program, you are a genius :)/>

I want to share my little modification, I should say that some features copied from here already laid out the programs for which my thanks to you)

Here's a video review:
[media]http://youtu.be/dXjYx4UXh_c[/media]
PS: if the video does not show, download (41 MB): http://yadi.sk/d/HsBV_rNh5Etxa


Features:
-Support EnderChest
-Pause turtle on redstone signal
-Auto Drop dump(cobblestobe,gravel,dirt etc…)
-GPS Control (Get fuel level in turtles, send command "back" for return turtles on starting point)
-Auto refill mined coal
-The ability to specify a minimum height (OreQuarry [width quarry] [current height] [minimum height])

Programs:
OreQuarry
http://pastebin.com/8zWST7An
GPSControl
http://pastebin.com/aSne2b6n

PS: Sorry for my english :)/>
Brilliant! Love it!!

You've implemented all of the changes that everyone has been asking for and saved me loads of time - thanks! :D/> :D/>

My only question would be whether you have lost the ability to detect chests in dungeons and empty them rather than breaking them. The wooden chest in slot 15 is used to compare blocks looking for chests - if you put an enderchest in there it won't work.

But great job, and I love the video (shame the quarry just about won the race though!!) :huh:/>

Hello,

I've been trying to run OreQuarry on a server running the Direwolf20 mudpack of Feed the Beast. Unfortunately, the turtle keeps mining the Iron Chest I'm using as an output chest–why? Are there any special steps or code alterations I can make in order to fix this problem?

Thanks,

–Flipz

EDIT: Also, your tutorial video mentions that OreQuarry is compatible with a GPS system–is there one in particular that needs to be used, or will any old GPS system do?

An image of how you have the turtle set up would be good.

As for the GPS, there is only one GPS system and it is built into CC. So all you need to a deployment program that will do the work for you.

Ah, OK. I'll check the wiki, then.

Setup: The cinnabar ore represents the turtle (the torch is the front). It's inset a layer into the ground so I could cover the top and let it be hidden from potential theft.


As I saw in the tutorial video, the turtle should dig a 1x1 tunnel to bedrock, and then take that same tunnel back up to the surface. Instead, I get:


And of course, normally the iron chest has been mined out and all the drops fall to the bottom of the shaft (thankfully no lava).

*snip*

Can the turtle be told not to use gathered coal? I use the coal for the production of gregtech items and diamonds…so having the turtle eat it is not all that good for how I have been playing.

I second this suggestion.
Flipz, I can't see the problem from the images, but SyberSmoke is right when he says that a chunkloader will help. The problem could be to do with the chunk loading and unloading which may make the turtle think it's in a slightly different location. The reason that I'm not sure that is the issue though is that I would expect to see it make a new shaft to the surface if it did that. There is no dig programmed when it returns to the surface, so is very strange if it is breaking the iron chest - a video would really help.

I'm having the same issue. Where I moved it to a new location, it goes straight down and then stops once it hits bedrock.

Also is there a way to reset it so it doesn't try to resume? I'll dig it up and move it back to the top and try to put the filters back in the inventory but it automatically starts moving. I'll terminate the program with CTRL+T but when it's placed again away it goes!
You might need to check your starting height parameter if it is stopping at bedrock. To stop the turtle restarting, after holding down Ctrl-T to quit the program you just need to type:

rm startup
mrchbx #465
Posted 29 May 2013 - 01:55 PM
My only question would be whether you have lost the ability to detect chests in dungeons and empty them rather than breaking them. The wooden chest in slot 15 is used to compare blocks looking for chests - if you put an enderchest in there it won't work.
Yes, this feature is already not present …
in the video turtle turned out that digging more than 480 blocks than quarry. my mistake :)/>
SyberSmoke #466
Posted 29 May 2013 - 02:12 PM
I have a feeling I know what is causing the error when the chunk unloads. My gut is telling me that the chunk unloads at the moment the turtle is moving. In many cases the turtle is standing still, but if the turtle is is unloaded when moving the turtle messes up its position. So the turtle moved one meter, the chunk unloads and the server put the turtle back, but the turtle registers that it is one block forward.

This means when the turtle returns to home it's internal count is off by one block and goes up in the wrong position. This is why I suggested a location check. The idea that the turtle will compare where is wants to be to where it is and corrects the error.
Flipz #467
Posted 29 May 2013 - 03:53 PM
As I saw in the tutorial video, the turtle should dig a 1x1 tunnel to bedrock, and then take that same tunnel back up to the surface. Instead, I get:


And of course, normally the iron chest has been mined out and all the drops fall to the bottom of the shaft (thankfully no lava).
Flipz, I can't see the problem from the images, but SyberSmoke is right when he says that a chunkloader will help. The problem could be to do with the chunk loading and unloading which may make the turtle think it's in a slightly different location. The reason that I'm not sure that is the issue though is that I would expect to see it make a new shaft to the surface if it did that. There is no dig programmed when it returns to the surface, so is very strange if it is breaking the iron chest - a video would really help.

It's a little hard to see from the screenshot, but instead of a 1x1 shaft back to the surface, there's a second 1x1 shaft that goes directly underneath the iron chest, resulting in the turtle breaking the iron chest.

I have a feeling I know what is causing the error when the chunk unloads. My gut is telling me that the chunk unloads at the moment the turtle is moving. In many cases the turtle is standing still, but if the turtle is is unloaded when moving the turtle messes up its position. So the turtle moved one meter, the chunk unloads and the server put the turtle back, but the turtle registers that it is one block forward.

This means when the turtle returns to home it's internal count is off by one block and goes up in the wrong position. This is why I suggested a location check. The idea that the turtle will compare where is wants to be to where it is and corrects the error.

The behavior of the tree farm turtle I'm using supports this–during lag spikes, the turtle seems to "teleport" or occasionally appear in two adjacent blocks at once; I also nearly lost a felling turtle when it lagged past its guidance blocks and started flying out over the ocean (fortunately, its program at the time had no resume function, so it froze when it got unloaded and I was eventually able to find it). I've switched to including chunkloaders on all of my turtles to prevent this kind of error, but perhaps this behavior should be brought to the attention of the mod developer?

Also, would a GPS system prevent this sort of error by providing the turtle a more accurate assessment of its position when it's reloaded?
SyberSmoke #468
Posted 29 May 2013 - 04:28 PM
A GPS would only work to prevent this if the turtle had an error check that compared where it should be to where it is. If the check is true then the turtle would move on. If it were false, then the turtle is in the wrong place and should correct its self and resume.
tashin #469
Posted 30 May 2013 - 12:34 AM
Is it possible to add a feature that moves the diameter and continues mining after it finishes a section? Useful with enderchest compatability.
mrchbx #470
Posted 30 May 2013 - 02:48 AM
SyberSmoke said:
Can the turtle be told not to use gathered coal? I use the coal for the production of gregtech items and diamonds…so having the turtle eat it is not all that good for how I have been playing.
in the next version will be added.

although you can in 16 slot instead of coal to lay down the lava, charcoal or other fuel, and coal will be not used.
AustinKK #471
Posted 30 May 2013 - 05:01 AM
As I saw in the tutorial video, the turtle should dig a 1x1 tunnel to bedrock, and then take that same tunnel back up to the surface. Instead, I get:


And of course, normally the iron chest has been mined out and all the drops fall to the bottom of the shaft (thankfully no lava).
Flipz, I can't see the problem from the images, but SyberSmoke is right when he says that a chunkloader will help. The problem could be to do with the chunk loading and unloading which may make the turtle think it's in a slightly different location. The reason that I'm not sure that is the issue though is that I would expect to see it make a new shaft to the surface if it did that. There is no dig programmed when it returns to the surface, so is very strange if it is breaking the iron chest - a video would really help.

It's a little hard to see from the screenshot, but instead of a 1x1 shaft back to the surface, there's a second 1x1 shaft that goes directly underneath the iron chest, resulting in the turtle breaking the iron chest.

I have a feeling I know what is causing the error when the chunk unloads. My gut is telling me that the chunk unloads at the moment the turtle is moving. In many cases the turtle is standing still, but if the turtle is is unloaded when moving the turtle messes up its position. So the turtle moved one meter, the chunk unloads and the server put the turtle back, but the turtle registers that it is one block forward.

This means when the turtle returns to home it's internal count is off by one block and goes up in the wrong position. This is why I suggested a location check. The idea that the turtle will compare where is wants to be to where it is and corrects the error.

The behavior of the tree farm turtle I'm using supports this–during lag spikes, the turtle seems to "teleport" or occasionally appear in two adjacent blocks at once; I also nearly lost a felling turtle when it lagged past its guidance blocks and started flying out over the ocean (fortunately, its program at the time had no resume function, so it froze when it got unloaded and I was eventually able to find it). I've switched to including chunkloaders on all of my turtles to prevent this kind of error, but perhaps this behavior should be brought to the attention of the mod developer?

Also, would a GPS system prevent this sort of error by providing the turtle a more accurate assessment of its position when it's reloaded?

Ah I see - sorry didn't notice that there was an extra shaft under the iron chest. Yes, pretty sure that SyberSmoke is right - this is caused by the chunk unloading whilst the turtle is in the middle of moving and hence being off by one in terms of its location.

I'm a little suprised (I couldn't get this to occur during my testing which was relatively extensive), although I wasn't testing on a server at the time. You say that your sever is under a lot of load? That will probably make the problem worse.

The fix (workaround?) for now would be to use a chunk loader as SyberSmoke suggests.
Kameryl #472
Posted 30 May 2013 - 11:27 PM
I had 2 issues with unload chunks and/or server restarts that im aware (not really much use):
once the turtle just stop, i go deep, CRTL+T reboot and it keep it going!
twice (and bad one) i found the turtle on top, beside the chest… stand still, i reboot and it was looking to the chest and start mining the chest and some other chest i got behind where moved some stuffs.

The chunks are NOT chunkloaded and server restart every hour, so thats worse. I'll try with a chunkloader mining turtle, maybe that help.
I dont check the code, but maybe is an issue that not saving the information when the turtle go home for refuel/drop and when i start it again, he think that was ready to keep mining in the last spot.

Edit/PS: congratz! very nice work!
AustinKK #473
Posted 31 May 2013 - 08:42 AM
I had 2 issues with unload chunks and/or server restarts that im aware (not really much use):
once the turtle just stop, i go deep, CRTL+T reboot and it keep it going!
twice (and bad one) i found the turtle on top, beside the chest… stand still, i reboot and it was looking to the chest and start mining the chest and some other chest i got behind where moved some stuffs.

The chunks are NOT chunkloaded and server restart every hour, so thats worse. I'll try with a chunkloader mining turtle, maybe that help.
I dont check the code, but maybe is an issue that not saving the information when the turtle go home for refuel/drop and when i start it again, he think that was ready to keep mining in the last spot.

Edit/PS: congratz! very nice work!

Yeah, the chunk reloading isn't guaranteed to work, but was working pretty well (maybe a new update has changed its reliability?!)

When you Ctrl-T to exit the program, you also need to "rm startup" otherwise the program will start again.
tashin #474
Posted 01 June 2013 - 04:44 AM
Is there a way to increas the maximum height. ATM my server has a mining age where the ground level is at 180.
AustinKK #475
Posted 01 June 2013 - 03:05 PM
Is there a way to increas the maximum height. ATM my server has a mining age where the ground level is at 180.

If you change the code starting at line 1645:
if ((startHeight < 6) or (startHeight > 128)) then
writeMessage("turtleY must be between 6 and 128", messageLevel.FATAL)
paramsOK = false
end

to

if ((startHeight < 6) or (startHeight > 256)) then
writeMessage("turtleY must be between 6 and 256", messageLevel.FATAL)
paramsOK = false
end

then it should work fine.
Dasinf #476
Posted 01 June 2013 - 05:05 PM
Hi, first post!

Thanks AustinKK for the script! I've been toying with it the whole day and it's pretty darn awesome :)/>

I was just missing one fairly key feature: charge station support. In my personal setup I've got lots of turtles excavating near my power grid and I wanted to save as much coal as possible. It's really nice to just drop a station next to the chest and do like a 30x30 area.

Anyway: I hacked in a super stealthy charge station mode on top of mrchbx's additions.



It works simply by replacing the fuel chest with a charge station and then not putting any fuel in to the turtle. Then before setting out and every time while visiting a chest the turtle waits until it has enough fuel for another safe trip downstairs. I've been running this for some 4-5 hours now and it seems to work nicely even under power outages and such. It would be more optimal to allow using the fuel slot for item collection while in this mode but honestly I didn't feel like researching how the whole thing works! Maybe someone else can do that later on for some extra mining speed.

Code: http://pastebin.com/j22A3yaB

While I was at it I updated the patch notes and some messages to be a bit more uniform. I hope you approve :)/>

Cheers!
adracamas #477
Posted 04 June 2013 - 07:02 AM
I may have missed it… but how do I use it's GPS function? Do I use a Compute + a wireless modem on the side? Does it need to be running a specific program? What does it need to be labeled as?
fud #478
Posted 04 June 2013 - 08:11 AM
Been very happy with this program. But I've run into a problem.

My turtle stopped mid flow, so I took him down and moved to a new site to start another quarry. Then the turtle is telling me its completely out of fuel. I had put in lots of fuel so I was surrpized, but maybe I misjudge the amount needed for the quarry I told it to dig—so fair enough.

Anyway now I cant do anything with this turtle! He just says "completely out of fuel" and wont let me quit the program to start again.

I've tried control + t but this dosnt work. I've tried putting coal and coal coke in its inventory, but he ignores it.

Do I really have to build a new turtle to get around this problem!?


cheers
fud #479
Posted 04 June 2013 - 08:25 AM
Been very happy with this program. But I've run into a problem.

My turtle stopped mid flow, so I took him down and moved to a new site to start another quarry. Then the turtle is telling me its completely out of fuel. I had put in lots of fuel so I was surrpized, but maybe I misjudge the amount needed for the quarry I told it to dig—so fair enough.

Anyway now I cant do anything with this turtle! He just says "completely out of fuel" and wont let me quit the program to start again.

I've tried control + t but this dosnt work. I've tried putting coal and coal coke in its inventory, but he ignores it.

Do I really have to build a new turtle to get around this problem!?


cheers

found the answer

I need to hold ctrl + t for 3 seconds.
AustinKK #480
Posted 05 June 2013 - 04:04 PM
Hi, first post!

Thanks AustinKK for the script! I've been toying with it the whole day and it's pretty darn awesome :)/>

I was just missing one fairly key feature: charge station support. In my personal setup I've got lots of turtles excavating near my power grid and I wanted to save as much coal as possible. It's really nice to just drop a station next to the chest and do like a 30x30 area.

Anyway: I hacked in a super stealthy charge station mode on top of mrchbx's additions.



It works simply by replacing the fuel chest with a charge station and then not putting any fuel in to the turtle. Then before setting out and every time while visiting a chest the turtle waits until it has enough fuel for another safe trip downstairs. I've been running this for some 4-5 hours now and it seems to work nicely even under power outages and such. It would be more optimal to allow using the fuel slot for item collection while in this mode but honestly I didn't feel like researching how the whole thing works! Maybe someone else can do that later on for some extra mining speed.

Code: http://pastebin.com/j22A3yaB

While I was at it I updated the patch notes and some messages to be a bit more uniform. I hope you approve :)/>

Cheers!
Yes, I approve very much :D/> Glad you were able to enhance the script and move it forward :)/>

I may have missed it… but how do I use it's GPS function? Do I use a Compute + a wireless modem on the side? Does it need to be running a specific program? What does it need to be labeled as?
If you set up a GPS network and you have a turtle with a modem then you don't need to specify the height co-ordinate. To be honest, I never bother, because the GPS network is a pain to set up and its range isn't massive, but the option is there if you want it.
Dragoniko55 #481
Posted 05 June 2013 - 08:47 PM
Looks really awesome :)/>
Conan1981m #482
Posted 06 June 2013 - 05:04 PM
Awesome Program !!
Really like that Mining Turtles ;-)
I Wonder why there are not more programs coming wit the turtles or the Computers … the basic Kit is just really the must have`s…
Hope to see some stuff for the other Turtles from you ;-)
ToLazyToThink #483
Posted 06 June 2013 - 06:44 PM
Looking at the code in #476, it looks like the enderchest code doesn't record when it places the chest, so unless I missed something, if the turtle get's reset while it's placed it wont retrieve it. I realize that's not related to the changes made in that post, just looked like the most recent code update so that's what I looked at.

Never the less, great job I'll be using this once I get my first turtle in my new world.
kaidemer #484
Posted 07 June 2013 - 03:09 PM
So as an absolute newbie to all of this I have a little problem. I followed your video exactly and my turtle appears to be acting odd. Instead of starting with the top layer and going down(like normal excavation) it tunnels straight down to bedrock and then starts excavating in vertical layers rather than horizontal. Sorry if that doesn't make much sense but it's the only way I can think to describe it. Any ideas as to what the problem might be? Thanks.
LazyNub #485
Posted 07 June 2013 - 08:46 PM
It's working as it should.. the version in the video is old and the current one does start from the bottom and go up.. it also will do a 5 layer high up and down mined layer at the bottom if you told it to search for chests.
ndm250 #486
Posted 09 June 2013 - 02:51 PM
Here is a fix for turtles using misc peripheral attachments, specifically the chunk loader addon.

http://pastebin.com/fqHfrAvc

It removes the check for modem on startup.
DoctorTardi_ #487
Posted 09 June 2013 - 03:43 PM
Could same one add support for Turtle teleporters so you could have a charge station at your house but have the quarry somewhere else?
ndm250 #488
Posted 09 June 2013 - 04:26 PM
Could same one add support for Turtle teleporters so you could have a charge station at your house but have the quarry somewhere else?

Or just put the charge station at the quarry?
DoctorTardi_ #489
Posted 09 June 2013 - 05:44 PM
Yea.. but i don't want my power source to have to be there
DoctorTardi_ #490
Posted 09 June 2013 - 11:18 PM
Could someone hack together a fix for the chunk loading module error in the program that has support for charging stations… I really need it.
mrchbx #491
Posted 17 June 2013 - 09:49 AM
New version OreQuarry mod v0.3
download: http://pastebin.com/Ww5rfvcG

video for v0.1
[media]http://youtu.be/dXjYx4UXh_c[/media]

added:
  • Added fuel calculator + coal calculator for any excavation quarry
  • Added sorting resource after drop dump(optimization)
  • Added variable 'useGatheredCoal'(true or false)
  • Added OreLogging for SilkTouch(for example DiamondOre,RedStoneOre,Lapis,IridiumOre and etc)
feature OreLogging:


Need that to diamond ore, redstone ore and other not digging, as stone, gravel, dirt, then to dig out her manually fortune or silk touch.

The coordinates of these ores are written to the file OreLogging.txt. To view it you need to write in turtle: edit OreLogging.txt.
File Format:

[7] x: 13 y: 3 z: 4

[7] - ore in slot 7 in turtle
x: 13 - 13 units to the right from the starting point
y: 3 - the height coordinate
z: 4 - 4 blocks forward


how to use?
write this command:
OreQuarry [diameter] [current height] [minimum height](custom) [orelog number](custom)


[orelog number]
number of the last slots that will be writing in logs(OreLogging.txt) and do not dig. Warning: ore(not diggy) paste in last slots, after stone,gravel,dirt etc…!!!


Drake #492
Posted 17 June 2013 - 12:28 PM
Awesome program. I'm Using AustinKK's version atm, might switch to mrchbx's modification, I don't need some of his extra features though. All I want from what I currently have now is a change tell it to return to the beginning when it gets low on fuel. Additionally, I was thinking a Spiral pattern might be both more fuel efficient and time efficient (less turning). I'm slowly working on my own mining program that goes down to a specified layer and mines in spiral out from the center.
A question on the GPS thing, would mining in the desert avoid the problem of loosing GPS signal do to weather?
AustinKK #493
Posted 23 June 2013 - 10:54 AM
Awesome program. I'm Using AustinKK's version atm, might switch to mrchbx's modification, I don't need some of his extra features though. All I want from what I currently have now is a change tell it to return to the beginning when it gets low on fuel. Additionally, I was thinking a Spiral pattern might be both more fuel efficient and time efficient (less turning). I'm slowly working on my own mining program that goes down to a specified layer and mines in spiral out from the center.
A question on the GPS thing, would mining in the desert avoid the problem of loosing GPS signal do to weather?

Hey drake - quick point on the spiral idea - I tried that, but it works out the same number of moves and turns - unless you're thinking of doing it in some clever way that I never thought of - which is probably not that unlikely to be fair :D/>
tentonaxe #494
Posted 24 June 2013 - 07:59 PM
Austin, I'm using your version on a world with flat bedrock, it doesn't do its bedrock thing and instead just leaves the bottom 5 layers un-checked. Is there anything i can do about that?
leela #495
Posted 25 June 2013 - 08:05 AM
Okay guys, I'm having some problems.

When the chunk get reloaded (I'm using a chunkloader, but still… if I leave the area it still gets unloaded or refreshed sometimes?) or when the server restarts, things get crazy.

The turtles position can be off by a block or two from where it really is (according to the server) and it starts mining of by 1 or 2 blocks… which then turns from bad to really bad when it returns to unload. I've seen it destroy the chest its meant to be unloading into, and then proceed to dump everything onto the ground because its X was off by 1. Stuff like that.

So I've resorted to running it with /r, which then has its OWN problems. Such as the bot stops running after a restart or chunk reload and… I can't find it. I think its deep in a huge pool of lava, and is totally inaccessible. So I've got a 2nd turtle going now. No idea what will happen when this 2nd turtle runs into the original 'lost' turtle but I assume it will destroy it and not pick it and its contents up. Oh well. :/

So can we have an option where upon a resume instead of resuming mining or just stopping entirely, it will attempt to return home and stop? (and not even attempt to unload. Unless its really really sure its found the unloading chest, because I don't want it unloading its contents onto the floor.) And the abort quarry return to home code does not destroy any chests it runs into in case its x/y/z is off by a block? Pretty please?

Or a better solution would be if the turtle didn't go out of sync with the server on its x/y/z position but I am guessing this one is impossible or it'd been solved by now?

I've tried implementing the above change but the code is a bit.. convoluted in places.

Thanks guys <3
leela #496
Posted 25 June 2013 - 08:09 AM
Update: Just after I posted this I checked the inventory of my mining turtle and inside it had the 'lost' turtle! It found it, yay! It really was lost in some lava pool deep under ground.
soulseak #497
Posted 26 June 2013 - 07:52 AM
Whats about using 2 ender chests for refueling etc you would have no need to go up again. place them block 15 and 14 to different colors and your good to go
EaZyCheaZ #498
Posted 28 June 2013 - 01:21 PM
New version OreQuarry mod v0.3
download: http://pastebin.com/Ww5rfvcG

video for v0.1
[media]http://youtu.be/dXjYx4UXh_c[/media]

added:
  • Added fuel calculator + coal calculator for any excavation quarry
  • Added sorting resource after drop dump(optimization)
  • Added variable 'useGatheredCoal'(true or false)
  • Added OreLogging for SilkTouch(for example DiamondOre,RedStoneOre,Lapis,IridiumOre and etc)
feature OreLogging:


Need that to diamond ore, redstone ore and other not digging, as stone, gravel, dirt, then to dig out her manually fortune or silk touch.

The coordinates of these ores are written to the file OreLogging.txt. To view it you need to write in turtle: edit OreLogging.txt.
File Format:

[7] x: 13 y: 3 z: 4

[7] - ore in slot 7 in turtle
x: 13 - 13 units to the right from the starting point
y: 3 - the height coordinate
z: 4 - 4 blocks forward


how to use?
write this command:
OreQuarry [diameter] [current height] [minimum height](custom) [orelog number](custom)


[orelog number]
number of the last slots that will be writing in logs(OreLogging.txt) and do not dig. Warning: ore(not diggy) paste in last slots, after stone,gravel,dirt etc…!!!



Suggestion. Leave the wooden chest in slot 15 for comparisons and do the ender chest out of slot 14 instead. I mine alot in the FTB Twighlight Forrest. There are often chests there that contain special goodies i don't want to miss such as potions/charms/encantment books. As these unique items are often not stackable it should automatically trigger the ender dump routine so as not to fill the turtle completely in the process.
AustinKK #499
Posted 29 June 2013 - 03:44 PM
Austin, I'm using your version on a world with flat bedrock, it doesn't do its bedrock thing and instead just leaves the bottom 5 layers un-checked. Is there anything i can do about that?

Hey. You can change line 39:

local bottomLayer = 5 – The y co-ords of the layer immediately above bedrock


to the layer that is immediately above bedrock - that will make it do what you are wanting
tentonaxe #500
Posted 30 June 2013 - 02:53 AM
Thanks, after posting i realized how stupid of a question that was an opened it up.

It would be great if we could have it support resume, but optionally disable the startup program generation so that it supports resume, but requires the player to interact with the turtle to cause the resume. The reasoning behind this is if the turtle gets stopped, it's highly likely that it will be 1 block off in a direction which will obviously cause it to miss it's drop location. If it instead required player interaction to start it up again, I could watch what it's doing and know whether or not it is off and correct it. For now i've gone in and commented that section out.


Great program though, it works very well. I haven't had any issues with it other than if the server gets restarted while it's running.
oWave #501
Posted 30 June 2013 - 04:09 PM
Is there a way to remove the Resume thing.
I terminated the program. Now every time I place the turtle again , it wants to resume were it stopped.
zorn #502
Posted 01 July 2013 - 10:13 AM
I watched the video you made with the redstone energy cell… did they change somethign with the quarry, because that does not look like a normal quarry running at full speed. A full speed quarry head moves pretty fast, noticably faster than yours did. Right at the end of the quarry test, you took it off 'Fast Forward' and the video ran at normal speed.

Another reason I think something is wrong with the test is that if an 8x8 quarry took 39 minutes, it would mean a 64x64 quarry would take 41 hours. But im fairly sure that at full speed a 64x64 quarry will take under a real world day to finish.

Personally i dont care if the quarry is faster. It takes more energy, leaves huge holes and costs a lot more to get going (especially with gregtech). Plus, turtles are fun.

But i do think that a quarry would mine that out faster than 39 minutes.

edit: did a quick test… its about 15 minutes for a standard 9x9 to get to bedrock.
OmagaIII #503
Posted 03 July 2013 - 12:24 AM
I have also had an issue with the resume code. It seems that there are cases where the cords get seriously messed up some how. What happened is that I had a world with one turtle, a new map, that I setup just to get me started with resources. So I would give the turtle a 20 x 20 area to mine, this seems to yield sufficient resources to get you started. Once or twice I would exit the game and later return and the turtle would be perfectly fine upon return. Another time, I left the game just after the turtle surfaced. When I cam back, it broke the chest with all the mined goodies in and proceeded to mine on the surface in totally a 180 degree direction from it's original setup. The last time I played, about a day ago, after logging in the turtle appeared to function properly underground, until I noticed my chest wasn't filling up. I found that the turtle never returned back to the chest but actually surfaced in a hill 20 blocks or so in front of the chest and would dump everything there before returning to mine.

The resume is a nice idea. but currently somewhat broken.

Suggestion; we know that your code works much faster, but how about just first trying to get the turtle to return to the chest and unload when logging in, just to try and get it to re-orientate it's self properly before continuing? I mean it mostly takes me a minute or two to get back in the game in terms of picking up where I left off, might as well get the turtle to do the same.
OmagaIII #504
Posted 05 July 2013 - 02:30 PM
Hmm, so, with no replies and further testing… Using resume screws up badly and I don't know why. I know have a turtle surfacing just about every where except where it is suppose to. It keeps on complaining about the fact that Z is less than zero… Not that it could be but ok. Now on surface level, every 2 blocks I have a hole down to bedrock…

I'll write up my own miner or re-code this if I have time. For now, heading back to normal quarry, because despite the fact that it leaves a crater, it works as expected. Thanks for this, but it is bugged somehow. Great work nevertheless.
zorn #505
Posted 06 July 2013 - 08:10 AM
Ive used your program more, so far no malfunctions at all. A few things:

As i said, a quarry at 100 mj will get to bedrock much faster than 39 minutes. Even a 9x9 will make it in about 15.

But it doesnt matter really, if anyone is really comparing this to a quarry, this is a 3 diamond cost item vs an 11 (gregtech is even more) and a quarry running at full speed will require about 32 mj/t, according to Power Converters. If you give it 100 mj, it will possibly take it, but it only draws 32 mj most of the time. This is about 70 eu/t or so.

A quarry is harder to run underground, you ahve to dig long tunnels to place the landmarks. So a quarry operator is running at level 64. Its easy to run these from a tunnel going along at 45-50, so this again saves a lot of time and energy.

So roughly, the EU/t cost using charcoal to mine out a 60 x 60 area is about 30 eu/t. The quarry will require twice the energy, and generally has to mine from level 64 or wherever.

Again, to really compare similar costs, the test should be FOUR turtles vs one quarry. If you place 4 turtles in the middle of a 64 x 64 area, you can set each of them to mine out a 32 x 32 area. The 4 turtles will require half the energy cost of the quarry, mine to bedrock in about 3 hours, (quarry will take approx 12 hours or more).

Its also much easier to run these early game, charcoal is easier to transport than engines for a quarry, etc. Plus you can put your first few diamonds into one of these and have automated mining very early. Charcoal again is super easy to get.

So IMO the test you did appears to be flawed somehow, a quarry runs much faster than in the video, but it doesnt matter. If you compare equal costs to build the machines and cost of energy, turtles using your program are clearly superior. On the server i play on, i dont even plan to ever build a quarry. The ONLY downside, i guess, is that 4 turtles will mine out a 64 x 64 area so fast, i have to move them more often than they move their quarries! :D/>/&amp;gt;

Actually I did forget one extra cost… a chunk loader, since a quarry technically includes one. If you add in the cost of a chunk loader, the turtles still beat the quarry, you would use 3 turtles to compare similar costs, not 4. Still, much cheaper to run, and faster to mine.
Apfeldstrudel #506
Posted 06 July 2013 - 08:45 AM
At the time the video was recorded that was the full speed of a bc quarry
zorn #507
Posted 07 July 2013 - 02:09 PM
If it was the old quarry that ran at 9mj/t max, why put a redstone cell on it?

Either way it doesnt really matter, one quarry is closer in cost to 4 turtles, or 3 turtles and a chunkloader. Even 3 turtles will run comparable to a quarry at 100 mj, not leave huge holes in the landscape, and require far less energy to run.

I dont plan on using a quarry again any time soon.

Although im searching this thread to see if there is a way to make it mine down to level 1, not 6 at the start, as i play FTB ultimate and it has Flat Bedrock mod in it.

Never mind, found it.

EDIT: I found the change needed to mine below level 6, made the change that you told someone Austin, but it came back with an error. All i did was copy your pastebin, change the one line to 1 instead of 5, and pasted it into a new pastebin. Now it doesnt work. any ideas?
AustinKK #508
Posted 09 July 2013 - 03:50 AM
Hmm, so, with no replies and further testing… Using resume screws up badly and I don't know why. I know have a turtle surfacing just about every where except where it is suppose to. It keeps on complaining about the fact that Z is less than zero… Not that it could be but ok. Now on surface level, every 2 blocks I have a hole down to bedrock…

I'll write up my own miner or re-code this if I have time. For now, heading back to normal quarry, because despite the fact that it leaves a crater, it works as expected. Thanks for this, but it is bugged somehow. Great work nevertheless.
If you want to run the turtle without the resume feature enabled, you can start the program with "/r" at the end of the command line and that will disable the resume functionality. Not sure that's exactly what you want, but just in case it helps…

At the time the video was recorded that was the full speed of a bc quarry
That's right - it was, and the quarry has now been changed so that it is even faster.

If it was the old quarry that ran at 9mj/t max, why put a redstone cell on it?

Either way it doesnt really matter, one quarry is closer in cost to 4 turtles, or 3 turtles and a chunkloader. Even 3 turtles will run comparable to a quarry at 100 mj, not leave huge holes in the landscape, and require far less energy to run.

I dont plan on using a quarry again any time soon.

Although im searching this thread to see if there is a way to make it mine down to level 1, not 6 at the start, as i play FTB ultimate and it has Flat Bedrock mod in it.

Never mind, found it.

EDIT: I found the change needed to mine below level 6, made the change that you told someone Austin, but it came back with an error. All i did was copy your pastebin, change the one line to 1 instead of 5, and pasted it into a new pastebin. Now it doesnt work. any ideas?
Regarding the quarry speed, when I recorded the video the speed I showed was definitely the fastest you could get it to run. It was after the quarry had been upped from having a limit of 9MJ/t. Subsequently, the quarry speed has been increased yet again, so yes you are right that a full speed quarry is now much faster.

What's the error that you're getting when you changed the value from 5 to 1 (I think it should be 2 by the way as it is the layer above the bedrock, not the layer of bedrock itself)
OmagaIII #509
Posted 09 July 2013 - 12:27 PM
If it was the old quarry that ran at 9mj/t max, why put a redstone cell on it?

Either way it doesnt really matter, one quarry is closer in cost to 4 turtles, or 3 turtles and a chunkloader. Even 3 turtles will run comparable to a quarry at 100 mj, not leave huge holes in the landscape, and require far less energy to run.

I dont plan on using a quarry again any time soon.

Although im searching this thread to see if there is a way to make it mine down to level 1, not 6 at the start, as i play FTB ultimate and it has Flat Bedrock mod in it.

Never mind, found it.

EDIT: I found the change needed to mine below level 6, made the change that you told someone Austin, but it came back with an error. All i did was copy your pastebin, change the one line to 1 instead of 5, and pasted it into a new pastebin. Now it doesnt work. any ideas?

It can't be set to 1, bedrock is level 1, you need the level above bedrock, which is 2.
delizseemack #510
Posted 09 July 2013 - 03:27 PM
Nice program. Unfortunately, I tried it a few times and I had a big problem. The turtle did no come back to the initial location to dump its items. It came back a few blocks next to the original location. How can this happen?

This was on 1.5.2 with pretty much the latest version of the mod and your program (0.7).
LazyNub #511
Posted 11 July 2013 - 05:39 AM
I have been getting this error for the last few days..

rednet:17: No modem on right side

Funny it doesnt seem to happen until I've reloaded the game the first time. All turtles I create and use until then work fine.

I even made chunkloading mining turtles to test the modem being the issue and I still get the error.

I don't play on a server just on my PC. I play 1.5.2 beta 07 and 08 with gregtech enabled from the FTB launcher.

I did get it to work once but I dont recall what I did.. I think I removed all turtle directories and relabeled them..

Anyway.. Not sure if its something that can be fixed in your code or is in ComputerCraft. CC is version 1.53
cubz247 #512
Posted 12 July 2013 - 06:11 AM
So i have two problems, I started it following the guide.

1. The turtle was deep underground with the error ran out of fuel.

2. When re placing the turtle at start i get resuming…. mining layer:36 ( counts up), then reports completely out of fuel.
Shirkit #513
Posted 12 July 2013 - 04:25 PM
Since MiscPeripherals 3.3, ChunkLoader Module doesn't have a wireless rednet modem anymore Clueless, so that's why you're receiving this error.
zorn #514
Posted 12 July 2013 - 06:18 PM
Hey Austin thanks for replying, I took a screenshot of the error I receive when I changed the bedrock line from 6 to 2.

Spoiler

Also here is the pastebin I made, copying yours and changing the line so that it would mine down to 'flat bedrock'. (I assume this is the way to change the code and use it for ourselves?)

http://pastebin.com/iKbD80D9

EDIT: I may have figured it out, i noticed the number of lines in that pastebin was not the same as yours. I re-copied it and put it into a new pastebin, and then it worked, it started right off saying 'mining level 3'.
gunther222 #515
Posted 19 July 2013 - 07:41 PM
This script as is fails under minecraft 1.6.2 due to problems assembling the path for the startup script. . .


-----------------------------------------
** Ore Quarry v0.7 by AustinKK **
-----------------------------------------
OreQuarry:1702: attempt to index ? (an nil value)
As a work around I have commented out lines 1701 - 1705. This disables the programs ability to automaticly create it's startup file, but is otherwise working fully.
zorn #516
Posted 19 July 2013 - 11:58 PM
Is there a way to change it so the turtle mines from the top layers and goes downwards?

After using this script for a couple of weeks, the ONLY downside I have found is that even if you put a bucket of water in the hole that the turtle starts on, I don't get any obsidian. I think the water will follow the turtle down the initial hole it 'drills', but i dont think the water can get to the lava before the turtle moves through that block.

With a quarry, you will usually get hundreds of obsidian per 64 x 64 area mined. With turtles, I get almost none. I think if the turtle mined at the top and moved down, then you could put a few buckets of water up near the top and as the turtle mined downwards, the water would get to the lava. With the current script, the water only has one way down, if the turtle mined downwards, the water would cascade through all the holes created by ores, and I think it would create obsidian before the turtle got to that level.

Is there any way to do this?
AustinKK #517
Posted 20 July 2013 - 03:39 PM
Is there a way to change it so the turtle mines from the top layers and goes downwards?

After using this script for a couple of weeks, the ONLY downside I have found is that even if you put a bucket of water in the hole that the turtle starts on, I don't get any obsidian. I think the water will follow the turtle down the initial hole it 'drills', but i dont think the water can get to the lava before the turtle moves through that block.

With a quarry, you will usually get hundreds of obsidian per 64 x 64 area mined. With turtles, I get almost none. I think if the turtle mined at the top and moved down, then you could put a few buckets of water up near the top and as the turtle mined downwards, the water would get to the lava. With the current script, the water only has one way down, if the turtle mined downwards, the water would cascade through all the holes created by ores, and I think it would create obsidian before the turtle got to that level.

Is there any way to do this?

No - not at the moment I'm afraid!!
zorn #518
Posted 22 July 2013 - 11:28 AM
No worries, your script is well worth not having tons of obsidian around. :)/>

This is how I run turtles with your script:



The 4 ender chests all set to be kept full of charcoal from a tree farm, then 4 chests for dumping items. I just found the chunkloader addon so this was before I knew about it. Moving underground at level 50 or so, i would mine 80 blocks forward, then make a tiny room for this setup and set each turtle to mine a 40 block square. an 80 x 80 area mined out in just a few hours, very low power requirements. The only downside of not mining from level 64 was that i would get little copper, so I started mining from 'sea level' now.

Anyway this let me mine out a huge area much faster than a quarry, with minimal setup, everything gets put into an ender pouch when im done, and it all runs on charcoal. :)/>
olliec #519
Posted 24 July 2013 - 07:48 PM
Has anyone figured out how to replicate the bug when the turtle mines the chest upon the return? That was screwing me up royally last night – judging from the comments, perhaps it's the resume code? I stuck a world anchor on that puppy this time in the hopes of preventing a resume. Having much less luck on 1.5.2/unleashed than I was on 1.4.7/DW20.
Drew956 #520
Posted 26 July 2013 - 06:08 AM
This script as is fails under minecraft 1.6.2 due to problems assembling the path for the startup script. . .


-----------------------------------------
** Ore Quarry v0.7 by AustinKK **
-----------------------------------------
OreQuarry:1702: attempt to index ? (an nil value)
As a work around I have commented out lines 1701 - 1705. This disables the programs ability to automaticly create it's startup file, but is otherwise working fully.

Hmm.. I got the same error.
If you create a blank file called startup it will run fine though, that is what I did xD
But yeah, it worked perfectly fine for me too aside from that.
delizseemack #521
Posted 26 July 2013 - 12:39 PM
Nice program. Unfortunately, I tried it a few times and I had a big problem. The turtle did no come back to the initial location to dump its items. It came back a few blocks next to the original location. How can this happen?

This was on 1.5.2 with pretty much the latest version of the mod and your program (0.7).

I found my problem. I'm using chunk loaders now and it works fine. I guess chunk loading/unloading is problematic for the turtle to track its own position accurately.

Has anyone figured out how to replicate the bug when the turtle mines the chest upon the return? That was screwing me up royally last night – judging from the comments, perhaps it's the resume code? I stuck a world anchor on that puppy this time in the hopes of preventing a resume. Having much less luck on 1.5.2/unleashed than I was on 1.4.7/DW20.

That chunk loader should help you fix that problem. I had the same one and it solved it.
Tascavengur #522
Posted 01 August 2013 - 09:25 AM
Masterpiece!! Still i got a couple of turtle that got "lost"… they just stopped and ended up sitting there worldlevel 1. I was able to retrieve one :-)
Also didn't know about the /r option so i threw a couple into the lava to get rid of them :-)

I think you can speed up even more
Instead of:
"if function() == false then" or "if function() == true" or "if param == false then"
use "if function() then" or call the function without pulling it to a variable in your IF clause. It does add up :-)
Yet again, thank you very much for sharing this very nice program. I'm going to put them on GPS to make them more reliable in resuming. Edit: on resume i don't see any crosscheck with the resume saved data :-s
KiTA #523
Posted 02 August 2013 - 09:16 PM
I have been getting this error for the last few days..

rednet:17: No modem on right side

Funny it doesnt seem to happen until I've reloaded the game the first time. All turtles I create and use until then work fine.

I even made chunkloading mining turtles to test the modem being the issue and I still get the error.

I don't play on a server just on my PC. I play 1.5.2 beta 07 and 08 with gregtech enabled from the FTB launcher.

I did get it to work once but I dont recall what I did.. I think I removed all turtle directories and relabeled them..

Anyway.. Not sure if its something that can be fixed in your code or is in ComputerCraft. CC is version 1.53

The program actually only checks to see if a peripheral is installed on the right side, not necessarily WHAT peripheral is installed. So if you say, install a chunk loading module (Which didn't appear to help the reset problem), you'll end up with this error. Easy fix, the line you need to change is:

  • isWirelessTurtle = peripheral.isPresent("right")

Change that to
  • isWirelessTurtle = false
There's probably a more elegant fix, but I'm new to this. I'd really like to just scrap the chunk loader module and just place one in the world, but dunno if that's possible. Not sure if I can just plug in a modem on a different side or what, either.

Really, really new to this, heh.

Is there a way to remove the Resume thing.
I terminated the program. Now every time I place the turtle again , it wants to resume were it stopped.

del startup
Edited on 02 August 2013 - 07:27 PM
dudgybudgie #524
Posted 23 August 2013 - 09:09 AM
This seems to be broken in 1.6.2, when running the command

"Ore Quarry 16 72"

It returns this:

"
———————————————————————–
** Ore Quarry v0.7 by Austin KK
———————————————————————–
Ore Quarry:1703: Atempt to index ? (a nil value)
"


Is this something on my end or does the program need updating?
Kotawolf #525
Posted 23 August 2013 - 11:23 AM
New version OreQuarry mod v0.3
download: http://pastebin.com/Ww5rfvcG

<snipped out the rest>

I'm using this build on a hosted server and I'm tending to have problems, several times now the turtles have ran out of fuel, and I've had to dig down and get them, two have been lost because they are under lava. Any suggestions? Typically it will run out of fuel one of the first couple of trips down to the bottom.
It is a Technic Hexxit custom build.
Minecraft 1.5.2

Also on any error I have to CTRL-T to get the program to quit.. even when it is done with the mining.. have to CTRL-T, It just is not ever exiting out.
AustinKK #526
Posted 25 August 2013 - 07:46 AM
Hi Guys,

Just to let you know I've updated the script to support the latest version of ComputerCraft (version 1.56) and also to natively support MiscPeripherals Chunk Loader Modules.

I've put some comments in as well to address some of the frequently asked question on this forum (like how to stop the turtle restarting automatically).

New version is at the normal download location (3mkeUzby) and is now version 0.71
dudgybudgie #527
Posted 26 August 2013 - 09:00 AM
Thanks man this program is amazing!
Phazom #528
Posted 27 August 2013 - 06:26 PM
Has anyone got this working with the Underground Biomes mod (1.5.2)?

There's a lot of new stone type things that exist underground. i.e. basalt, chalk and several that break into cobblestone versions when you mine them. I haven't yet been able to get OreQuarry to not recognize those as noise blocks (dropping the efficiency quite a bit, since there is very little dirt and regular stone). I tried with smelted versions of the cobblestone which create blocks with the same name as exists in the world. I also tried silk touching a block (which gives the same ID as smelted). When I set up the turtle it will skip the stone &amp; dirt just fine but hits all of that stuf like it was an ore.

I plan on playing around with a turtle and the turtle.compareUp() &amp; turtle.compareDown() stuff directly tonight to see if I can figure it out but thought I'd see if anyone figured it out yet.
GhostOre #529
Posted 28 August 2013 - 11:34 PM
Thank-you for a great program.

I have used this on two different mod packs and have only had one issue. I had the error about not being able to see the modem. i did not have it this time nor did i have it on all the turtles the last time. The difference was in that i used 'pastebin get' for all the turtles I did not have problems and i did a copy paste of the code file from a turtle's file a ran 'pastebin get' on to the other turtle's folders. not sure if that means anything, but thought i'd share in case.

One tiny request…I'll probably do it once I get some experience at lua…is to place a block below the turtle as the last thing it does when ending the program to insure that the turtle does not end up in the bottom of the shaft when it gets broken to be picked up. I will most likely end up doing something so clumsy at least once. :)/>
Phazom #530
Posted 29 August 2013 - 01:58 PM
Has anyone got this working with the Underground Biomes mod (1.5.2)?

There's a lot of new stone type things that exist underground. i.e. basalt, chalk and several that break into cobblestone versions when you mine them. I haven't yet been able to get OreQuarry to not recognize those as noise blocks (dropping the efficiency quite a bit, since there is very little dirt and regular stone). I tried with smelted versions of the cobblestone which create blocks with the same name as exists in the world. I also tried silk touching a block (which gives the same ID as smelted). When I set up the turtle it will skip the stone &amp; dirt just fine but hits all of that stuf like it was an ore.

I plan on playing around with a turtle and the turtle.compareUp() &amp; turtle.compareDown() stuff directly tonight to see if I can figure it out but thought I'd see if anyone figured it out yet.

Just an update for anyone else who runs into this. The issue is that the blocks from Underground Biomes have different metadata depending on if they were generated at worldgen, or created manually (smelting the appropriate cobble). I.e. if you ID for red granite is 4999:0, the red granite in the world is 4999:8 (each ID has 8 blocks, 0-7 are the created ones, 8-15 are the corresponding worldgen ones). So the turtle is comparing 4999:0 in its inventory to 4999:8 in the world. The only fix for this that I found was to spawn in the blocks manually using the /give command.

/give <player> <ID> <amount> <meta data num>

With that you can get versions of the blocks that match the worldgen ones and use those on your turtles.
Calientecarl #531
Posted 07 September 2013 - 06:44 PM
hey guys, 1st off, great prog thx a lot for sharing it. 2nd, im a total CC dummy and im looking for a lil help, i want to use this program and be able to monitor my turtles from my house via wireless upgrades for the turtles. can someone give me a simple explanation as to how i would do that? i can follow instructions fine and im not new to minecraft or FTB, just new to computercraft,. any help would be greatly appreciated. thx for reading.
johnneijzen #532
Posted 17 September 2013 - 06:57 AM
Yes It Worked fine here and thx for Program i`m go to use this for tons ore in my survival world :)/>
Freakmeister #533
Posted 19 September 2013 - 08:27 AM
Dude, turtles stuck all the time with message "Completely out of fuel". I think it happens only with big radius, I tryed 4x4 - it copleted it, I tryed 64x64 and 32x32 - both of my turtles stucked. My guess is - it don't have enought fuel for way back to refill it. Is it possible to set minimum amount of fuel for turtle? Let's say, when coal burns to 10, turtle should go back to refill it. I think this should solve the problem.

P.S. Dunno is it just my problem or not, but I'm playing on latest Tekkit, ComputerCraft version 1.53.
P.P.S. Sorry for my bad english.
AustinKK #534
Posted 28 September 2013 - 02:56 AM
Dude, turtles stuck all the time with message "Completely out of fuel". I think it happens only with big radius, I tryed 4x4 - it copleted it, I tryed 64x64 and 32x32 - both of my turtles stucked. My guess is - it don't have enought fuel for way back to refill it. Is it possible to set minimum amount of fuel for turtle? Let's say, when coal burns to 10, turtle should go back to refill it. I think this should solve the problem.

P.S. Dunno is it just my problem or not, but I'm playing on latest Tekkit, ComputerCraft version 1.53.
P.P.S. Sorry for my bad english.

[left]The workaround is to refuel the turtle in the nether first (fill it's inventory with lava buckets and type "refuel all").[/left]

[left]Rough estimates for how much fuel you need the turtle to start with (assuming starting from layer 70):[/left]

[left]64x64: 150,000[/left]
[left]32x32: 38,000[/left]
[left]16x16: 10,000[/left]
PaintPauller #535
Posted 04 October 2013 - 11:53 PM
@AustinKK and community, loved this program so much I decided to modify it to support ender chests for both fuel and items and added in an endless mode!

I have run into a slit bug and can’t figure how to solve it though so I come to you for help, when it goes to resume from a crash or unload and is in one of the 2 ender chest functions, it will finish then always error out =(

Any help would be appreciated other than that (which should not even happen that often) it is working great! Feel free to use it knowing that it will crash if it is in a refueling/item state when it is unloaded.

AustinKK, after a fix is found for this feel free to modify/add it to your version if you want.

pastebin: wBiWZTCW

Thanks!
-Paint
HeffeD #536
Posted 08 October 2013 - 01:12 PM
I think this is an incredible script! It's saved me an incredible amount of time. Kudos to you AustinKK. :)/>

I do have a request though. Now that abandoned mineshafts have storage minecarts instead of chests, would it be possible to add support to suck the items from storage carts as well as chests, instead of just breaking the carts and losing the contents? And yes, I understand that adding another check will slow things down a bit, but I'd rather it be a bit slower than lose some potentially valuable goodies. B)/>

I'd do this myself, but I'm new to LUA and much of this script is beyond my skill level to comprehend.
Croft3r #537
Posted 20 October 2013 - 09:58 PM
I absolutely love this program. I have never had any problems with it and i wish we had more programs that worked as good as this one. You get the same ores but less of the cobblestone and other stuff like that.
Geforce Fan #538
Posted 20 October 2013 - 10:06 PM
Few things.
First of all, if I where to save the game and come back, will the turtle's progress be saved? Like, will it continue where it left off.
Second of all, you need to check the walls for items. The turtle missed a total of 9 diamonds, 5 on the tunnel down and 4 on the first level of mining-stuff-thing, whatever you want to call it.
BUT 9 DIAMONDS DUDE!! THANK YOU!!!
HeffeD #539
Posted 21 October 2013 - 01:38 PM
Few things.
First of all, if I where to save the game and come back, will the turtle's progress be saved? Like, will it continue where it left off.
Second of all, you need to check the walls for items. The turtle missed a total of 9 diamonds, 5 on the tunnel down and 4 on the first level of mining-stuff-thing, whatever you want to call it.
BUT 9 DIAMONDS DUDE!! THANK YOU!!!

Yes, the turtle should be able to resume after a logout.

The script is only going to check the area that it was told to mine. The walls are "out of bounds", so it's not going to check those.
michthom #540
Posted 27 October 2013 - 07:27 PM
I believe i have my turtle set up correctly: Stone(1), Dirt (2), Chest (15), Fuel (16)
I've labelled the turtle, and off it goes.
But if the chunk unloads because I wander off, then reloads when I come back, and it tries to resume, nothing happens.

[EDIT]
Why yes, i *was* being a dumbass. Chunk unloading reboots the turtle, no disk=no program and it halts in its tracks.

ChickenChunkloader to the rescue?

I left the ChickenChunkLoader active and spinning its lasers when I left the site of the mining, then I quit and restarted MineCraft.
When I returned to the scene of the mine (groan) the lasers had stopped, and my turtle was inactive as before.

So now I really *am* clueless - can someone explain where I'm missing something vital?
Edited on 29 October 2013 - 02:30 PM
bluefoxy #541
Posted 30 October 2013 - 09:58 PM
if u use 45 MJ's the qurry will hall ass much faster :P/>
HeffeD #542
Posted 31 October 2013 - 11:36 AM
if u use 45 MJ's the qurry will hall ass much faster :P/>

As has been mentioned numerous times, this script was written before quarry speed was upgraded.
CaptainBuzz123 #543
Posted 05 November 2013 - 04:25 PM
Very interesting!! Must try
TrovadorUrbano #544
Posted 06 November 2013 - 09:04 PM
I believe i have my turtle set up correctly: Stone(1), Dirt (2), Chest (15), Fuel (16)
I've labelled the turtle, and off it goes.
But if the chunk unloads because I wander off, then reloads when I come back, and it tries to resume, nothing happens.

[EDIT]
Why yes, i *was* being a dumbass. Chunk unloading reboots the turtle, no disk=no program and it halts in its tracks.

ChickenChunkloader to the rescue?

I left the ChickenChunkLoader active and spinning its lasers when I left the site of the mining, then I quit and restarted MineCraft.
When I returned to the scene of the mine (groan) the lasers had stopped, and my turtle was inactive as before.

So now I really *am* clueless - can someone explain where I'm missing something vital?
Are you loading the orequarry program from a disk drive?
vampiricdust #545
Posted 08 November 2013 - 03:53 PM
While the speed is great, the miner has problems with fuel in open areas with liquids. If it encounters liquids, it will dig the liquid every single time. Normally this shouldn't happen, I was testing your program over an area that include parts I had mined out with a total quarry program.

Perhaps instead of warning low fuel, the turtle should return for fuel when it is low instead of continuing to mine.
Edited on 08 November 2013 - 02:55 PM
HeffeD #546
Posted 09 November 2013 - 01:40 PM
While the speed is great, the miner has problems with fuel in open areas with liquids. If it encounters liquids, it will dig the liquid every single time. Normally this shouldn't happen, I was testing your program over an area that include parts I had mined out with a total quarry program.

Perhaps instead of warning low fuel, the turtle should return for fuel when it is low instead of continuing to mine.

The problem isn't digging the water blocks. Digging doesn't use fuel, only movement uses fuel.

The reason it runs out of fuel when mining large empty areas, (air causes the same problem as water) is because the turtle normally only refuels when it goes to dump its inventory. When going through water or air, no items are going into the turtles inventory, therefore the turtle may not fill up its inventory before it runs out of fuel.

A couple of quick workarounds:
- If you are going to mine an area with a lot of empty space, (water counts as empty space) overfuel your turtle before starting the quarry.
- Chase your turtle down if you feel it is nearly out of fuel and place a single item in each inventory slot. This will send your turtle back to empty/refuel.
Cozzimoto #547
Posted 09 November 2013 - 02:10 PM
Spoiler
While the speed is great, the miner has problems with fuel in open areas with liquids. If it encounters liquids, it will dig the liquid every single time. Normally this shouldn't happen, I was testing your program over an area that include parts I had mined out with a total quarry program.

Perhaps instead of warning low fuel, the turtle should return for fuel when it is low instead of continuing to mine.

The problem isn't digging the water blocks. Digging doesn't use fuel, only movement uses fuel.

The reason it runs out of fuel when mining large empty areas, (air causes the same problem as water) is because the turtle normally only refuels when it goes to dump its inventory. When going through water or air, no items are going into the turtles inventory, therefore the turtle may not fill up its inventory before it runs out of fuel.

A couple of quick workarounds:
- If you are going to mine an area with a lot of empty space, (water counts as empty space) overfuel your turtle before starting the quarry.
- Chase your turtle down if you feel it is nearly out of fuel and place a single item in each inventory slot. This will send your turtle back to empty/refuel.

can i suggest maybe add something that predicts how much fuel the turtle will use before he starts? so you wont have to worry about him running out and you can get a precise amount of fuel that you will need to add.
Nujugi #548
Posted 11 November 2013 - 08:15 PM
Can you get it to print where it is on a monitor instead of on the turtle?
AustinKK #549
Posted 24 November 2013 - 11:30 AM
Spoiler
While the speed is great, the miner has problems with fuel in open areas with liquids. If it encounters liquids, it will dig the liquid every single time. Normally this shouldn't happen, I was testing your program over an area that include parts I had mined out with a total quarry program.

Perhaps instead of warning low fuel, the turtle should return for fuel when it is low instead of continuing to mine.

The problem isn't digging the water blocks. Digging doesn't use fuel, only movement uses fuel.

The reason it runs out of fuel when mining large empty areas, (air causes the same problem as water) is because the turtle normally only refuels when it goes to dump its inventory. When going through water or air, no items are going into the turtles inventory, therefore the turtle may not fill up its inventory before it runs out of fuel.

A couple of quick workarounds:
- If you are going to mine an area with a lot of empty space, (water counts as empty space) overfuel your turtle before starting the quarry.
- Chase your turtle down if you feel it is nearly out of fuel and place a single item in each inventory slot. This will send your turtle back to empty/refuel.

can i suggest maybe add something that predicts how much fuel the turtle will use before he starts? so you wont have to worry about him running out and you can get a precise amount of fuel that you will need to add.

So with all the questions about fuel, the answer is that it is possible to calculate the fuel requirements, I've just never been bothered to do it, mainly because I don't configure the turtle in the way shown in the videos any more.

Specifically, I find it much easier to fill the turtle up in the nether on lava instead. I take 16 buckets, fill them all with lava, put them in the turtle's inventory and type "refuel all". Each lava bucket gives 1,000 fuel, so this is a much more efficient way of refuelling.

Depending on the size of the area being mined, I make sure there will be enough fuel for the whole process based on the fuel requirement calculations below:

64x64: 150,000

32x32: 38,000

16x16: 10,000
Letherin #550
Posted 06 December 2013 - 07:58 PM
I was wondering what the /r option is for ?
Kotawolf #551
Posted 12 December 2013 - 10:58 PM
Okay question, because I use this all the time… I'm wanting to experiment with Wireless Turtles… What does this do when using Wireless? Can it or does it report back to the computer/Monitor as to where it is at, what level or anything?

Never used the wireless to trying to figure out if it will even help me to use them.
Bigglesworth #552
Posted 13 December 2013 - 12:46 PM
I downloaded the script and put it in my client and server folder. However when I run it it goes down to bedrock, and then just mines everything. It doesnt skip layers like it should. Is this a common problem? What should I do?

I keep doing this and forgetting and doing this again.

Note to future self-idiot: PUT A FUSKING STONE (NOT COBBLE) AS THE NOISE BLOCK.
Edited on 13 December 2013 - 12:22 PM
AustinKK #553
Posted 26 December 2013 - 04:05 AM
I was wondering what the /r option is for ?
The /r option disables the auto-restart function that allows the turtle to continue when the chunk is unloaded. The auto-restart function is not 100% accurate (can be 1 block off), so I allowed it to be disabled in case it is causing problems.

Okay question, because I use this all the time… I'm wanting to experiment with Wireless Turtles… What does this do when using Wireless? Can it or does it report back to the computer/Monitor as to where it is at, what level or anything?

Never used the wireless to trying to figure out if it will even help me to use them.
The only wireless functionality provided in the code is to send the messages that are normally sent to the turtle's screen via rednet as well which means you can detect them via another wireless computer. It was mainly for debug when multiple turtles were in use (or were not easily accessible).

I downloaded the script and put it in my client and server folder. However when I run it it goes down to bedrock, and then just mines everything. It doesnt skip layers like it should. Is this a common problem? What should I do?

I keep doing this and forgetting and doing this again.

Note to future self-idiot: PUT A FUSKING STONE (NOT COBBLE) AS THE NOISE BLOCK.
:)/>
Dwayne Dibbley #554
Posted 06 January 2014 - 03:12 PM
is it possible to use an enders chest in the turtle? save the return to surface when full, then i could use another enders chest on the surface to feed into the sorting system?

Thanks
AustinKK #555
Posted 09 January 2014 - 04:17 PM
is it possible to use an enders chest in the turtle? save the return to surface when full, then i could use another enders chest on the surface to feed into the sorting system?

Thanks

The version that I've created doesn't support it, but I think there was a post on here a while back where somebody had added that functionality, so it might be worth checking out.
PaintPauller #556
Posted 10 January 2014 - 06:07 PM
is it possible to use an enders chest in the turtle? save the return to surface when full, then i could use another enders chest on the surface to feed into the sorting system?

Thanks

The version that I've created doesn't support it, but I think there was a post on here a while back where somebody had added that functionality, so it might be worth checking out.


this should help you out, let me know if anything has changed but last i checked it still worked great.

@AustinKK and community, loved this program so much I decided to modify it to support ender chests for both fuel and items and added in an endless mode!

I have run into a slit bug and can’t figure how to solve it though so I come to you for help, when it goes to resume from a crash or unload and is in one of the 2 ender chest functions, it will finish then always error out =(

Any help would be appreciated other than that (which should not even happen that often) it is working great! Feel free to use it knowing that it will crash if it is in a refueling/item state when it is unloaded.

AustinKK, after a fix is found for this feel free to modify/add it to your version if you want.

pastebin: wBiWZTCW

Thanks!
-Paint
Tolorash #557
Posted 26 January 2014 - 12:24 AM
what code do you use to persist threw server restarts and breaking the turtle
sjkeegs #558
Posted 26 January 2014 - 10:00 AM
what code do you use to persist threw server restarts and breaking the turtle
The code writes program state data (x,y,z position, facing, etc… ) to the disk, and then reads the data back when the program starts up again. Look through the code for the "resuming" variable.
Tolorash #559
Posted 28 January 2014 - 11:30 AM
thank you i found it but when i add it to a clock program it does not persist threw
aaa #560
Posted 02 February 2014 - 11:49 AM
Maybe it has already been suggested, but I have some ideas for your quarry (though I'm not sure they work)

- detect chest with a turtle.suck()
- an alternative to ender chest would be obsidian pipe or vanillia hopper at the bottom of the shaft, over a chest, to throw stuff into it instead of going back to the chest. It spare a lot of time, especially for big quarry and/or with mods with a lot of different ores.
To hold the plus of mining the bottom first (where there is diamonds), you can either place pipes while digging the shaft, to connect the obsipipe to the chest on top, or make an option to start from the bottom and mine up.
Edited on 02 February 2014 - 10:49 AM
crenfro #561
Posted 08 February 2014 - 12:11 AM
Ok this is my first post and I made an account just for this.

So I just downloaded FTB Unleashed a couple days ago, and I came across this program. I am having an issue using it though. So I have everything setup exactly like the video, I type in the address to download the program into the Turtle, it gets it successfully and I type in "OreQuarry 8 73" since I'm on level 73. I put in stone and dirt for the noise blocks, and a chest in 15 and charcoal in 16. It mines straight down to bedrock, then stops. It doesn't do anything from there. It just stops once it hits bedrock, it doesn't move or anything…

What did I do wrong? Am I just a complete noob and missing something obvious or what?

Thanks!
westbound #562
Posted 08 February 2014 - 09:54 AM
Hey Austin,

I found it annoying that when I had to move the turtle, I had to put the items in again.
Since we have this rule on our server to only have 1 turtle and 1 chunk loaded I had to come up with a program to do this.
I'm not a great coder but I'm pretty proud of myself on this one.
I hope you can check it out sometime. :)/>

Code

~West

ps. I don't know how to paste my code here with a spoiler, anyone?

EDIT: Link didn't work
Edited on 12 February 2014 - 02:27 PM
PaulK #563
Posted 18 February 2014 - 11:24 AM
How does the program deal with spawners? Does it destroy them or mine them? If it currently destroys them, would it be possible to note their block coordinates, log it, and go around?

Thanks!
belakian #564
Posted 18 February 2014 - 12:08 PM
I believe I have found out why some ppls turtle have been mining like they lost their minds.

http://emashersmods.wikispaces.com/

if you have this mod installed it creates gas blocks that cannot be broken by the turtle. then the turtle freaks out and starts mining all over the place .
troslim #565
Posted 21 February 2014 - 10:33 AM
Love the program, but for some reason the turtle stops whenever I log out. Any solutions?
SyberSmoke #566
Posted 24 February 2014 - 01:41 AM
Love the program, but for some reason the turtle stops whenever I log out. Any solutions?

Turtles will stop any time the chunk they are in is unloaded. To prevent it, you need a chunk loader.
civilwargeeky #567
Posted 24 February 2014 - 05:24 PM
Love the program, but for some reason the turtle stops whenever I log out. Any solutions?
Also, if you are on a single player world, the turtle will stop regardless of whether you have a chunk loader or not.
MostwantedRBX #568
Posted 07 March 2014 - 02:34 AM
Very nice turtle quarry program, AustinKK! Works well without a lot of hassle and the filter you made is also very useful.
NorraV #569
Posted 12 March 2014 - 05:17 PM
hi , does it has to be an Advanced Mining Turtle ?
or does a usual Mining Turtle do as well ?
sverd #570
Posted 21 March 2014 - 09:59 AM
Hello! I have used this program alot in 1.0.9 version of FTB Monster, But now in 1.0.10 it does not work anymore. Suddenly it gets out of position and digs other places. Usually it gets 1 spot of now and then. Resulting in it digging trough my chests and breaking the setup for collecting the ores.

I have emasher mod as mentioned by Clueless, but afaik there are no Gas blocks generated.

Does anyone have a fix for this problem?
kreezxil #571
Posted 21 March 2014 - 08:53 PM
Hello! I have used this program alot in 1.0.9 version of FTB Monster, But now in 1.0.10 it does not work anymore. Suddenly it gets out of position and digs other places. Usually it gets 1 spot of now and then. Resulting in it digging trough my chests and breaking the setup for collecting the ores.

I have emasher mod as mentioned by Clueless, but afaik there are no Gas blocks generated.

Does anyone have a fix for this problem?

I'm on version 1.1.0 of Monster and the only issues I'm having atm are the turtles don't resume all the time after a crash or reboot. But that's life. I have yet to encounter the gas issue but it seems reasonable enough.
djdisturbed #572
Posted 24 March 2014 - 08:47 AM
Hello! I have used this program alot in 1.0.9 version of FTB Monster, But now in 1.0.10 it does not work anymore. Suddenly it gets out of position and digs other places. Usually it gets 1 spot of now and then. Resulting in it digging trough my chests and breaking the setup for collecting the ores.

I have emasher mod as mentioned by Clueless, but afaik there are no Gas blocks generated.

Does anyone have a fix for this problem?

I'm having exact same issue, on a custom private server mod pack, but has alot of the direwolf mods in it plus a few more. This has been happening for a while now (ever since we moved over to 1.6.4 mod packs). BUT we are not running that mod that was posted that is causing the gas pocket issues.

Ok this is my first post and I made an account just for this.

So I just downloaded FTB Unleashed a couple days ago, and I came across this program. I am having an issue using it though. So I have everything setup exactly like the video, I type in the address to download the program into the Turtle, it gets it successfully and I type in "OreQuarry 8 73" since I'm on level 73. I put in stone and dirt for the noise blocks, and a chest in 15 and charcoal in 16. It mines straight down to bedrock, then stops. It doesn't do anything from there. It just stops once it hits bedrock, it doesn't move or anything…

What did I do wrong? Am I just a complete noob and missing something obvious or what?

Thanks!

Try using a slightly lower value for the height, so instead of 73, try 68. I found that, depending on the world gen that was used, the bedrock level might not be right and the turtle will stop if it hits bedrock when it does not think bedrock will be there)
Edited on 24 March 2014 - 11:27 PM
belakian #573
Posted 02 April 2014 - 07:55 AM
Has this been updated for 1.6?
Miranda #574
Posted 06 April 2014 - 03:32 PM
Hey Austin! Great program!
Really well coded and optimized. I'm really impressed by this… I mean, it's not simply a quarry program. It's really well coded and polished program…

I'm wondering, how hard would it be to add some lines to calc how much fuel she'll use, in a worst case scenario?
Something like (startingY - 6) * quarrysize * quarrsize * costPerMove… I don't know
mzimmer42 #575
Posted 29 December 2014 - 04:43 AM
I got this error using your (otherwise just awesome) script (http://pastebin.com/3mkeUzby)


io:71: Too long without yielding

I got this error two times in one day.
The last time (~ half a year ago) when I've been using this script, everything worked just fine.

Details here: https://imgur.com/a/riUbC
U JABBA NOO #576
Posted 29 December 2014 - 07:13 PM
I have the problem that the turtle don't ignores cobblestone. I tried it both with clean stone and with cobblestone in the first slot.

I play Tech World 2 with Minecraft version 1.6.4.
Edited on 29 December 2014 - 11:02 PM
peanutinky #577
Posted 20 April 2015 - 03:39 AM
love this program, only one pet peeve that i have is that i use forestry and the binnie mod that add extra bees, buildcraft breaks the hives and retrieves the bee, while you program ignores them by destroying the bees and the hive. is there a way to get it to harvest the bees. just a thought
raven0ak #578
Posted 28 April 2015 - 12:52 PM
how can I set mining turtle to start from layer 0 or 1? got on server flat bedrock and turtle is auto starting form layer 6 for some odd reason.
raven0ak #579
Posted 28 April 2015 - 05:35 PM
how can I set mining turtle to start from layer 0 or 1? got on server flat bedrock and turtle is auto starting form layer 6 for some odd reason.

found on search from github some ver 1.6 or so of this and there you can add bottom height as 3rd parameter, wonder why its not in current version which should be newer?
henrytm82 #580
Posted 22 July 2015 - 07:45 AM
I am using this program on my mining turtle in a FTB Infinity server (with Ars Magica 2 added on) and it works perfectly, except that I can't get him to ignore blocks that I place into his first four slots. No matter what I put there, it still ends up in his dump chest. I've tried configuring him exactly as the video shows (the new one, where you only give him stone and dirt) and I still end up with stacks of cobble and dirt in the chest.

Any idea why?
henrytm82 #581
Posted 24 July 2015 - 12:20 PM
For anyone else annoyed by the turtles not filtering out the noise blocks like they're supposed to, I came up with a fairly simple solution.

I'm playing with FTB Infinity, so my advice may assume that you are, too. Or at the very least, that you are using the same mods that add these items (I believe it's all from IC2).

I have my turtle emptying his inventory into a diamond chest so I don't have to check on him as often. I have an emerald pipe leading from the chest to a trash can, and I have the emerald pipe set to "Whitelist" and just fill the filters with all the crap you don't want to keep (cobble, dirt, gravel, granite, etc) so that you have maximum space for ores. I have the pipe powered by four redstone engines so it pumps the junk blocks out of the chest at a rate of 4 blocks/tick which is more than fast enough to keep up with a single turtle (I actually have two turtles emptying into the same chest from opposite sides).

Just a suggestion for anyone who can't get the turtle to filter out the junk :)/>
EvilGeniusRetired #582
Posted 07 September 2015 - 11:23 PM
Are you able to use in the nether? I tried sending one off in the nether but it never came back. Might try digging after it to see what happened
Culprit #583
Posted 30 September 2016 - 12:44 PM
I'm having a problem. I will run the turtle, and it goes to the bottom, and starts mining. However, it comes up randomly. Leaving piles of stuff all over. What have I done wrong? I do not have a GPS set up.