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

Center and Font Size Question

Started by ninjastricken, 24 March 2013 - 06:14 AM
ninjastricken #1
Posted 24 March 2013 - 07:14 AM
OK so I have tryed to get the text to center and make the font big but it wont work. I have been able to get the font to change but when I restart the server it dosent run automaticly. I have no clue on haw to make the font and center the text. the way i want it to look is like this.http://s24.postimg.o...23_14_12_53.png and http://s8.postimg.or...23_14_13_09.png
Engineer #2
Posted 24 March 2013 - 07:54 AM
I've made this script for you, was easy and bored:P

http://pastebin.com/jaDNwk00

If you have questions about this script please respond.
ninjastricken #3
Posted 24 March 2013 - 07:58 AM
Ok i dont know much but i got For input string: "1DollarDonations" does that mean i have to put something there
Engineer #4
Posted 24 March 2013 - 08:09 AM
Yes, you modify it:

1DollarDonations = {
  [1] = "your string",
  [2] = "another string",
  -- Etc.
}

And dont forget the comma, its very important!
ninjastricken #5
Posted 24 March 2013 - 08:18 AM
what about the For or input string: "1DollarDonations"
Engineer #6
Posted 24 March 2013 - 08:23 AM
what about the For or input string: "1DollarDonations"
Is that an error or what? Explain a little bit more.
ninjastricken #7
Posted 24 March 2013 - 08:25 AM
I don't know it just says that when i try to run the program. I type Monitor Top Don (what i named it) and i get that
pinksheep00 #8
Posted 24 March 2013 - 08:26 AM
Here is a more user friendly code :)/>

local w, h = term.getSize()
local function center(text)
    x, y = term.getCursorPos()
    term.setCursorPos((w/2)-#text/2, y)
    print(text)
end

center("this is where")
center("you put the text")
center("you want to center")
center("-pinksheep00")
ninjastricken #9
Posted 24 March 2013 - 08:33 AM
does that stay on the screen after the server is restarted?
pinksheep00 #10
Posted 24 March 2013 - 08:37 AM
when the server restarts or the chucks were unloaded the computers also restarts.
To fix this. make a new program and put this :

shell.run("Monitor Top Don")
then save it as "startup"
ninjastricken #11
Posted 24 March 2013 - 08:50 AM
OK so i'm so nooby that i have no clue where to put that.

here is the code i'm editing pastebin.com/pZnrkNpL
ninjastricken #12
Posted 24 March 2013 - 09:24 AM
when the server restarts or the chucks were unloaded the computers also restarts.
To fix this. make a new program and put this :

shell.run("Monitor Top Don")
then save it as "startup"
I have no idea where to put that

also it doesn't run the program on the screen unless i type monitor top Don
remiX #13
Posted 24 March 2013 - 10:32 PM
Try changing the name of 1DollarDonations to asomething that doesn't start with a number. I think it's erroring because of that.

Btw engineer, 'local w,h = term.getSize()' why you getting the size of the computer and not monitor? :P/>
theoriginalbit #14
Posted 24 March 2013 - 10:36 PM
yes variables cannot start with a number…

also a good way to do center is

term.setCursorPos( screen_width / 2 - #text / 2 + (#text % 2 == 0 and 0 or 1), y_pos)
this way the strings always look like they are in the middle whether they are an even or odd length.
Engineer #15
Posted 25 March 2013 - 12:55 AM
Try changing the name of 1DollarDonations to asomething that doesn't start with a number. I think it's erroring because of that.

Btw engineer, 'local w,h = term.getSize()' why you getting the size of the computer and not monitor? :P/>
yes variables cannot start with a number…

also a good way to do center is

term.setCursorPos( screen_width / 2 - #text / 2 + (#text % 2 == 0 and 0 or 1), y_pos)
this way the strings always look like they are in the middle whether they are an even or odd length.
It was late yesterday xD