Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Murtle API
- -- By moverperfect
- -- for more visit
- --
- function fwd(n)
- if n == nil then
- n=1
- end
- for i=1, n do
- while not turtle.forward() do
- turtle.dig()
- end
- end
- end
- function down(n)
- if n == nil then
- n=1
- end
- for i=1, n do
- while not turtle.down() do
- turtle.digDown()
- end
- end
- end
- function up(n)
- if n == nil then
- n=1
- end
- for i=1, n do
- while not turtle.up() do
- turtle.digUp()
- end
- end
- end
- function back(n)
- if n == nil then
- n=1
- end
- for i=1,n do
- turtle.back()
- end
- end
- function left(n)
- if n == nil then
- n = 1
- end
- for i=1, n do
- turtle.turnLeft()
- end
- end
- function right(n)
- if n == nil then
- n = 1
- end
- for i=1,n do
- turtle.turnRight()
- end
- end
- function turnright()
- turtle.turnRight()
- fwd()
- turtle.turnRight()
- end
- function turnleft()
- turtle.turnLeft()
- fwd()
- turtle.turnLeft()
- end
- function place(s)
- if s == nil then
- turtle.place()
- else
- turtle.select(s)
- if turtle.getItemCount(s) == 0 then
- turtle.select(s+1)
- if turtle.getItemCount(s+1) == 0 then
- turtle.select(s+2)
- turtle.place()
- else
- turtle.place()
- end
- else
- turtle.place()
- end
- end
- end
- function placedown(s)
- if s == nil then
- turtle.placeDown()
- else
- turtle.select(s)
- if turtle.getItemCount(s) == 0 then
- turtle.select(s+1)
- if turtle.getItemCount(s+1) == 0 then
- turtle.select(s+2)
- turtle.placeDown()
- else
- turtle.placeDown()
- end
- else
- turtle.placeDown()
- end
- end
- end
- function placeup(s)
- if s == nil then
- turtle.placeUp()
- else
- turtle.select(s)
- if turtle.getItemCount(s) == 0 then
- turtle.select(s+1)
- if turtle.getItemCount(s+1) == 0 then
- turtle.select(s+2)
- turtle.placeUp()
- else
- turtle.placeUp()
- end
- else
- turtle.placeUp()
- end
- end
- end
- function checkeven(n)
- if n % 2 == 0 then
- return true
- else
- return false
- end
- end
- function dig(n)
- if n == nil then
- fwd(1)
- turtle.digUp()
- turtle.digDown()
- else
- for i=1,n do
- fwd(1)
- turtle.digUp()
- turtle.digDown()
- end
- end
- end
- function sbendr()
- turtle.turnRight()
- fwd(1)
- turtle.turnLeft()
- fwd(1)
- end
- function sbendl()
- turtle.turnLeft()
- fwd(1)
- turtle.turnRight()
- fwd(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment