Posted 17 October 2012 - 10:18 PM
Hi guys, please help me…
first, skyside is a programm which defines direct (1, 2, 3 or 4)
i get the following error message, but i have there a then :/
biox:328: [string "goto"]:110: 'then' expected
here is my programm on pastebin:
http://pastebin.com/XghJapgd
and here in the forum as you can see :P/>/>
thanks
first, skyside is a programm which defines direct (1, 2, 3 or 4)
i get the following error message, but i have there a then :/
biox:328: [string "goto"]:110: 'then' expected
here is my programm on pastebin:
http://pastebin.com/XghJapgd
and here in the forum as you can see :P/>/>
-- for direct --> north=1, east=2, south=3, west=4
local ox, oy, oz = nil, nil, nil
local endx, endy, endz = nil, nil, nil
local stuck = 0
function getpos()
rednet.open("right")
cx, cy, cz = gps.locate(1)
end
getpos()
print("Wohin solls gehen?")
write("x: ")
nx = read()
write("y: ")
ny = read()
write("z: ")
nz = read()
write("In welche Richtung gucken (1-4)?")
ndirect = read()
function directto(x)
while ndirect ~= direct do
turtle.turnRight()
if direct ~= 4 then
direct = direct + 1
else
direct = 1
end
end
function gox1()
if cx < nx then
directto(1)
if turtle.forward() then
cx = cx - 1
gox1()
else
gox3()
end
end
end
function gox3()
if cx > nx then
directto(3)
if turtle.forward() then
cx = cx +1
gox3()
else
goz2()
end
end
end
function goz2()
if cz < nz then
directto(2)
if turtle.forward() then
cz = cz + 1
goz2()
else
goz4()
end
end
end
function goz4()
if cz > nz then
directto(4)
if turtle.forward() then
cz = cz - 1
goz4()
else
goyu()
end
end
end
function goyu()
if cy < ny then
if turtle.up() then
cy = cy + 1
goyu()
else
goyd()
end
end
end
function goyd()
if cy > ny then
if turtle.down() then
cy = cy -1
goyd()
else
chegfuel()
end
end
end
function chegfuel()
if turtle.getFuelLevel > 0 and stuck = 0 then
if turtle.up() then
gox1()
elseif stuck < 1
stuck = 1
os.sleep(5)
gox1()
end
else
if turtle.getFuelLevel = 0 then
print("I need more fuel!")
while turtle.getFuelLevel = 0 do
os.sleep(5)
turtle.refuel()
end
gox1()
else
print("Help my I'm stuck!")
print("Shut down the programm.")
end
end
end
if not nx then
nx = cx
end
if not ny then
ny = cx
end
if not nz then
nz = cz
end
shell.run("skyside")
if direct ~= nil then
gox1()
getpos()
gox1()
end
thanks