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

How to show normal text on monitors

Started by EpicKid1999, 15 July 2012 - 12:45 PM
EpicKid1999 #1
Posted 15 July 2012 - 02:45 PM
Hi!
How do i add text to a monitor + Change its text size.
I know that if i do "Monitor right label set (Text i want)" it will display this:



But then how do i get it to display Just the text?

Like this:


And how do i change the text size?
————Im a noob to computercraft ATM————-
1lann #2
Posted 15 July 2012 - 04:04 PM
I suggest you to watch this video http://www.youtube.com/watch?v=h1P3_f_-gVE
EpicKid1999 #3
Posted 17 July 2012 - 12:03 AM
I did but it did not make any sence.
Rsstn #4
Posted 24 July 2012 - 09:51 PM
The video posted above is pretty clear, and you can just look at the code used in the video - It's not hard to work out what each part does!
To change the text size as part of a program, use the following code:


peripheral.wrap("SIDE").setTextScale(SIZE)
Where 'SIDE' is the side to which the monitor is attached, and 'SIZE' is a number between 1 and 5 that sets the text size.

To output text to the monitor, you shoud use the following code:


peripheral.wrap("SIDE").write("TEXT YOU WANT")
Where 'SIDE' is the side of the computer that the monitor is attached to.

You can also use the 'clear()' and 'setCursorPos()' functions as usual, but the 'term' part at the beginning of the standard code should be replaced with 'peripheral.wrap("SIDE")'. For example:

peripheral.wrap("SIDE").clear()                        //Clears the monitor screen
peripheral.wrap("SIDE").setCursorPos(1,1)	 //Sets the co-ordinates of the cursor to (1,1)

If you will be using the above pieces of code lots in your program, you can define 'peripheral.wrap("SIDE")' as a variable called something like 'monitor' to make your life easier. For example:


monitor = peripheral.wrap("SIDE")
monitor.clear()			   //clears the screen
monitor.write("Hello")	 //writes 'Hello' to the screen
This is a much easier way to use this code!

If you want to use this code on its own and not as part of a program, run the computer program 'lua' (to open up the Lua command prompt), then use the commands directly!

Hope this helps!