Advertisement
guamie

Functions 20130818

Aug 17th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. -- Functions 20130818
  2.            
  3.  
  4.     --VARIABLES
  5.     --CobblestoneCounter
  6.             cslot = 1
  7.             turtle.select(cslot)
  8.      
  9.     --FUNCTIONS
  10.      
  11.     -- Ensure turtle goes up
  12.     function goUp()
  13.             while not turtle.up() do
  14.                     upDig()
  15.             end
  16.     end
  17.          
  18.     --Ensure turtle goes down
  19.     function goDown()
  20.             while not turtle.down() do
  21.                     downDig()
  22.             end
  23.     end
  24.          
  25.     -- Ensure turtle moves forward
  26.     function goForward()
  27.             while not turtle.forward() do
  28.                     forwardDig()
  29.             end
  30.     end
  31.          
  32.     -- Dig forward
  33.     function forwardDig()
  34.             while turtle.detect() do
  35.                     turtle.dig()
  36.             end
  37.     end
  38.          
  39.     -- Dig up
  40.     function upDig()
  41.             while turtle.detectUp() do
  42.                     turtle.digUp()
  43.             end
  44.     end
  45.          
  46.     -- Dig Down
  47.     function downDig()
  48.             turtle.digDown()
  49.     end
  50.                            
  51.     --Place Cobblestone Below
  52.     function placeCobblestoneDown()
  53.             turtle.select(cslot)
  54.             turtle.placeDown()
  55.             CounterCobblestone()
  56.     end
  57.      
  58.     --Place Cobblestone Regularly
  59.     function placeCobblestone()
  60.             turtle.select(cslot)
  61.             turtle.place()
  62.             CounterCobblestone()
  63.     end
  64.      
  65.     --Place Cobblestone Above
  66.     function placeCobblestoneUp()
  67.             turtle.select(cslot)
  68.             turtle.placeUp()
  69.             CounterCobblestone()
  70.     end
  71.      
  72.     --Counts stacks of cobble
  73.     function CounterCobblestone()
  74.             while turtle.getItemCount(cslot) < 1 do
  75.                     cslot = (cslot%13)+1
  76.             end    
  77.     end
  78.      
  79.     --Place Cobblestone Below and then move forward
  80.     function CobbleDForward()
  81.             placeCobblestoneDown()
  82.             goForward()
  83.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement