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

Syntax error at monitor program

Started by Fiestaguy, 31 October 2012 - 08:55 AM
Fiestaguy #1
Posted 31 October 2012 - 09:55 AM
Hello, i got this problem at my monitor when i was working at the HQ of my company:


bios :206: [string "startup"] :5: syntax error

while true do
sleep(1)
if (redstone.getInput("right")) then
monitor, back, print("Latest News:")
monitor, back, print("Someone has entered!")
end
end

the "latest news:" part and "someone has entered!" part is for my monitor in the lobby for if someone has left, entered for if u got any questions about it
Luanub #2
Posted 31 October 2012 - 10:19 AM
if your trying to run the program monitor in your script then you need to use shell.run()

shell.run("monitor","back","programName")

Also I don't think you can use print, Only run a program on it with the monitor program.

You're going to want to wrap the monitor and print to it kind of like this.

local monitor = peripheral.wrap("back")
term.redirect(monitor)
print("Latest News:")
print("Someone has entered!")
term.restore() -- to send back to computer