Jump to content

ELSE examples?


gregoryx

Recommended Posts

I see a little "else" stuff here and there... and I feel like I'm really missing some program functions by not knowing how to use it right.

 

It seems when I see it it's used something like "if control of a device turns ON then..." and the else is... uh... any other type of control? of that device? It confuses me.

 

Can someone point me to examples where it's making the program work or work better?

Link to comment

Hey Gregory -

 

ELSE will run when something in the IF statement is specifically not true. For example this program:

 

If
       IR '1' is Pressed
   And IR '2' is not Pressed

Then
       Set Scene 'TheaterMain' On

Else
       Set Scene 'TheaterMain' Off

 

The THEN statement will run if the program is TRUE (IR 1 is pressed), and the ELSE statement will run if the program becomes FALSE (IR 2 is pressed).

Link to comment
  • 2 weeks later...
If I understand, the only time an "ELSE" would run is if another program called its "Run (If)". Otherwise, if the program triggers on its own, the "IF" conditions were already true and the "ELSE" would not run.

 

Not exactly. A program is evaluated every time any of the Conditions in the program change. If the conditions are met the Then clause is executed, otherwise the Else actions are performed.

 

In jrabin's program example anytime IR '1' changes the program is evaluated.

 

Rand

Link to comment
A program is evaluated every time any of the Conditions in the program change. If the conditions are met the Then clause is executed, otherwise the Else actions are performed.

Thanks Rand - Maybe you can help me understand why this doesn't work. I would expect the light to dim to 35% after 1 minute UNLESS I turn it off or dim it at the switch. Then I'd expect it to stay at whatever level I set it to.

 

Turning it off does what I'd expect, it turns off and stays off. But if I dim the light, the program continues to Run and stays "True", then dims to 35% after the 1 minute is up.

 

If
       Control 'Front: Lights' is not switched Dim
   And Control 'Front: Lights' is not switched Off
   And Control 'Front: Lights' is not switched Fast Off

Then
       Set 'Front: Lights' On
       Wait  1 minute 
       Set 'Front: Lights' 35%

Else
  - No Actions - (To add one, press 'Action')

Link to comment

Actually, I was doing some testing on this trigger, and I can't get this program to trigger either. I tried dimming up, dimming down, dimming from full-On, brightening from full-Off... Maybe there's a bug?

 

If
       Control 'Front: Lights' is switched Dim

Then
       Set 'Kitchen: Light' On

Else
  - No Actions - (To add one, press 'Action')

Link to comment
Actually, I was doing some testing on this trigger, and I can't get this program to trigger either. I tried dimming up, dimming down, dimming from full-On, brightening from full-Off... Maybe there's a bug?

 

If
       Control 'Front: Lights' is switched Dim

Then
       Set 'Kitchen: Light' On

Else
  - No Actions - (To add one, press 'Action')

Hi CJ,

 

Instead of switched Dim, try using switched Fade Down.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...