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

Monitor text coloring

Started by lolakkalol, 30 September 2016 - 01:00 PM
lolakkalol #1
Posted 30 September 2016 - 03:00 PM
Hi, i have a slight problem with changing the text color for what is printed or is going to be printed to the monitor. I can't seem to get the text after "Active: " to change color depending on if the

reactor1.GetActive()
is true or false

Here is my code


while true do
	 local reactor1 = peripheral.wrap("BigReactors-Reactor_0")
	 local mon = peripheral.wrap("monitor_0")
	 mon.clear()

	 mon.setCursorPos(1,1)
	 mon.setTextColor(colors.white)
	 mon.write("Active: ")

	 if reactor1.getActive==true then
	   mon.setTextColor(colors.lime)
	   mon.write(reactor1.getActive())
	 else
	   mon.setTextColor(colors.red)
	   mon.write(reactor1.getActive())
  end
  sleep(1)
end

So if the

reactor1.GetActive()
function is true the text is going to be lime green and if false its going to be red
If i missed anything please let me know
I'm using the mod Big Reactors

Thanks!
Lyqyd #2
Posted 30 September 2016 - 06:02 PM
You're not calling the function in your if statement. Put the parentheses in and you should see it work.
lolakkalol #3
Posted 30 September 2016 - 07:58 PM
You're not calling the function in your if statement. Put the parentheses in and you should see it work.
Thanks for your help i appreciate it :)/>