This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
HMJonesy's profile picture

Big reactor Monitor

Started by HMJonesy, 03 September 2014 - 09:48 PM
HMJonesy #1
Posted 03 September 2014 - 11:48 PM
Hi im new to CC and was hoping to get some help with what i thought was easy.

I have got 2 monitors and computer hoocked up to big reactor.

so far I have managed to get the monitor to show in green when the reactor is active, when i turn the reactor off i want it to show offline in red but nothing shows on screen. No errors are shown on computer, just no text when i turn off reactor.

currently it shows like this when on Reactor: Online and like this when off Reactor:


local reactor = peripheral.wrap("BigReactors-Reactor_1")
local turbine = peripheral.wrap("BigReactors-Turbine_0")
local mon = peripheral.wrap("left")
while true do
sleep(5)
mon.clear()
  mon.setCursorPos(1,1)
  mon.setTextColor(colors.white)
  mon.write("Reactor: ")
  if reactor.getActive (true) then
	mon.setTextColor(colors.lime)
	mon.write("Online")
	elseif reactor.getActive (false) then
	mon.setTextColor(colors.red)
	mon.write("Offline")
	end
end
KingofGamesYami #2
Posted 04 September 2014 - 02:22 AM
try


if reactor.getActive() then
  mon.setTextColor( colors.lime )
  mon.write( "online" )
else
  mon.setTextColor( colors.red )
  mon.write( "Offline" )
end
HMJonesy #3
Posted 04 September 2014 - 10:14 AM
Thank you so much, works great :)/>