Posted 28 December 2013 - 08:49 AM
Hello all,
So I made a program that listens for a redstone signal and when it is turned off it prints a message to a monitor. Since it's always litening I thought it would be useful to have an 'X' that exited the program. I implemented this, however now neither te redstone event nor the 'X' work. It doesn't make a difference whether I put the redstone code or the 'X' code first. Anybody got any ideas?:
I would appreciate any help :)/>
So I made a program that listens for a redstone signal and when it is turned off it prints a message to a monitor. Since it's always litening I thought it would be useful to have an 'X' that exited the program. I implemented this, however now neither te redstone event nor the 'X' work. It doesn't make a difference whether I put the redstone code or the 'X' code first. Anybody got any ideas?:
mon = peripheral.wrap("right")
count = 0
term.clear()
term.setCursorPos(1, 1)
sleep(1)
print("Waiting for redstone input...")
print("Hold 'CTRL+T' to terminate")
term.setCursorPos(51, 18)
print("C")
term.setCursorPos(1, 18)
print("X")
term.setCursorPos(1, 4)
while true do
count = count+1
os.pullEvent("redstone")
if rs.getInput("bottom") == false then
print(" ")
print("Redstone input detected ("..count..")")
mon.setTextColor(colors.red)
mon.setTextScale(2)
mon.clear()
mon.setCursorPos(6, 2)
mon.write("DOORS")
mon.setCursorPos(5, 3)
mon.write("OPENED!")
sleep(2)
mon.clear()
end
end
repeat
event, button, x, y = os.pullEvent("mouse_click")
if x == 51 and y == 18 then
term.clear()
term.setCursorPos(1, 1)
print("Waiting for redstone input...")
print("Click X to terminate")
term.setCursorPos(1, 18)
print("X")
term.setCursorPos(51, 18)
print("C")
elseif x == 18 and y == 1 then
sleep(1)
term.clear()
term.setCursorPos(1, 1)
error()
end
until nil
I would appreciate any help :)/>