Center-ising text in miniconsoles

Post Reply
tarrant
Posts: 49
Joined: Thu Apr 15, 2010 10:36 pm

Center-ising text in miniconsoles

Post by tarrant »

I'm trying to place some text in the centre of a small miniconsole i made with this.

Code: Select all

echo( "LagConsole", "<center>Lag = " .. x.value .. "</center>")
In the console, it displays <center>Lag = 0.00</centre>.
Am i doing it wrong? If so, how do i set it such that the text is displayed in the centre of my miniconsole?

Edit: I'm using this miniconsole for only this echo, if there's a better way to display it, feel free to correct me. Thanks.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Center-ising text in miniconsoles

Post by Vadi »

Consoles don't accept html. Demonnic wrote a centering function that he posted here though.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Center-ising text in miniconsoles

Post by demonnic »

This is the forum post in question.

It's fairly well laid out there, but if you need any help with it, feel free to ask.

tarrant
Posts: 49
Joined: Thu Apr 15, 2010 10:36 pm

Re: Center-ising text in miniconsoles

Post by tarrant »

Code: Select all

echo("UpTimeConsole", align("Uptime = " .. x.value))
Shows
<white>< chunk of space ><white><white> Uptime = 1.5 days <white><white><chunk of space> |

the left most <white> is where the miniconsole starts, and the pipe is where it ends. The pipe is not really there, i just put it in to show the length of the miniconsole.
I could probably alter it such that therer isn't so much space, but the problem is the <white> that is showing.
Any ideas?

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Center-ising text in miniconsoles

Post by demonnic »

yeah, put the code in a text editor, search for <white> and remove it. I need to make two versions, one for cecho and one for regular echo. Haven't done it yet though. I thought I had a bit about that at the bottom of the forum post I sent, but I could be misremembering.

Post Reply