Advertisement
Guest User

startup

a guest
Dec 22nd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. function moveforward()
  4.     turtle.forward()
  5. end
  6.  
  7. function moveup()
  8.   if turtle.detectUp() then
  9.   turtle.digUp()
  10.   end
  11.   turtle.up()
  12. end
  13.  
  14. function movedown()
  15.   if turtle.detectDown() then
  16.     turtle.digDown()
  17.   end
  18.   turtle.down()
  19. end    
  20.  
  21. function chest()
  22.        turtle.select(1)
  23.        turtle.placeUp()
  24.        for i=2,16 do
  25.         turtle.select(i)
  26.         turtle.dropUp()
  27.         sleep(0.25)
  28.        end
  29.        turtle.select(1)
  30.        turtle.digUp()
  31. end
  32.  
  33. while true do
  34. id,msg = rednet.receive()
  35. if id ==0 or id ==71 then
  36.      if msg == "stop" then
  37.        error()
  38.      end
  39.  
  40.     if msg == "dumpall" then
  41.         turtle.select(1)
  42.         turtle.placeUp()
  43.         for i=1,16 do
  44.         turtle.select(i)
  45.         turtle.dropUp()
  46.         sleep(0.25)
  47.         end
  48.     end
  49.  
  50.      if msg == "chest" then
  51.         chest()
  52.     end
  53.  
  54.     if msg == "forward" then
  55.       moveforward()
  56.     end
  57.     if msg == "back" then
  58.       turtle.back()
  59.     end
  60.     if msg == "up" then
  61.       moveup()
  62.     end
  63.     if msg == "down" then
  64.       movedown()
  65.     end
  66.     if msg == "left" then
  67.       turtle.turnLeft()
  68.     end
  69.     if msg == "right" then
  70.       turtle.turnRight()
  71.     end
  72.     if msg == "dig" then
  73.       for i =0,73 do
  74.       movedown()
  75.       end
  76.       sleep(1)
  77.       for j =0,73 do
  78.       moveup()
  79.       end
  80.       chest()
  81.      
  82.     end
  83.   end
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement