Posted 25 December 2012 - 06:58 AM
hi everyone, so i'm making a cinema with the help of cc (obviously). I've made a code (with help of this forum, i'm useless at coding) which turns on a computer and plays the "along time ago" movie. At first this was supposed to work from startup but i found that it didn't recognize the redstone signal if the computer was off unless there is away. so i changed the code to run after you start a program up which for ease i just called the program test so you turn the computer on then type test then it waits for a redstone signal and when thats found it plays the movie.
While this works fine i want to change the code so that when i turn the lever off it will stop the movie (or terminate the program). The redstone circuit is set up as follows: there is a lever in a room which leads to a redstone lamp above which simulates a projector (i may adapt it so it flickers like a projector). Also from the same lever there is redstone leading to the computer positioned behind the monitor. So basically when i turn the projector (redstone lamp) on the movie begins playing but i also want it so that when i turn the project off the movie stops playing thus the screen goes blank.
Here is the original: code (before i tried to make it terminate the program without help):
while true do
os.pullEvent("redstone")
if rs.getInput("right") then – change side to the side you want to check
shell.run("monitor", "back", "secret/alongtimeago")
break
end
end
below is the code after i tried to go what im asking for help with by myself (but i'm useless at coding so it failed)
while true do
os.pullEvent("redstone")
if rs.getInput("right") then – change side to the side you want to check
shell.run("monitor", "back", "secret/alongtimeago") else
os.pullEvent("redstone")
if not rs.getInput("right") then
os.pullEvent(terminate)
break
end
end
While this works fine i want to change the code so that when i turn the lever off it will stop the movie (or terminate the program). The redstone circuit is set up as follows: there is a lever in a room which leads to a redstone lamp above which simulates a projector (i may adapt it so it flickers like a projector). Also from the same lever there is redstone leading to the computer positioned behind the monitor. So basically when i turn the projector (redstone lamp) on the movie begins playing but i also want it so that when i turn the project off the movie stops playing thus the screen goes blank.
Here is the original: code (before i tried to make it terminate the program without help):
while true do
os.pullEvent("redstone")
if rs.getInput("right") then – change side to the side you want to check
shell.run("monitor", "back", "secret/alongtimeago")
break
end
end
below is the code after i tried to go what im asking for help with by myself (but i'm useless at coding so it failed)
while true do
os.pullEvent("redstone")
if rs.getInput("right") then – change side to the side you want to check
shell.run("monitor", "back", "secret/alongtimeago") else
os.pullEvent("redstone")
if not rs.getInput("right") then
os.pullEvent(terminate)
break
end
end