Jump to content




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


6 replies to this topic

#1 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 16 June 2013 - 01: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?

#2 diegodan1893

  • Members
  • 164 posts
  • LocationSpain

Posted 16 June 2013 - 02:59 PM

Mikeemoo answered your question in the thread

View PostMikeemoo, on 16 June 2013 - 02:18 PM, said:

Yes it is even possible. text has a method called getWidth(), so you can use that to calculate.


#3 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 16 June 2013 - 04: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.

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 June 2013 - 04: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.

#5 MR_nesquick

  • Members
  • 106 posts
  • LocationNorway

Posted 17 June 2013 - 11:23 AM

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)

#6 Mikeemoo

  • Members
  • 732 posts
  • LocationLondon, UK

Posted 17 June 2013 - 03: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.

#7 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 17 June 2013 - 06: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! :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users