Posted 27 March 2013 - 05:47 AM
Hello,
i'm just frustrated from my program.. it wont work as i want it to be
the program is programmed to flat an area given to it(example: you write from a wireless computer "flat 5 5" so it should flat 5 by 5 area and the Y (height) of it should be untill it wont detect any block under it.
here is the program:(ill explain it)
– Receiving the message & variables
local senderId , message, distance = rednet.receive()
local i = 0
local l = (message) - 1
local tp = 10
local senderId, message, distance = rednet.receive()
local w = (message)
local gm = w + l
local blkswu = 0
–Functions
function turnos()
turtle.turnRight()
turtle.turnRight()
end
function goback()
for i = 0,l do
turtle.forward()
end
end
function dig()
if turtle.detect() == true then
turtle.dig()
end
end
function forward()
if turtle.detect == false then
turtle.forward()
end
end
function mineUp()
if turtle.detectUp == true then
turtle.digUp()
turtle.up()
blkswu = blkswu + 1
repeat until turtle.detectUp == false
end
end
function godown()
for i = 0,blkswu do
turtle.down()
end
end
function filldown()
if turtle.detectDown() == false then
turtle.select(2)
turtle.placeDown()
end
end
function nl()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
function mine()
if gm == l+w then
for i = 0,l do
i = i + 1
filldown()
dig()
forward()
mineUp()
godown()
filldown()
end
end
end
function back()
turnos()
goback()
turnos()
end
function all()
for i = 0,w do
i = i + 1
mine()
back()
nl()
end
end
– getting all together
all()
o.k this is the program
the first part - getting the message and variables
is just receiving the message and setting the variables in the first part
the message is just from a wireless computer that sends 2 variable
that are a length and width of the area i want to flat
after this first part is setting up the functions as u can see function for every move
it also should fill the floor and the ceiling with the dirt(cobble etc) that is starts with in the second place
there is 2 main functions : mine() and all()
mine is just- 1. checks if there is an empty block under it and if it's empty it just fill it
2. if there is a block infront of it it will dig it
3. it will go forward if there is no block infront of it
4. it will mine up untill there is no block above him
5.after there is no block above him he will come down the same blocks he went up
6.he will check again if there is block below him and he will fill that up
im kinda new with this mod and every thing but i think i have a basic understanding of stuff..
i allready made a program that will do the same but it will mine up 3 block
and the length&width will adjustable by the user
and i wanted to make a flat area programs on the same thing
instead of doing as it supposed to do
i told it to flat 5 by 3
from where it started and instead it mined 1 block and went back
here is a picture of where it started and where it was supposed to do 5 by 3 and where it end up in
thanks very much and i hope you guys will find my problem
i'm just frustrated from my program.. it wont work as i want it to be
the program is programmed to flat an area given to it(example: you write from a wireless computer "flat 5 5" so it should flat 5 by 5 area and the Y (height) of it should be untill it wont detect any block under it.
here is the program:(ill explain it)
– Receiving the message & variables
local senderId , message, distance = rednet.receive()
local i = 0
local l = (message) - 1
local tp = 10
local senderId, message, distance = rednet.receive()
local w = (message)
local gm = w + l
local blkswu = 0
–Functions
function turnos()
turtle.turnRight()
turtle.turnRight()
end
function goback()
for i = 0,l do
turtle.forward()
end
end
function dig()
if turtle.detect() == true then
turtle.dig()
end
end
function forward()
if turtle.detect == false then
turtle.forward()
end
end
function mineUp()
if turtle.detectUp == true then
turtle.digUp()
turtle.up()
blkswu = blkswu + 1
repeat until turtle.detectUp == false
end
end
function godown()
for i = 0,blkswu do
turtle.down()
end
end
function filldown()
if turtle.detectDown() == false then
turtle.select(2)
turtle.placeDown()
end
end
function nl()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
function mine()
if gm == l+w then
for i = 0,l do
i = i + 1
filldown()
dig()
forward()
mineUp()
godown()
filldown()
end
end
end
function back()
turnos()
goback()
turnos()
end
function all()
for i = 0,w do
i = i + 1
mine()
back()
nl()
end
end
– getting all together
all()
o.k this is the program
the first part - getting the message and variables
is just receiving the message and setting the variables in the first part
the message is just from a wireless computer that sends 2 variable
that are a length and width of the area i want to flat
after this first part is setting up the functions as u can see function for every move
it also should fill the floor and the ceiling with the dirt(cobble etc) that is starts with in the second place
there is 2 main functions : mine() and all()
mine is just- 1. checks if there is an empty block under it and if it's empty it just fill it
2. if there is a block infront of it it will dig it
3. it will go forward if there is no block infront of it
4. it will mine up untill there is no block above him
5.after there is no block above him he will come down the same blocks he went up
6.he will check again if there is block below him and he will fill that up
im kinda new with this mod and every thing but i think i have a basic understanding of stuff..
i allready made a program that will do the same but it will mine up 3 block
and the length&width will adjustable by the user
and i wanted to make a flat area programs on the same thing
instead of doing as it supposed to do
i told it to flat 5 by 3
from where it started and instead it mined 1 block and went back
here is a picture of where it started and where it was supposed to do 5 by 3 and where it end up in
thanks very much and i hope you guys will find my problem