First you need to wrap the monitor to yourcomputer:
local m = peripheral.wrap("side")
m can be anything you want and side has to be: top, bottom, front, back, left and right.
So I want that my moniter prints hello world:
local m = peripheral.wrap("top")
m.write("hello world") -- print is in this case unavailable as far as I know
So let's say we want the user to input the side:
while true do
term.clear()
term.setCursorPos(1,1)
print("Side of the monitor: ")
monRead = lower.string(read()) -- lowers the string so it always hit a statement
if monRead == "top" or monRead == "bottom" or monRead == "front" or monRead == "back" or monRead == "left" or monRead == "right" then
local side = monRead
break
end
end
local m = peripheral.wrap(side)
m.write("Hello world")
This loop will not stop until it hits one of the conditions.
I know this from the
wiki. If you need more help, post it :)/>