Jump to content




How to show normal text on monitors


3 replies to this topic

#1 EpicKid1999

  • New Members
  • 8 posts

Posted 15 July 2012 - 01: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:

Posted Image

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

Like this:
Posted Image

And how do i change the text size?
------------Im a noob to computercraft ATM-------------

#2 1lann

  • Members
  • 516 posts
  • LocationAustralia

Posted 15 July 2012 - 03:04 PM

I suggest you to watch this video

#3 EpicKid1999

  • New Members
  • 8 posts

Posted 16 July 2012 - 11:03 PM

I did but it did not make any sence.

#4 Rsstn

  • Members
  • 53 posts
  • LocationLondon, UK

Posted 24 July 2012 - 08: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!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users