Difference between revisions of "Advanced Monitor"

From ComputerCraft Wiki
Jump to: navigation, search
m (Made external type link to the Colors API an internal one: use [[ ]] for internal-page links.)
(Updated page references to internal links and changed code examples to ref. Peripheral tables (Peripheral API page).)
Line 1: Line 1:
The Advanced Monitor is a new, improved version of the [[Monitor]]. It has the ability to show coloured text and programs on the screen. It is also golden colored on it's sides, similar to the [[Advanced Computer]]. For available colors, see [[Colors_(API)#Colors|Colors API]].
+
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 Computer|Advanced Computers]] and the [[Advanced Monitor|Advanced Monitors]], see [[Colors_(API)#Colors|Colors API]].
 +
 
 
==Recipe==
 
==Recipe==
 
{{Crafting grid
 
{{Crafting grid
Line 8: Line 13:
 
  }}
 
  }}
 
==Using an Advanced Monitor==
 
==Using an Advanced Monitor==
''See [[Peripheral (API)#Monitor|Peripheral (API)]] for more details.''
+
''See [[Peripheral (API)#Monitor|Peripheral (API)]] for more details on the methods exposed by the Advanced Monitor, and how to wrap and call methods in peripherals.''
  
To use an Advanced Monitor, you need to call a method using the Peripheral API. This is one example:
+
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 [[Colors (API)#color|color]].
  
peripheral.call("side", "function", var1, var2, ...)
+
The Advanced Monitor introduces two new methods: ''[[term.setTextColor|monitor.setTextColor]]([[colors (API)#colors|color]])'' and ''[[term.setBackgroundColor|monitor.setBackgroundColor]]([[colors (API)#colors|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.
  
For example:
+
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!")
 
  peripheral.call("top", "write", "Hello World!")
  
You can also "wrap" the peripheral side to a variable:
+
-- You can also "wrap" the peripheral side to a variable:
 
+
 
  local monitor = peripheral.wrap("top")
 
  local monitor = peripheral.wrap("top")
 
Now, you can call functions that way.
 
 
 
  monitor.write("Hello World!")
 
  monitor.write("Hello World!")
 
There are two new functions (four including the british-spelled color (colour)):
 
 
[[term.setTextColor|monitor.setTextColor]]([[colors (API)#colors|color]])
 
 
[[term.setBackgroundColor|monitor.setBackgroundColor]]([[colors (API)#colors|color]])
 
  
 
[[Category:Blocks]]
 
[[Category:Blocks]]

Revision as of 15:16, 28 November 2012

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!")