Advertisement
guitarplayer616

newGPSmethodResearch

Jan 10th, 2017
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. x,y,z = 0,0,0
  2. isMoving = false
  3.  
  4. function moveDelay()
  5.     sleep(.4)
  6.     return true
  7. end
  8.  
  9. function moving()
  10.     if isMoving == true then
  11.         isMoving = false
  12.     else
  13.         isMoving = true
  14.     end
  15.     local h = fs.open("moving","w")
  16.     h.write("moving = "..tostring(isMoving))
  17.     h.close()
  18. end
  19.  
  20. function forward()
  21.   --update("forward")
  22.     parallel.waitForAll(moveDelay,turtle.forward,record)
  23. end
  24.  
  25. function record()
  26.     z = z + 1
  27.     local h = fs.open("record","w")
  28.     h.write( "z = " ..textutils.serialize(z) )
  29.     h.close()
  30. end
  31.  
  32. for i = 1,15 do
  33.     forward()
  34. end
  35. shell.run("record")
  36. shell.run("go rt 2")
  37. for i = 1,z do
  38.   turtle.forward()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement