Advertisement
Guest User

startup

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