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

Printing A Text From A Table, Makes One Row Below Text Be With Bacground Color I Print With

Started by makerimages, 16 November 2013 - 01:08 PM
makerimages #1
Posted 16 November 2013 - 02:08 PM
I have this


os.loadAPI("OSOne/Apis/DesignUtil");
term.setTextColor(colors.lightGray)
local background=DesignUtil.getDesign();
term.clear();
local width,height=term.getSize();
local unlockButton={
text="Unlock";
x=math.ceil(width/2);
y=math.ceil(height);
W=6;
H=1;
}
while true do
paintutils.drawImage(background,1,1);
term.setCursorPos(unlockButton.x,unlockButton.y);
term.setBackgroundColor(colors.gray);
print(unlockButton.text);
term.setCursorPos(1,1)
term.setBackgroundColor(DesignUtil.getColor())
print(width.." "..height)
sleep(1)
end

It is supposed to print unlockButton.text at the screen height. it does so one row above the screen height and makes the bottom row be dark gray..

like so
[attachment=1395:2013-11-16_21.14.45.png]
Edited on 16 November 2013 - 01:09 PM
Wojbie #2
Posted 16 November 2013 - 02:11 PM
You are using print() - that commands writes text then moves to next line - thats what causes dark line.

Try using write() - this command don't go to next line - so it will not go to next line.
Kingdaro #3
Posted 16 November 2013 - 02:12 PM
I would recommend using term.write instead, since write's word wrapping conventions can produce some unexpected results.
Edited on 16 November 2013 - 01:12 PM
makerimages #4
Posted 16 November 2013 - 02:13 PM
worked, ty