Posted 06 August 2015 - 06:12 AM
So, I'm trying to make a control computer for a reactor lab, and what I've been trying to do is take input from the user while also updating the statuses of redstone signals on-screen.
Specifically, I have the redstone signal of my alarm system (A remote thermal monitor)
The problem then becomes, while using the read() function with parallel, My characters are not displayed, or so I have read, they are overwritten, and not redrawn on the screen.
I've searched and looked into similar problems, and have researched methods with using os.startTimer(1) but I cant figure out how I can apply this to my situation, for I am not too advanced in LUA.
My question is,
Is there any better method of doing this that could display similar results?
I still want my redstone signals to be tested and updated every 1 second, but I also want to type, while still seeing the characters.
Specifically, I have the redstone signal of my alarm system (A remote thermal monitor)
The problem then becomes, while using the read() function with parallel, My characters are not displayed, or so I have read, they are overwritten, and not redrawn on the screen.
I've searched and looked into similar problems, and have researched methods with using os.startTimer(1) but I cant figure out how I can apply this to my situation, for I am not too advanced in LUA.
My question is,
Is there any better method of doing this that could display similar results?
I still want my redstone signals to be tested and updated every 1 second, but I also want to type, while still seeing the characters.
function clear(sec)
term.clear()
term.setCursorPos(1,1)
if not sec == nil then
sleep(sec)
end
end
function getAllInputs()
clear()
while true do
alrm = rs.testBundledInput("bottom", colors.red)
chmbrdoor = rs.testBundledInput("bottom", colors.orange)
labdoor = rs.testBundledInput("bottom", colors.yellow)
local retx,rety = term.getCursorPos()
term.setCursorPos(1, 1)
term.clearLine()
if alrm then
term.write("Alarm: ")
term.setTextColor(colors.red)
term.write("Triggered")
term.setTextColor(colors.white)
else
term.write("Alarm: ")
term.setTextColor(colors.green)
term.write("Ready")
term.setTextColor(colors.white)
end
term.setCursorPos(retx,rety)
sleep(0.5)
end
end
function labDoors()
print("wip")
end
function cmds()
while true do
term.setCursorPos(1,2)
print("Choose an option from the list to manipulate")
print("LabDoors ChamberDoors Alarm Reactor")
inp = read("")
if inp == "LabDoors" then
labDoors()
else
print("Working on it still..")
sleep(2)
end
end
end
parallel.waitForAll(cmds, getAllInputs)
Edited on 06 August 2015 - 04:13 AM