Posted 16 April 2015 - 06:18 PM
Hi, i'm just writing a script to turn on and off my Reactor.
I get the status from the reactor but it doesn't refresh automatically on the monitor.
It is only refreshing when i press any key in the computer.
Here is my code
Please help.
Thanks :)/>
I get the status from the reactor but it doesn't refresh automatically on the monitor.
It is only refreshing when i press any key in the computer.
Here is my code
local mon = peripheral.wrap("monitor_3")
local rec1 = peripheral.wrap("BigReactors-Reactor_1")
local cell = peripheral.wrap("cofh_thermalexpansion_energycell_1")
mon.clear()
function display()
mon.setTextScale(1)
mon.setCursorPos(1,1)
mon.write("Status:")
mon.setCursorPos(1,2)
mon.write("[ ] An")
mon.setCursorPos(1,3)
mon.write("[ ] Aus")
end
display()
function status()
if rec1.getActive() == true then
mon.setCursorPos(2,3)
mon.write(" ")
mon.setCursorPos(2,2)
mon.write("x")
elseif rec1.getActive() == false then
mon.setCursorPos(2,3)
mon.write("x")
mon.setCursorPos(2,2)
mon.write(" ")
end
end
function getClick()
local event, side, x, y = os.pullEvent()
status()
if event == "monitor_touch" then
status()
if x == 2 and y == 2 then
rec1.setActive(true)
status()
elseif x == 2 and y == 3 then
rec1.setActive(false)
status()
end
end
end
status()
while true do
status()
getClick()
print(rec1.getActive())
end
Please help.
Thanks :)/>