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

Question easy monitor print

Started by gheotic, 21 July 2012 - 11:46 PM
gheotic #1
Posted 22 July 2012 - 01:46 AM
Hello every on who is reading this =)

i have been working on a program for the last few days, but haven't got further at all, because it's i really thinks it looks complicated, i have coded before but that wasn't that complicated not at all. I have watched lots of videos and searched lot.
Now i kinda gave up trying doing this on my own. Its now necessary to make this i just want to know how to do it and learn more how to make my own programs in Computercraft =)

the program i want to make is:

i have a computer on the inside of my base in my friend's server, and a 2x2 monitor on facing outside. I want to be able to from the inside of my base print stuff on the monitor easy, without doing loads of commands, just 1 simple menu.
So i could print sentence like eg. I will be right back or Welcome to Gheotic's house.


my problems is kinda to make it check instantly if there is an input, and print it on the monitor at the same time on the computer.

I know this is very silly to ask if someone could do it but i have tried this for so long time but haven't got further.

i don't wanna command anyone to help me just do it if you feel like you want to, because i don't think i actually deserve help cause i haven't helped anyone by myself.

Picture here:
[attachment=334:2012-07-22_02.25.16.png]


Thanks =)
Lyqyd #2
Posted 22 July 2012 - 02:11 AM
You mean something like:


print("Please input a message:")
input = read()

local mon = nil

for _,s in pairs(rs.getSides()) do
    if peripheral.type(s) == "monitor" then
        mon = peripheral.wrap(s)
        break
    end
end

if mon then
    mon.clear()
    mon.setCursorPos(1,1)
    mon.write(input)
else
    print("No monitor attached!")
    sleep(1)
end

term.clear()
term.setCursorPos(1,1)
term.write(input)
gheotic #3
Posted 22 July 2012 - 11:29 PM
You mean something like:


print("Please input a message:")
input = read()

local mon = nil

for _,s in pairs(rs.getSides()) do
	if peripheral.type(s) == "monitor" then
		mon = peripheral.wrap(s)
		break
	end
end

if mon then
	mon.clear()
	mon.setCursorPos(1,1)
	mon.write(input)
else
	print("No monitor attached!")
	sleep(1)
end

term.clear()
term.setCursorPos(1,1)
term.write(input)


Thanks for the reply i really appreciate your time but i get the error monitortest:7: attempt to call nil

i have a no idea why?
Lyqyd #4
Posted 23 July 2012 - 12:39 AM
My mistake. peripheral.type should actually be peripheral.getType.
gheotic #5
Posted 23 July 2012 - 12:57 PM
Thank you so much =)
weareborg2913 #6
Posted 23 November 2012 - 05:04 PM
Hey is there anyway to set the text size?
Lyqyd #7
Posted 23 November 2012 - 05:14 PM
It'd be good to not resurrect such old topics. ;)/>/>

In this case, mon.setTextScale() just before the mon.write(input) should do what you want. mon.setTextScale takes anything between 0.5 and 5, in increments of 0.5, and it will only work for the monitor.
Orwell #8
Posted 23 November 2012 - 05:15 PM
Hey is there anyway to set the text size?
You're not really supposed to bump months old threads. And use the search function: http://www.computerc...__fromsearch__1 ;)/>/>
Edit: Ninja Lyqyd beat me to it again -_-/>/>