daily pastebin goal
48%
SHARE
TWEET

mine1x3

a guest Mar 21st, 2013 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local args = {...}
  2. local distance = tonumber(args[1])
  3.  
  4. local counteddist = 0
  5.  
  6. local function digmove()
  7.   turtle.dig()
  8.   turtle.forward()
  9.   turtle.digUp()
  10.   turtle.digDown()
  11. end
  12.  
  13. local function countdist()
  14.   counteddist = counteddist + 1
  15.   print(counteddist)
  16. end
  17. local function returnback()
  18.   if distance == counteddist then
  19.     print("I'm done mining")
  20.     print("I should be returning home")
  21.     turtle.turnRight()
  22.     turtle.turnRight()
  23.     for i = 1, counteddist do
  24.       turtle.forward()
  25.     end
  26.     print("Am i home yet?")        
  27.   end  
  28. end
  29. --Main Script
  30.  
  31. for i = 1, distance do
  32.   digmove()
  33.   countdist()  
  34.   returnback()
  35. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top