Posted 09 November 2012 - 10:54 AM
Hey guys:
I just wanted you learn the code to draw a box as big as you want, where you want, with a title in it!
CODE:
http://pastebin.com/J1tJ2TUM
To download it to your computer type "pastebin get J1tJ2TUM boxdrawer" without the "'s and load it as a API and then run this code:
xpos=Where you want it in X
ypos=Where you want it in Y
xlong=How big you want it in X
ylong=How tall you want it in Y
header=The title
Thanks for your attention!
I just wanted you learn the code to draw a box as big as you want, where you want, with a title in it!
CODE:
Spoiler
function drawBoxHeader(xlong, ylong, xpos, ypos, header)
ywant = ylong
xlong = xlong-2
ylong = ylong-2
ycurrent = ypos+1
if #header % 2 == 0 then
adder = 3
else
adder = 2
end
term.setCursorPos(xpos, ypos)
term.write("+"..string.rep("-", xlong/2-#header+3)..header..string.rep("-", xlong/2-#header+adder).."+")
repeat
term.setCursorPos(xpos, ycurrent)
term.write("|"..string.rep(" ", xlong).."|")
ycurrent = ycurrent+1
until ycurrent == ypos+ywant
term.setCursorPos(xpos, ycurrent)
term.write("+"..string.rep("-", xlong).."+")
end
http://pastebin.com/J1tJ2TUM
To download it to your computer type "pastebin get J1tJ2TUM boxdrawer" without the "'s and load it as a API and then run this code:
boxdrawer.drawBoxHeader(xpos, ypos, xlong, ylong, header)
Where:xpos=Where you want it in X
ypos=Where you want it in Y
xlong=How big you want it in X
ylong=How tall you want it in Y
header=The title
Thanks for your attention!