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

monitor text

Started by sjoerd2k, 02 January 2014 - 01:20 PM
sjoerd2k #1
Posted 02 January 2014 - 02:20 PM
i want a text on a monitor but how do i do it can sombody help my?
TheOddByte #2
Posted 02 January 2014 - 04:12 PM
First, Wrap it

local mon --# Create a variable for the monitor
for _, name in ipairs( peripheral.getNames() ) do -- Loop through all peripherals attached
	if peripheral.getType( name ) == "monitor" then -- Check if the peripheral type was a monitor
		mon = peripheral.wrap( name ) -- If it was the wrap it
		break -- And break from the loop
	end
end
Now it's simple, You can do this

mon.write("Hello World!")

Note that all the 'term' functions does work for monitors, So you can do this
mon.clear()
mon.setCursorPos(1,1)
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
etc..
Edited on 02 January 2014 - 03:16 PM
Lyqyd #3
Posted 02 January 2014 - 04:59 PM
You can also use term.redirect, which will allow you to then use print() and write() and textutils.tabulate(), etc.