Posted 01 July 2012 - 06:52 PM
Would one of you Pros please help a stupid wannbe with a function.
function getturtlepos()
cp = {"West","North","East","South"}
rednet.open("right")
ox,oy,oz = gps.locate(10)
turtle.forward()
fx,fy,fz = gps.locate(10)
turtle.back()
rednet.close("right")
if fx > ox then
oth = 3 --East
end
if fx < ox then
oth = 1 --West
end
if fz > oz then
oth = 4 --South
end
if fz < oz then
oth = 2 --North
end
term.clear()
term.setCursorPos(1,1)
print(os.getComputerLabel())
print("Current Position Is")
print("X = ",ox)
print("Y = ",oy)
print("Z = ",oz)
print("Currently Facing")
print(oth ," or ",cp[oth])
end
I want to pass oth ox oy and oz out of the function so they can be used later. I have tried and can only get oth to work. I know return is used somehow but I am stumped. FYI this function does work as is, just to let you know