Jump to content




[HELP] Monitor connection..


  • You cannot reply to this topic
2 replies to this topic

#1 1337patchy

  • Members
  • 15 posts

Posted 04 August 2012 - 09:29 PM

Hey :P/> I have a program that runs on startup, to display some info as follows
repeat
print("yada")
sleep(0.3)
print("lol")
x=3
until x==10

for example ;)/> i can use monitor front startup, but i would like the program to display into the monitor directly when the pc starts, so that i dont have to manually run the monitor after the server is restarted, so the connection to the monitor has to be inbuilt in the startup program..but why
i have this at top (before the repeat line):
local mon = peripheral.wrap("front")
if not mon then
print("error")
else
mon.clear()
end
and i tried replacing the print("yada") lines, to mon.write("yada") for example, but it only writes the first line, only executes what is before the sleep(0.3) :(/> Anyone can help me at this?

#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 04 August 2012 - 09:51 PM

The write function of the monitor won't move the cursor, you need to do it yourself. Or go the easy way and redirect the terminal:
local mon = peripheral.wrap("front") -- get the monitor
term.redirect(mon) -- redirect the output to the monitor
print("Hello, I'm on a monitor!") -- print some stuff to the monitor
term.restore() -- restore the output to the terminal


#3 1337patchy

  • Members
  • 15 posts

Posted 04 August 2012 - 10:03 PM

Thanks once again mate :P/>
Works as a charm!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users