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

monitor

Started by tysciman7, 05 April 2013 - 12:47 PM
tysciman7 #1
Posted 05 April 2013 - 02:47 PM
Ok so I don't even know how to start this kind of programing but I want to have the height and width of the monitor so I can center things
Kingdaro #2
Posted 05 April 2013 - 02:51 PM
Wrap it, then use the getSize method.


local monitor = peripheral.wrap('whatever side your monitor is on')
local width, height = monitor.getSize()

monitor.write(width..'x'..height)
tysciman7 #3
Posted 06 April 2013 - 11:39 AM
Oh ok. Great! Do you know how to make a message able to enter the line after it goes far enough
baeshra #4
Posted 06 April 2013 - 06:51 PM
You can use monitor.setCursorPos(x,y) in conjunction with monitor.write("msg").
Smiley43210 #5
Posted 06 April 2013 - 07:05 PM
If in case you're talking about the screen that shows up when you left click a computer, use term.getSize(), term.setCursorPos(), and so on.
tysciman7 #6
Posted 07 April 2013 - 12:53 PM
What I mean is when you display something on a monitor if the message is too long then it goes off the screen
Engineer #7
Posted 07 April 2013 - 01:55 PM
You must use term.redirect for this.:

local m = peripheral.wrap("side")
term.redirect(m)
print("Hello world!")
term.restore()