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

[Question]Is there a way to permanently run a program though monitor?

Started by Stormkrow, 01 June 2012 - 01:54 PM
Stormkrow #1
Posted 01 June 2012 - 03:54 PM
As the title said is there a way to permanently or constantly run a program through a monitor?
Lolgast #2
Posted 01 June 2012 - 04:13 PM
How do you mean? If you want the program to run over and over again, just use
while true do
 ...
end
If you want to know how to use the monitor, you need
monitor = peripheral.wrap("side") -- replace side with the side the monitor's on
term.redirect(monitor)
...
term.restore() -- only if you want it back on the computer again
Stormkrow #3
Posted 01 June 2012 - 04:30 PM
Well i mean that the program will be run on the monitor at all times
MysticT #4
Posted 01 June 2012 - 06:09 PM
If you want your program to run on a monitor, use this (same as Lolgast said):

local mon = peripheral.wrap("<side>") -- replace <side> with the side of the monitor
if not mon the
  print("No monitor found")
  return
end
term.redirect(mon)
-- Your program code here
term.restore() -- to go back to the terminal
But if you want to run every program in the monitor, make a program with this:

local mon = peripheral.wrap("<side>") -- replace <side> with the side of the monitor
if not mon the
  print("No monitor found")
  return
end
term.redirect(mon)
When you run it, the output will be redirected to the monitor. But you won't see anything on the terminal, so it will be hard to write.
Lyqyd #5
Posted 01 June 2012 - 06:50 PM
Perhaps you also want to add an entry to the startup file? Just saying "on the monitor all the time" is pretty vague. Many possible interpretations there.
Stormkrow #6
Posted 01 June 2012 - 08:48 PM
I got it working now with the code that lolgast gave me, thanks people!