ComputerCraft Archive

dig

turtle mining cc-scripts github

Description

A collection of ComputerCraft scripts

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/cc-scripts/cc-scripts/master/programs/dig.lua dig
Archive:wget https://cc.shobie.xyz/cc/get/gh-cc-scripts-cc-scripts-programs-dig dig
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-cc-scripts-cc-scripts-programs-dig dig

Usage

Run: dig

Tags

turtlemining

Source

View Original Source

Code Preview

--[[
Description:
  Makes the bot dig in an absolute direction or dig to an absolute position.
  Requires the turtletracker to be loaded. Will dig if a block is in the way,
  else will wait for mobs to clear off

Usage:
  dig <n[orth]|e[ast]|s[outh]|w[est]|up|down>
  dig to <x> <y> <z>
]]

cc_scripts.api.load('turtletracker')

local args = {...}
if #args == 1 then
	turtle.digAlong(args[1])
elseif args[1] == 'to' then
	turtle.digTo(
		tonumber(args[2]),
		tonumber(args[3]),
		tonumber(args[4])
	)
end