Posted 07 August 2012 - 03:29 PM
So, I wont be at my minecraft computer for a while so I want to know if this'll work before I come back.
I want to draw a box right around the screen from the second line downwards.
sorry this is quite a big peice of code so it must be messy
I will then use the functions like…
Things I'm not sure about:
- my loops
- the whole of the drawSides() function
I want to draw a box right around the screen from the second line downwards.
sorry this is quite a big peice of code so it must be messy
-- Section: 1
-- Variables
length = (length of screen) -- I will insert the length and height of the screen later
height = (height of screen)
-- Secion: 2
-- Functions
-- draw the top and bottom
-- topChar/bottomChar - enter the characters for use.
-- cornerBool - checks if you want special corner characters
-- cornerChar - the caracter for corner
function drawTopandBottom( boxChar, cornerBool, cornerChar )
local function Aline() -- Aline() writes the line WITH corners
local x = 2
for
i = 0, (length -2), 1 do
term.setCursorPos( x, y )
print( boxChar )
local x = x + 1
sleep(0.05)
end
end
local function Bline() -- Bline() writes the line WITHOUT corners
local x = 1
for
i = 0, (length), 1 do
term.setCursorPos( x, y )
sleep( 0.05 )
end
end
if cornerBool == true
then
term.clear()
local y = 2
term.setCursorPos( 1, y )
print( cornerChar )
Aline()
print( cornerChar )
local y = height
term.setCursorPos( 1, y )
print( cornerChar )
term.setCursorPos( 2, y )
Aline()
term.setCursorPos( x, y )
print( cornerChar )
elseif cornerBool == false
then
term.clear()
term.setCursorPos( 1, 2 )
local y = 2
Bline()
local y = height
term.setCursorPos( 1, y )
Bline()
end
end
function drawSides( sideChar )
term.setCursorPos( 1, 3 )
for i = 0, (height - 4), 1 do
print( sideChar )
end
term.setCursorPos( length.. - 1, 3 )
for i = 0, (height - 4 ), 1 do
local x,y = term.getCursorPos
y = y + 1
term.setCursorPos( y )
end
end
I will then use the functions like…
drawTopAndBottom( "-", true, "x" )
drawSides( "|" )
Things I'm not sure about:
- my loops
- the whole of the drawSides() function