Posted 15 July 2012 - 12:51 PM
So guys, the title is not that right, the thing i wan to ask to you is a bit tricky.
First, here's my code. It's basically a GUI on the computer to lightup/shut down my quarries and another program running on the monitor on top telling me if the Quarries are running or not by checking the redstone signal that the pipes send if items are passing trough (Buildcraft Gates). I putted 2 row of lamps at the sides of my giant screen and i connected them to the computer and i want that if the a quarry is not running the computer sends a redstone pulse to the lamps, but i cannot figure out how to do this. I know that i can use if and then but i don't know where to put 'em (i use parallels to running a program on the pc and another on the monitor). So guys, how to do that?
Thanks! :P/>/>
P.s. I'm not english, so if there are errors (i hope not) don't beat me D:
P.p.s. The formattation of the code is a little f*cked up because i ctrl+c ctrl+v from notepad++
First, here's my code. It's basically a GUI on the computer to lightup/shut down my quarries and another program running on the monitor on top telling me if the Quarries are running or not by checking the redstone signal that the pipes send if items are passing trough (Buildcraft Gates). I putted 2 row of lamps at the sides of my giant screen and i connected them to the computer and i want that if the a quarry is not running the computer sends a redstone pulse to the lamps, but i cannot figure out how to do this. I know that i can use if and then but i don't know where to put 'em (i use parallels to running a program on the pc and another on the monitor). So guys, how to do that?
Thanks! :P/>/>
P.s. I'm not english, so if there are errors (i hope not) don't beat me D:
P.p.s. The formattation of the code is a little f*cked up because i ctrl+c ctrl+v from notepad++
function1 = function()
-- Quarries Menu
term.clear()
term.setCursorPos(1, 1)
print(" Main Menu ")
print("#################################################")
print("# #")
print("# #")
print("# #")
print("# #")
print("# #")
print("# 1: Quarries On #")
print("# #")
print("# 2: Quarries Off #")
print("# #")
print("# #")
print("# #")
print("# #")
print("# #")
print("# Please select option: #")
print("#################################################")
term.setCursorPos(35, 16)write("")
answer = read()
if answer == "1"
then shell.run("quarrieson", true)
elseif answer == "2"
then shell.run("quarriesoff", true)
else term.setCursorPos(15, 16)
term.clearLine()
print("Not a valid command")
end
sleep (2)
shell.run("startup", true)
end
function2 = function()
-- Quarries status
while true do
mon = peripheral.wrap("top")
mon.clear()
mon.setCursorPos(1, 1)
mon.write(" Quarries status ")
mon.setCursorPos(1, 2)
mon.write("###############################################")
mon.setCursorPos(1, 3)
mon.write("# #")
mon.setCursorPos(1, 4)
mon.write("# #")
mon.setCursorPos(1, 5)
mon.write("# Quarry 1 Status: #")
mon.setCursorPos(1, 6)
mon.write("# #")
mon.setCursorPos(1, 7)
mon.write("# #")
mon.setCursorPos(1, 8)
mon.write("# Quarry 2 Status: #")
mon.setCursorPos(1, 9)
mon.write("# #")
mon.setCursorPos(1, 10)
mon.write("# #")
mon.setCursorPos(1, 11)
mon.write("# Quarry 3 Status: #")
mon.setCursorPos(1, 12)
mon.write("# #")
mon.setCursorPos(1, 13)
mon.write("# #")
mon.setCursorPos(1, 14)
mon.write("# Quarry 4 Status: #")
mon.setCursorPos(1, 15)
mon.write("# #")
mon.setCursorPos(1, 16)
mon.write("# #")
mon.setCursorPos(1, 17)
mon.write("###############################################")
-- Quarries status check
sleep(0.5)
if rs.testBundledInput("left", colors.white) == false
then mon.setCursorPos (29, 5) mon.write("Not Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.white) == true
then mon.setCursorPos (29, 5) mon.write("Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.orange) == false
then mon.setCursorPos (29, 8) mon.write("Not Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.orange) == true
then mon.setCursorPos (29, 8) mon.write("Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.magenta) == false
then mon.setCursorPos (29, 11) mon.write("Not Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.magenta) == true
then mon.setCursorPos (29, 11) mon.write("Not Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.lightBlue) == false
then mon.setCursorPos (29, 14) mon.write("Not Running")
end
sleep(0.5)
if rs.testBundledInput("left", colors.lightBlue) == true
then mon.setCursorPos (29, 14) mon.write("Running")
end
sleep(2)
end
end
parallel.waitForAny (function1, function2)