Advertisement
Guest User

quarry

a guest
Nov 17th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. --Arguements
  2.  
  3. tArgs = {...}
  4. type = tArgs[1]
  5. action = tArgs[2]
  6. nTimes = tArgs[3]
  7.  
  8. if not tArgs[1] or not tArgs[2] then
  9.   print("Usage: quarry move/dig amount")
  10.   return(0)
  11. end
  12. if not tArgs[3] then
  13.   nTimes = 1
  14. end
  15.  
  16. colors = {"colors.white", "colors.orange", "colors.magenta", "colors.lightBlue", "colors.yellow", "colors.lime", "colors.pink", "colors.grey", "colors.lightGrey", "colors.cyan", "colors.purple", "colors.blue", "colors.brown", "colors.green", "colors.red", "colors.black"}
  17.  
  18. -- Functions
  19.  
  20. function redstonePulse(color,amount)
  21.   for i = 1, amount do
  22.     redstone.setBundledOutput("left",color)
  23.     sleep(2)
  24.     redstone.setBundledOutput("left",0)
  25.     sleep(2)
  26.   end
  27. end
  28.  
  29. function dig()
  30.  
  31. end
  32.  
  33. function move(direction,distance)
  34.   if direction == "forward" then
  35.     redstonePulse(colors[1],distance)
  36.   elseif direction == "back" then
  37.     redstonePulse(colors[3],distance)
  38.   elseif direction == "left" then
  39.     redstonePulse(colors[2],distance)
  40.   elseif direction == "right" then
  41.     redstonePulse(colors[15],distance)
  42.   elseif direction == "up" then
  43.     redstonePulse(colors[5],distance)
  44.   elseif direction == "down" then
  45.     redstonePulse(colors[12],distance)
  46.   else print("Error. Incorrect direction.")
  47.   return(0)
  48.   end
  49. end
  50.  
  51. -- Main
  52.  
  53.   if type == "move" then
  54.     move(action,nTimes)
  55.   elseif type == "dig" then
  56.     dig()
  57.   else print("Error. Incorrect action.")
  58.   return(0)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement