1 posts
Posted 17 August 2012 - 04:15 AM
Alright look all i want to do is display a message, on an 4 block high 8 wide screen the screen is on the left so moniter left…. somthing but i want it to always or changeably say "Welcome to Louis and Swallum's Home!!!" Now how can i go about doing this without having to kill myself? keep in mind i want it on the screen, i do not have access to the server files.
Edit: I dont want it to be small, i want it large and to be centered on the screen.
504 posts
Location
Seattle, WA
Posted 17 August 2012 - 03:55 PM
I would suggest getting the dimensions of the screen and storing them as variables so you can print to the center.
Here's an example:
mon = peripheral.wrap( "left" ); -- 'Get a handle on the monitor object to the left of the computer.'
term.redirect( mon ); -- 'Redirect all output to the monitor.'
ScreenWidth, ScreenHeight = term.getSize(); -- 'Get the dimensions of the screen that this is running on.'
mon.setTextScale( 2 ); -- 'Set the text size. You can change this to your liking. 1 - 5.'
function cPrint( height, string ) -- 'This function prints to the center of the screen on the line given as 'height'.'
term.setCursorPos( ScreenWidth/2 - string.len( string )/2, height );
-- '^^ The above sets the position of the cursor to the center of the screen to print 'string'.'
-- '^^ This may not work as well as it would with normal text size with a larger text.'
term.write( string ); -- Writes the text to the monitor.
end
cPrint( ScreenHeight/2, "Welcome to Louis and Swallum's Home!!!" ); -- 'Draws the text you wanted to the center of the screen.'
If you have any questions about the code, feel free to PM me.
Hope I helped! :(/>/>