Advertisement
LastElf

Frame Quarry

Jan 12th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. m = peripheral.wrap("left")
  2.  
  3. local tArgs = {...}
  4.  
  5. --Table to define the frequency to pulse
  6. local Move = {
  7.     Dig = 100,
  8.     Down = 100,
  9.     Up = 101,
  10.     West = 102,
  11.     North = 103,
  12.     East = 104,
  13.     South = 105}
  14.  
  15. --Movement frequency set and redstone signal
  16. function Motor(a)
  17.     m.setFreq(a)
  18.     redstone.setOutput("left", true)
  19.     sleep(2)
  20.     redstone.setOutput("left", false)
  21.     sleep(2)
  22. end
  23.  
  24. --Dig down and reset to original height based on input
  25. function Dig(a)
  26.     for i = 1, a do
  27.         Motor(Move[Dig])
  28.     end
  29.     for i = 1, a do
  30.         Motor(Move[Up])
  31.     end
  32. end
  33.  
  34. --Main Program
  35. if tArgs[1] == Dig then
  36.     Dig(tArgs[2])
  37. else
  38.     for i = 1, tArgs[2] do
  39.         Motor(Move[tArgs[1]])
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement