Orginalet

Butler

Feb 28th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. -- Global variables
  2. x = turtle.getItemCount(1)
  3. -- Global variables^
  4.  
  5. -- Main function
  6. function enterShop()
  7.         turtle.down()
  8.         turtle.down()
  9.         turtle.turnRight()
  10.         turtle.forward()
  11.         turtle.turnRight()
  12.         turtle.forward()
  13.         turtle.forward()
  14.         turtle.turnRight()
  15.         turtle.forward()
  16.         turtle.forward()
  17.         turtle.turnLeft()
  18.         turtle.up()
  19.         turtle.up()
  20. end
  21.  
  22. function getBack()
  23.         turtle.down()
  24.         turtle.down()
  25.         turtle.turnLeft()
  26.         turtle.forward()
  27.         turtle.forward()
  28.         turtle.turnLeft()
  29.         turtle.forward()
  30.         turtle.forward()
  31.         turtle.turnLeft()
  32.         turtle.forward()
  33.         turtle.turnRight()
  34.         turtle.up()
  35.         turtle.up()
  36. end
  37.  
  38. function beNice()
  39.         turtle.drop(1)
  40. end
  41.  
  42. function getSnack()
  43.         turtle.turnLeft()
  44.         turtle.suck()
  45.         turtle.drop(turtle.getItemCount(1) - 1)
  46.         turtle.turnRight()
  47. end
  48.  
  49. function listen()
  50.         while true do
  51.                 if redstone.getInput("top") == true then
  52.                         go()
  53.                 else os.sleep(0.1)
  54.                 end
  55.         end
  56. end
  57.  
  58. function go()
  59.         enterShop()
  60.         os.sleep(2)
  61.         beNice()
  62.         getBack()
  63.         getSnack()
  64. end
  65. -- Main function^
  66.  
  67. -- Execute
  68. listen()
  69.  
  70. -- Execute^
Advertisement
Add Comment
Please, Sign In to add comment