Jump to content

ELSE examples?


gregoryx

Recommended Posts

Posted

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?

Posted

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

Posted
ELSE will run when something in the IF statement is specifically not true.

 

okay... I gotta chew on that for a bit. Effectively, it makes for two cases to run things if I can figure out how to use it right.

 

Thanks!

  • 2 weeks later...
Posted

Edit: I made an incorrect statement and didn't want to confuse anyone, so I'm removing this message (original message show in next post below)

Posted
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

Posted
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')

Posted

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

Posted
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.

Posted
Instead of switched Dim, try using switched Fade Down.

Thanks Darrell, that trigger worked great.

What do the "If control x is switched bright/dim" triggers do?

Guest
This topic is now closed to further replies.

×
×
  • Create New...