Advertisement
wbennet997

unfinishedGps

Jun 29th, 2022
873
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local home_x,home_y,home_z = 0,0,0
  2.  
  3. shell.run("gps","locate")
  4. local x,y,z = gps.locate()
  5.  
  6. local function find_dir() --dir 1,2,3,4
  7.    
  8.     local xx,yy,zz = gps.locate()
  9.     turtle.forward()
  10.     local x_,y_z_ = gps.locate()
  11.  
  12.     shell.run("turn","right","2")
  13.     turtle.forward()
  14.     shell.run("turn","right","2")
  15.  
  16.  
  17.     if xx < x_ then
  18.         return 4 --west
  19.     elseif xx > x_
  20.         return 2 --east
  21.     elseif zz > z_
  22.         return 1 --north
  23.     elseif zz < z_
  24.         return 3 --south
  25.     else
  26.         return 0
  27.     end
  28. end
  29.  
  30. local function change_dir(toDir,dir_)
  31.     while toDir ~= dir_ do
  32.         turtle.turnRight()
  33.         dir_ = dir_ + 1
  34.     end
  35. end
  36.  
  37. while y < 100 do
  38. turtle.digUp()
  39. turtle.up()
  40.  
  41. while x <
  42.  
  43.  
  44.  
  45.  
Advertisement
RAW Paste Data Copied
Advertisement