Advanced Monitor

From ComputerCraft Wiki
Revision as of 23:51, 28 November 2012 by AfterLifeLochie (Talk | contribs) (Merged the Peripheral table for Monitors into here.)

Jump to: navigation, search

The Advanced Monitor is a new, improved version of the Monitor.

In contrast with the standard Monitor, the Advanced Monitor has the ability to show colored text and programs on the screen, and the Advanced Monitor is golden (like the Advanced Computer), rather than the default stone grey color of the standard Monitor.

For a list of the available colors on both Advanced Computers and the Advanced Monitors, see Colors API.

Recipe

Gold_Ingot

Gold_Ingot

Gold_Ingot

Gold_Ingot

glass_pane

Gold_Ingot

Gold_Ingot

Gold_Ingot

Gold_Ingot

Advanced_Monitor



Using an Advanced Monitor

See Peripheral (API) for more details on the methods exposed by the Advanced Monitor, and how to wrap and call methods in peripherals.

The Advanced Monitor behaves exactly the same as the standard Monitor - except the Advanced Monitor is able to render text with a foreground and background color.

The Advanced Monitor introduces two new methods: monitor.setTextColor(color) and monitor.setBackgroundColor(color). These functions allow you to draw text with a specific foreground and background color. Please note that both spellings of the word color are accepted.

To use an Advanced Monitor, you need to either call a method, or wrap the monitor using the Peripheral API. For this example, we have an Advanced Monitor connected to the top of our Computer:

-- Immediately invoke a method without wrapping
peripheral.call("top", "write", "Hello World!")
-- You can also "wrap" the peripheral side to a variable:
local monitor = peripheral.wrap("top")
monitor.write("Hello World!")

Peripheral Functions

monitor stands for the variable you wrapped the monitor to. Example: monitor = peripheral.wrap( "top" )

Methods in italic are available on Advanced Monitors only.

Method name Description
monitor.write() Write to the Monitor's screen.
monitor.scroll(n) Scrolls the monitor screen.
monitor.setCursorPos(x, y) Sets the cursor position on the Monitor.
monitor.setCursorBlink(b) Enables or disables cursor blinking.
monitor.getCursorPos() Returns two arguments containing the x and the y position of the cursor on the Monitor.
monitor.getSize() Returns two arguments containing the x and the y values stating the size of the Monitor.
monitor.clear() Clears the Monitor.
monitor.clearLine() Clears the line the cursor is on.
monitor.setTextScale(scale) Sets the size of the text on the Monitor. Textscale can be between 0.5 and 5.0, with increments of 0.5
monitor.setTextColor(color) Sets the text-color of the Advanced Monitor. Available only to Advanced Monitors
monitor.setBackgroundColor(color) Sets the background-color of the Advanced Monitor. Available only to Advanced Monitors