This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Goof's profile picture

[help][BoxPrint[xStart,xEnd,yStart,yEnd]Help] Question

Started by Goof, 25 October 2012 - 01:23 PM
Goof #1
Posted 25 October 2012 - 03:23 PM
Hey!


I am trying to make a function that Makes an Box with "#" as "Walls" of the box.
but everytime i tryed something, my mind was so close to explode… it is hard to program, but when i run that program i made, then it on ly displays this:


########
#
#
#
#
#
#


where i want it to do this:
¤ = air / space
#######
#¤¤¤¤¤#
#¤¤¤¤¤#
#¤¤¤¤¤#
#¤¤¤¤¤#
#¤¤¤¤¤#
#######


but can anyone post a link to a tutorial, to made that cind of boxes? or maybe just make a code(i know that its not supposed to make codes for me)to me.. please help


Thanks-


- mikk809h
Ditto8353 #2
Posted 25 October 2012 - 03:29 PM
A couple hints:
y2 - y1 = height

After the first row you need (height - 2) rows with space in the center, then the final row.
The left wall is located at x = x1
The right wall is located at x = x2
for i=y1,y2 do
   term.setCursorPos(x,i)
end
faubiguy #3
Posted 25 October 2012 - 03:34 PM
Here's some code:
function drawBox(startX, startY, endX, endY)
    for x = startX,endX do
        for y = startY,endY do
            if x == startX or x == endX or y == startY or y == endY then -- On an edge
                term.setCursorPos(x, y)
                term.write("#")
            end
        end
    end
end
Goof #4
Posted 25 October 2012 - 03:38 PM
Ty for quick response… i will use some of thoose codes.. if they works then i will be REALY happy ( if they would work with my WelcomeOS() operator system )