Hello Guest it is May 23, 2025, 04:11:21 PM

Author Topic: Hide an LED base on output state.  (Read 4226 times)

0 Members and 1 Guest are viewing this topic.

Hide an LED base on output state.
« on: November 08, 2024, 02:58:11 PM »
I don't do much with changing things on the screen with code.  So I'm lost on this one.
How can I make an LED hidden if an output state is off and visible when it is on?
I assume I can do that with the scr.SetProperty("ledTest", ) but I don't know what to put it to get the right property.
Chad Byrd
Re: Hide an LED base on output state.
« Reply #1 on: November 08, 2024, 03:21:46 PM »
Also, I found while doing some testing... this no longer works.
Here is an example of turning an LED on or off with this call.  It no longer works.
This is copied and pasted from a post from 2019 or something. 
     scr.SetProperty("FROLED", "Value", "1")         --Screen Property Example
I can't change the value of an LED or get the value the way I use to in lua. 
Chad Byrd

Offline Bill_O

*
  •  598 598
Re: Hide an LED base on output state.
« Reply #2 on: November 08, 2024, 04:01:44 PM »
This is wrong.
 scr.SetProperty("FROLED", "Value", "1")

This is how it should be.
 scr.SetProperty('FROLED', 'Value', '1')
Re: Hide an LED base on output state.
« Reply #3 on: November 08, 2024, 04:04:27 PM »
" or ' Doesn't make a difference. 
I have used both in LUA.  From what I have found they are interchangeable. 
Originally I had it with  '  and changed it to  "  .  Not really thinking it would help... but can't say I didn't try it. lol

I am using version 5036.  If that makes a difference on screen properties working or not.
Chad Byrd

Offline Bill_O

*
  •  598 598
Re: Hide an LED base on output state.
« Reply #4 on: November 08, 2024, 04:10:15 PM »
I had a few things that would not work if i used the incorrect one.
I am using an older version. 4157
I have a lot of custom stuff that I would need that working also.
Guess I'll keep the older rev.
Hope someone has your answer.
Re: Hide an LED base on output state.
« Reply #5 on: November 08, 2024, 04:12:05 PM »
Thanks Bill_O. 
I have code in the shop using either.  But oh well... maybe it is an issue with 5036.  I'll see if I have a download of an older version to use and try it out.
But for now... the weekend is calling.
Chad Byrd

Offline Bill_O

*
  •  598 598
Re: Hide an LED base on output state.
« Reply #6 on: November 08, 2024, 04:13:29 PM »
Have a brew for me.
Re: Hide an LED base on output state.
« Reply #7 on: November 09, 2024, 06:36:53 AM »
If you want the LED hidden when the output is on then add this to your signal library in the screen load script, adjust the output number as required.

Code: [Select]
[mc.OSIG_OUTPUT0] = function (state)
    scr.SetProperty("FROLED", "Hidden",  tostring(state) --Hides the LED when output is on, shows when output is off
end,

If you want it to show when output is on, then you will need to add an if statement and set the "Hidden" property to either "1" (hide) or "0" (show)