Jump to content




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


  • You cannot reply to this topic
3 replies to this topic

#1 makerimages

  • Members
  • 236 posts

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
Attached Image: 2013-11-16_21.14.45.png

Edited by makerimages, 16 November 2013 - 02:09 PM.


#2 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

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.

#3 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

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 by Kingdaro, 16 November 2013 - 02:12 PM.


#4 makerimages

  • Members
  • 236 posts

Posted 16 November 2013 - 02:13 PM

worked, ty





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users