Advertisement
guitarplayer616

MagnetTosser

Dec 26th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local p = peripheral.wrap("left")
  2.  
  3. p.activate()
  4.  
  5. function waitForMagnet()
  6.     while true do
  7.         local x,y,z = p.getDistanceToTarget()
  8.         if x,y,z == 0,-0.5,0 then
  9.             break
  10.         end
  11.         sleep(.2)
  12.     end
  13. end
  14.  
  15. for x = 1,5 do
  16.   for z = 1,3 do
  17.     p.setTarget(x,0,z-2)
  18.     waitForMagnet()
  19.     p.toggle()
  20.     while not p.isGrabbing() do end
  21.     p.setTarget(x,3,z-2)
  22.     waitForMagnet()
  23.     p.toggle()
  24.     while not p.isGrabbing() do end
  25.   end
  26. end
  27.  
  28. p.deactivate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement