19 posts
Posted 31 August 2012 - 12:20 AM
Hello,
Im trying to make text on the screen span from one end to the other without having to count the spaces, or basically trial and error it.
Here's what ive been doing……
Term.setCursorPos(1,1)
print("____________________________________________")
Thats waht ive done before, im trying to get it so if i attach a monitor of larger size it spans that monitor length. Im am somewhat new to coding, so srry im confusing the F*** out of you, but please help in anyway!
Thanks!
1111 posts
Location
Portland OR
Posted 31 August 2012 - 02:07 AM
Try doing something like this. I haven't tested it but it should work.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
797 posts
Posted 31 August 2012 - 02:12 AM
Try doing something like this. I haven't tested it but it should work.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
that will make 18 lines (y is the down length) try this function:
function drawLine(nLine,character)
local x, y = term.getSize()
term.setCursorPos(1,nLine)
for i = 1,x do
write(character)
end
end
1111 posts
Location
Portland OR
Posted 31 August 2012 - 02:18 AM
Try doing something like this. I haven't tested it but it should work.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
that will make 18 lines (y is the down length) try this function:
function drawLine(nLine,character)
local x, y = term.getSize()
term.setCursorPos(1,nLine)
for i = 1,x do
write(character)
end
end
lol you're right I had them backwards..
1688 posts
Location
'MURICA
Posted 31 August 2012 - 04:08 AM
You know, you could just use string.rep(), it's easier than using a for loop.
function drawLine(nLine, sChar)
local w,h = term.getSize()
print(string.rep(sChar, w))
end