Jump to content




Monitor text coloring


  • You cannot reply to this topic
2 replies to this topic

#1 lolakkalol

  • New Members
  • 2 posts

Posted 30 September 2016 - 02: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!

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 30 September 2016 - 05:02 PM

You're not calling the function in your if statement. Put the parentheses in and you should see it work.

#3 lolakkalol

  • New Members
  • 2 posts

Posted 30 September 2016 - 06:58 PM

View PostLyqyd, on 30 September 2016 - 05:02 PM, said:

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 :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users