This is the tunnel code.
This is the stairs code.
Posted 05 October 2012 - 12:30 PM
Posted 05 October 2012 - 12:58 PM
local function smartForward ()
while not turtle.forward () do
if turtle.detect() then
turtle.dig ()
elseif turtle.attack () then
print "Aggressive liveforms detected!"
else
print ("Impossible to move forward.")
return false
end
end
return true
end
Posted 05 October 2012 - 01:01 PM
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches and done%5==0 then turtle.placeUp() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local len=read()
print('would you like to place torches? [yes | no]')
if string.lower(read())=='yes' then
tunnel(len,true)
else
tunnel(len)
end
Posted 05 October 2012 - 02:10 PM
KaoS, on 05 October 2012 - 01:01 PM, said:
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches and done%5==0 then turtle.placeUp() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local len=read()
print('would you like to place torches? [yes | no]')
if string.lower(read())=='yes' then
tunnel(len,true)
else
tunnel(len)
end
Posted 05 October 2012 - 02:38 PM
Posted 05 October 2012 - 03:22 PM
Posted 05 October 2012 - 03:34 PM
Posted 05 October 2012 - 03:37 PM
Doyle3694, on 05 October 2012 - 03:34 PM, said:
Posted 05 October 2012 - 03:41 PM
Posted 05 October 2012 - 05:07 PM
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches~='' and done%tonumber(torches)==0 then turtle.placeUp() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local torches=read()
print('how often should torches be placed (blank for none)')
tunnel(len,torches)
Posted 06 October 2012 - 08:56 AM
KaoS, on 05 October 2012 - 05:07 PM, said:
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches~='' and done%tonumber(torches)==0 then turtle.placeUp() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local torches=read()
print('how often should torches be placed (blank for none)')
tunnel(len,torches)
Posted 07 October 2012 - 07:52 AM
PonyKuu, on 05 October 2012 - 12:58 PM, said:
local function smartForward ()
while not turtle.forward () do
if turtle.detect() then
turtle.dig ()
elseif turtle.attack () then
print "Aggressive liveforms detected!"
else
print ("Impossible to move forward.")
return false
end
end
return true
end
Posted 07 October 2012 - 08:20 AM
Posted 07 October 2012 - 08:42 AM
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches~='' and done%tonumber(torches)==0 then turtle.back() turtle.placeUp() turtle.forward() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local torches=read()
print('how often should torches be placed (blank for none)')
tunnel(len,torches)
Posted 07 October 2012 - 09:49 AM
KaoS, on 07 October 2012 - 08:42 AM, said:
local function tunnel(length,torches)
turtle.select(1)
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
while turtle.detectUp() do turtle.digUp() end
if torches~='' and done%tonumber(torches)==0 then turtle.back() turtle.placeUp() turtle.forward() end
end
turtle.turnLeft()
turtle.turnLeft()
for done=1,tonumber(length) do
while not turtle.forward() do turtle.dig() end
end
turtle.turnRight()
for slot=2,16 do
turtle.select(slot)
turtle.drop()
end
turtle.turnRight()
return true
end
term.clear()
term.setCursorPos(1,1)
print('How long should your tunnel be?')
write('length: ')
local torches=read()
print('how often should torches be placed (blank for none)')
tunnel(len,torches)
Posted 07 October 2012 - 10:33 AM
Posted 07 October 2012 - 11:18 AM
KaoS, on 07 October 2012 - 10:33 AM, said:
0 members, 1 guests, 0 anonymous users