Minecraft Wiki
Advertisement

ComputerCraft ninja style![]

ComputerCraft is awesome. You should totally check it out here. I have been making my own methods for it, and it is really fun. Like really. Trust me. Yeah.

Anyway, here is my latest development of previously stated mod. It is written in a language called LUA, which, for the programmers out there, is very similar to VB.

This is open-source, but make sure you credit SpamTheClicker. Thx, bud.

--Here is an open source LUA function I developed to make the "Turtle" robot dig a quarry automatically when you call turtle.digQuarry([x],[y],[z]).

--If the turtle runs out of inventory space while mining, it will come back to the surface and wait for you to empty it and affirm that it should keep mining. It will also return and wait for your input if it encounters a cave system, water, lava, or bedrock.

--Here it is:

--BY SpamTheClicker.
--Please feel to copy and use this code, as long as you credit the author, and to lua.org.

function digQuarry(x,y,z)
local allpurpose = 1
local a = 0
local b = 0
local c = 0
local leftrightset = 0
local fullorcave = 0
local re = ""
local breakfree = false
local cell {}
local sameamount = true

while b <= y do
turtle.digDown()
turtle.down()
b=b+1

while c <= z do
while a <= x do

while allpurpose < 17 do
cell{allpurpose} = turtle.getItemCount(allpurpose)
allpurpose=allpurpose+1
end

turtle.dig()

allpurpose = 1
sameamount = true

while allpurpose < 17 do

if not cell{allpurpose} == turtle.getItemCount(allpurpose) then
sameamount = false
end
allpurpose=allpurpose+1
end

if sameamount == true then
fullorcave=b

while fullorcave <= y do
turtle.Up()
fullorcave=fullorcave+1
end

turtle.back()
print("I have run into issues. \n I either have a full inventory, or I have run into an un-minable object. This could be air from a cave, or something more serious like lava water, or bedrock. When you are done checking, type 'y' to continue my mining, or 'n' to stop here.")
while re == "" do
re = io.read()
if re == "y" or "Y" then
turtle.forward()
fullorcave=0
while fullorcave <= y do
turtle.down()
fullorcave=fullorcave+1
end
elseif re == "n" or "N" then
breakfree = true
break
end

end

if breakfree = true then
break
end

end
end
turtle.foward()
a=a+1
end

a=0
c=c+1

if leftrightset=0 then
turtle.turnRight()
turtle.dig()
turtle.forward()
a=a+1
turtle.turnRight()
leftrightset=leftrightset+1
else
turtle.turnLeft()
turtle.dig()
turtle.forward()
a=a+1
turtle.turnLeft()
leftrightset=leftrightset-1
end

end
c=0

if leftrightset=1 then

turtle.turnRight()

while turtle.detect() == false do
turtle.forward()
end

turtle.turnRight()

while turtle.detect() == false do
turtle.forward()
end

turtle.turnRight()
leftrightset=0

else
turtle.turnLeft()
turtle.turnLeft()

while turtle.detect() == false do
turtle.forward()
end

turtle.turnLeft()
turtle.turnLeft()

end

leftrightset=0
a=0
c=0
end

b=0

while b <= y do
turtle.Up()
b=b+1
end

turtle.Back()

print("I have finished building your quarry.")

end



Getting weary of the old look...[]

Let's get a new look for this place! I love the Minecraft Wiki. I am a constant editor, and it is my sole source of Minecraft information. If I am going to spend all this time on here, why not have it look stunning? Forget cobblestone. Let's do this Etho style and make it look purty!SpamTheClicker 01:41, 4 April 2013 (UTC)

Advertisement