warfar

Hopper

Mar 1st, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. --Program made by Warfar
  2. --http://pastebin.com/u/warfar
  3.  
  4.  
  5. if not turtle then
  6.     print("Turtles only")
  7.     return
  8. end
  9. local function printusage()
  10.     print("Usage: hopper <side> <usage>")
  11.     print("Valid sides are: top, bottom or front")
  12.     print("Valid usages are: suck or drop")
  13. end
  14. local tArgs = { ... }
  15. if #tArgs ~= 2 then
  16.     printusage()
  17.     return
  18. end
  19. if tArgs[1] ~= "top" and tArgs[1] ~= "bottom" and tArgs[1] ~= "front" then
  20.     printusage()
  21.     return
  22. end
  23. if tArgs[2] ~= "suck" and tArgs[2] ~= "drop" then
  24.     printusage()
  25.     return
  26. end
  27. if tArgs[2] == "drop" then
  28.     if tArgs[1] == "top" then
  29.         while true do
  30.             for i = 1,16 do
  31.                 turtle.select(i)
  32.                 turtle.dropUp()
  33.             end
  34.         end
  35.     elseif tArgs[1] == "bottom" then
  36.         while true do
  37.             for i = 1,16 do
  38.                 turtle.select(i)
  39.                 turtle.dropDown()
  40.             end
  41.         end
  42.     elseif tArgs[1] == "front" then
  43.         while true do
  44.             for i = 1,16 do
  45.                 turtle.select(i)
  46.                 turtle.drop()
  47.             end
  48.         end
  49.     end
  50. else
  51.     if tArgs[1] == "top" then
  52.         while true do
  53.             turtle.suckUp()
  54.         end
  55.     elseif tArgs[1] == "bottom" then
  56.         while true do
  57.             turtle.suckDown()
  58.         end
  59.     elseif tArgs[1] == "front" then
  60.         while true do
  61.             turtle.suck()
  62.         end
  63.     end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment