Guest User

nav

a guest
Jun 21st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. if not fs.exists("position") then
  2. local pos={0,0,0}
  3. print("false")
  4. file.create("position",pos) end
  5. pos=file.read("position")
  6. x=pos[1]
  7. y=pos[2]
  8. z=pos[3]
  9. print("true")
  10. print("I am at |x:",x,"|y:",y,"|z:",z)
  11. facing={"north","south","east","west"}
  12. if not fs.exists("direction") then
  13. file.create("direction","north") end
  14. way=file.read("direction")
  15.  
  16. function turn(direction,count)
  17. counter=0
  18. repeat
  19. counter=counter+1
  20. if direction == "right" and if way ~= "north" and if way ~= "south" then
  21. countDirection=1
  22. turtle.turnRight()
  23. end
  24. if direction=="left" and if way~= "north" and if way ~= "south" then
  25. countDirection=-1
  26. turtle.turnLeft()
  27. end
  28. until counter==#count
  29. end
Advertisement
Add Comment
Please, Sign In to add comment