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

Programs on Displays with redstone

Started by LiquidFusion_, 07 October 2012 - 12:24 PM
LiquidFusion_ #1
Posted 07 October 2012 - 02:24 PM
I would like to run a program which displays info on a display when it receives a redstone signal. so far, ive got this.

under startup program:

repeat
sleep(1)
until rs.getInput("right")
monitor left secret/alongtimeago


whenever i try it, it says "bios:206: [string "startup"]:4: '=' expected



please help. its incredibly annoying.
remiX #2
Posted 07 October 2012 - 02:41 PM
I haven't used monitors before but I think it goes like this:

repeat
sleep(1)
until rs.getInput("right") then
shell.run("monitor", "left",program)
end

EDIT: Got what you wanted

Code to update monitor

function Clear(string)
  term.clear()
  term.setCursorPos(1,1)
  print(string)
end

while true do
  if rs.getInput("left") then
    shell.run("monitor","right","MonitorText") -- MonitorText is a separate file which contains what will be said on the monitor
    Clear("Updating monitor every second")
    sleep(1)
  else
    Clear("Not updating monitor.")
    sleep(2)
  end
end

Code i used to print on monitor
local MCTime = os.time()

term.clear() -- to clear the screen
term.setCursorPos(1,1) -- set position back to where it started
print("Writing on monitor! : D ")
print("Minecraft time: "..MCTime..".")