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

Help with printing text in the middle of an object in OpenPeripheral Glasses

Started by Geforce Fan, 16 June 2013 - 12:05 PM
Geforce Fan #1
Posted 16 June 2013 - 02:05 PM
I'm posting here since my post in peripheral help got no attention. I'm using OpenPeripheral Terminal Glasses and I can't figure out how to print into the center of an object. Can anyone show me how?
diegodan1893 #2
Posted 16 June 2013 - 03:59 PM
Mikeemoo answered your question in the thread
Yes it is even possible. text has a method called getWidth(), so you can use that to calculate.
Geforce Fan #3
Posted 16 June 2013 - 05:16 PM
Sorry for posting everywhere, it's just I had not gotten answers in a long time, and I was sort of needing them to continue on CCGlass.
yes, I know about Plastic, but CCGlass is basically more for practical uses and entertaining you while your bored, Plastic is more of the sometimes-handy super advanced watch. In my opinion.
Lyqyd #4
Posted 16 June 2013 - 05:27 PM
Be more patient. We are not here at your beck and call. This is a forum, not an instant messaging service. Give it a couple days before you assume nobody is going to answer. Three hours is not "a long time". The Peripheral Help and Discussion board is for help creating peripherals, not using them. The first place to ask should be in that peripheral's topic. Wait a few days for an answer, and if you still haven't gotten one, only then should you post in Ask a Pro.
MR_nesquick #5
Posted 17 June 2013 - 12:23 PM
Text = "Center"


……CY
CX *————————* C2
….. |…………………………|
……|…………………………|
……|……….Center………|
……|…………………………|
……| ………………………..|
……*————————*
…..C3



X = (C2 / 2) + (CX / 2)
Y = (C3 / 2) + (CY / 2)
A = tonumber(#Text/2)

term.setCursorPos(X-A,Y)
print(Text)
Mikeemoo #6
Posted 17 June 2013 - 04:28 PM
I try to be as helpful as possible in my mod threads and fix bugs and offer support within as little time as possible.

However, I'm quite happy for you to work this one out yourself.

You have a method to get the width of text. You know how wide your box is. With some extremely simple maths I'm sure you can work it out yourself.
Geforce Fan #7
Posted 17 June 2013 - 07:22 PM
I've already gotten the answer.from what Isaw there's nothing that says you can get the width of text on the topic.
Could an admin delete this topic, or at least lock it? Thanks! :)/>