
seiti
By: a guest on
Mar 16th, 2012 | syntax:
Lua | size: 2.13 KB | hits: 21 | expires: Never
--------------------------
-- Seiti (level the ground) ver.1.00
--
-- "Please" Download fwcount together.
--------------------------
--------------------------
-- Information is heard.
--------------------------
print("Change under block mode?")
print(" Yes = y,No = n")
sm = io.read()
print("Is distance measured?")
print(" Yes = y,No = n")
yn = io.read()
if yn == "y" then
dofile("fwcount")
else
print("OK No command")
end
if yn == "y" then
print("Does this nonber use?")
print("Yes = y , No = n")
yn = io.read()
else
yn = "n"
end
if yn == "n" then
print("---------------------------")
print("Take forward Counts?")
x = io.read()
print("Take Wide Counts?")
y = io.read()
end
--------------------
-- finction
--------------------
function put()
if turtle.detectDown() == false then
turtle.placeDown()
elseif turtle.compareDown() == false then
turtle.digDown()
turtle.placeDown()
else
end
end
function dig()
i = 1
for i = 1,x do
if sm == "y" then
put()
end
while turtle.detect() or turtle.detectUp() == true do
turtle.digUp()
turtle.up()
end
while turtle.detectUp() == false do
turtle.down()
turtle.dig()
if turtle.detectDown() == true then
break
end
end
turtle.forward()
i = i + 1
end
put()
end
function back()
i = 1
for i = 1,x do
turtle.back()
i = i + 1
end
drop()
end
function drop()
turtle.turnRight()
turtle.turnRight()
i = 2
for i = i,9 do
turtle.select(i)
if turtle.compareDown() == true then
break
else
turtle.drop(i)
end
end
turtle.select(1)
turtle.turnLeft()
turtle.turnLeft()
end
function turn()
turtle.turnRight()
turtle.dig()
turtle.forward()
while turtle.detectUp == true do
turtle.digUp()
turtle.up()
end
while turtle.detectUp == false do
turtle.down()
end
turtle.turnLeft()
end
--------------------
-- move turtle
--------------------
w = 1
for w = 1,y do
dig()
back()
turn()
w = w + 1
end
dig()
back()
turtle.turnRight()
for i= 1,y do
turtle.back()
end
turtle.turnLeft()
print("Finish")