Posted 14 April 2013 - 10:11 PM
i made a building API for easier building with turtles.
version:
0.1.0
code:
overview:
how to use:
version:
0.1.0
code:
Spoiler
function version()--return the current version.
return "0.1.0"
end
function floorLine(length)--builds 1 line for the floor.
for i=1,length do
turtle.placeDown()
turtle.forward()
end
end
function wallLine(hight)--builds a 1x1xhight tower.
for i=1,hight do
turtle.place()
turtle.up()
end
end
function ceilingLine(length)--builds a 1xlengthx1 ceiling.
for i=1,length do
turtle.placeUp()
turtle.forward()
end
end
function forward(blocks)--goes forward a certain amount of blocks, you may use it, but i dont support that, use at your own risk!
for i=1,blocks do
forward()
end
end
function floor(lenght,width)--makes a lenghtxwidthx1 floor
for i=2,width do
floorLine(lenght)
turtle.back()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
floorLine(lenght)
turtle.back()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
function downward(hight)--makes it go downward a certain number of blocks, you may use it, but i dont support it, use at your own risk!
for i=1,hight do
turtle.down()
end
end
function wall(hight,length)--makes a hightxlenghtx1 wall.
for i=1,length do
wallLine(hight)
turtle.down()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
downward(hight)
end
end
function ceiling(lenght,width)--makes a lenghtxwidthx1 ceiling
for i=2,width do
ceilingLine(lenght)
turtle.back()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
ceilingLine(lenght)
turtle.back()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
overview:
Spoiler
version()--returns current version
floorLine(length)--builds 1 line of the floor
wallLine(hight)--builds a 1x1xhight tower.
ceilingLine(length)--builds a 1xlengthx1 ceiling.
forward(blocks)--goes forward a certain amount of blocks, you may use it, but i dont support that, use at your own risk!
floor(lenght,width)--makes a lenghtxwidthx1 floor
downward(hight)--makes it go downward a certain number of blocks, you may use it, but i dont support it, use at your own risk!
wall(hight,length)--makes a hightxlenghtx1 wall.
ceiling(lenght,width)--makes a lenghtxwidthx1 ceiling.
how to use:
- put os.loadAPI("building") on the begin of your scrip/startup
- use on of these functions.
- enjoy programming!