Posted 07 June 2016 - 12:54 PM
Hey Community,
I've started to control my Buildcraft Engines on Tekkit Legends with ComputerCraft. I want to control them with an adv. Computer und an adv. Monitor as Touchscreen.
You can Click ON to power one of the engines and OFF to stop it. My Problem is, I can start each engine without any problems. But when i try to stop them, the code works (no errors) but the redstone signal is still powered.
I think the "ON Code" overwrite the "OFF" Code, so the redstone cant be deactivated, but the code itself worked.
Here is the code.
ComputerCraft 1.74 in the Tekkit Legends Modpack
i hope you can help me. i tried it the whole night with different ways, but im out of ideas.
I've started to control my Buildcraft Engines on Tekkit Legends with ComputerCraft. I want to control them with an adv. Computer und an adv. Monitor as Touchscreen.
You can Click ON to power one of the engines and OFF to stop it. My Problem is, I can start each engine without any problems. But when i try to stop them, the code works (no errors) but the redstone signal is still powered.
I think the "ON Code" overwrite the "OFF" Code, so the redstone cant be deactivated, but the code itself worked.
Here is the code.
ComputerCraft 1.74 in the Tekkit Legends Modpack
local function addcol(col, side)
rs.setBundledOutput(side, colours.combine(rs.getBundledOutput(side),col))
end
local function remcol(col, side)
rs.setBundledOutput(side, colours.subtract(rs.getBundledOutput(side),col))
end
term.clear()
local monitor = peripheral.wrap("top")
monitor.setTextScale(1)
term.setTextColour(1)
term.setCursorPos(1,1)
print("Engine I:")
term.setCursorPos(1,2)
print("Engine II:")
term.setCursorPos(1,3)
print("Engine III:")
term.setCursorPos(1,4)
print("Engine IV:")
term.setTextColour(32)
term.setCursorPos(15,1)
print("O [OFF]")
term.setCursorPos(15,2)
print("O [OFF]")
term.setCursorPos(15,3)
print("O [OFF]")
term.setCursorPos(15,4)
print("O [OFF]")
term.setTextColour(16384)
term.setCursorPos(25, 1)
print("O [ON]")
term.setCursorPos(25, 2)
print("O [ON]")
term.setCursorPos(25, 3)
print("O [ON]")
term.setCursorPos(25, 4)
print("O [ON]")
term.setTextColour(1)
term.setCursorPos(37,4)
print("X")
local sSide = "back"
while true do
event,side,x,y = os.pullEvent()
if event == "monitor_touch" then
if x == 37 and y == 4 then
redstone.setBundledOutput(sSide, 0)
term.setTextColour(16384)
term.setCursorPos(25,1)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,1)
print("O [OFF]")
term.setTextColour(16384)
term.setCursorPos(25,2)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,2)
print("O [OFF]")
term.setTextColour(16384)
term.setCursorPos(25,3)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,3)
print("O [OFF]")
term.setTextColour(16384)
term.setCursorPos(25,4)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,4)
print("O [OFF]")
end
if x == 15 and y == 1 then
remcol(colours.lime, sSide)
term.setTextColour(16384)
term.setCursorPos(25,1)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,1)
print("O [OFF]")
end
if x == 25 and y == 1 then
addcol(colours.lime, sSide)
term.setTextColour(32)
term.setCursorPos(25,1)
print("O [ON]")
term.setTextColour(16384)
term.setCursorPos(15,1)
print("O [OFF]")
end
if x == 25 and y == 2 then
addcol(colours.yellow, sSide)
term.setTextColour(32)
term.setCursorPos(25,2)
print("O [ON]")
term.setTextColour(16384)
term.setCursorPos(15,2)
print("O [OFF]")
end
if x == 15 and y == 2 then
remcol(colours.yellow, sSide)
term.setTextColour(16384)
term.setCursorPos(25,2)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,2)
print("O [OFF]")
end
if x == 25 and y == 3 then
addcol(colours.orange, sSide)
term.setTextColour(32)
term.setCursorPos(25,3)
print("O [ON]")
term.setTextColour(16384)
term.setCursorPos(15,3)
print("O [OFF]")
end
if x == 15 and y == 3 then
remcol(colours.orange, sSide)
term.setTextColour(16384)
term.setCursorPos(25,3)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,3)
print("O [OFF]")
end
if x == 25 and y == 4 then
addcol(colours.white, sSide)
term.setTextColour(32)
term.setCursorPos(25,4)
print("O [ON]")
term.setTextColour(16384)
term.setCursorPos(15,4)
print("O [OFF]")
end
if x == 15 and y == 4 then
remcol(colours.white, sSide)
term.setTextColour(16384)
term.setCursorPos(25,4)
print("O [ON]")
term.setTextColour(32)
term.setCursorPos(15,4)
print("O [OFF]")
end
end
end
i hope you can help me. i tried it the whole night with different ways, but im out of ideas.
Edited on 07 June 2016 - 11:41 AM