Jump to content
C4 Forums | Control4

Programing conditionals not working as expected


Recommended Posts


You have to "nest" the commands under the conditional. Drag the one you want on top of the conditional so it applies. If the command indents under the conditional, it will work fine. Everything under the time conditional. You don't really need "stop" as there are not any additional commands after your condition.

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

Don't use delays in the span of minutes please - it can cause major overall system delays.

Instead, create a 5 minute timer, and start the timer instead - then on the timer expiring, turn the light back off.

 

Other than that, yes, anything dependent on the if statement needs to be 'indented'.

Link to comment
Share on other sites

6 hours ago, ramesh.khiani said:

Cyknight is right; create a 5 minute timer instead of delay and command indents under the condition.

sol.png

but use a timer as Cy said vs a delay.  Delay introduces system lag.  Timers are the correct way to do what you want.

Link to comment
Share on other sites

LONG delays aren't good - because they are DELAYS.

See delay as a 'stop what you're doing and wait there five minutes until I say go' command.

Where a timers is 'stop what you're doing and come back in 5 minutes' command

Using 5 minute delay will hold up the system for 5 minutes, whereas a timer does not.

Frankly personally for anything more than a second - I use a timer, but especially if you're looking at minutes.

Link to comment
Share on other sites

Composer Programming Delays are not implemented poorly.

They do not cause Director to stop doing what it's doing for X seconds, and shouldn't cause any system latency.

From what I've seen, they are implemented internally very similar to timers.

The main reason you might want to use timers instead of delays is that they're more flexible.  When you use a delay in a script, it will delay running the rest of the script, and if that script gets triggered multiple times, delays can cause things to work differently than you might expect, where if you'd used a timer, it's more straightforward (i.e. the 'rest of the story' would only get executed once, when the timer expires).

RyanE

 

Link to comment
Share on other sites

Now, if you were writing a DriverWorks driver, and you inserted delays (busy waiting by looping, etc.) in a *driver*, that's a completely different story, which *would definitely* cause system latency.  Drivers must be event driven, and return control to Director fairly quickly.

RyanE

 

Link to comment
Share on other sites

17 minutes ago, RyanE said:

Composer Programming Delays are not implemented poorly..

The main reason you might want to use timers instead of delays is that they're more flexible.  When you use a delay in a script, it will delay running the rest of the script, and if that script gets triggered multiple times, delays can cause things to work differently than you might expect, where if you'd used a timer, it's more straightforward (i.e. the 'rest of the story' would only get executed once, when the timer expires).

RyanE

 

First off - I wasn't suggesting they were implemented poorly.

Second - my example was heavily simplified.

Third - yeah, the idea of what I intended to say is indeed that it 'holds' the individual script 'hostage' - not the system as a whole.

Fourth - while delays do not cause a true 'lag' on a system overall, it's not that hard to create conflicts where delays build creating a perceived delay or other weird behavior (where in actuality it's just following script). Triggering (and re-triggering) a timer won't cause this.

 

Example:

WHEN door bell is pressed

turn light on

delay 1 second

play announcement

delay 5 minutes

turn light off

 

Now have someone push that doorbell 15 times in a row. (Durn kids)

Now add a schedule to have the light on at an hour before dusk

Add some motion events to that same lights.

Now imagine that doorbell being pressed a few minutes before the scheduled time, and the kids playing in the front yard.

 

I think you can see where you'll get a lot of odd behavior of the light turning on and off.

Link to comment
Share on other sites

  • 2 years later...
On 7/15/2016 at 12:17 AM, Cyknight said:

Don't use delays in the span of minutes please - it can cause major overall system delays.

Instead, create a 5 minute timer, and start the timer instead - then on the timer expiring, turn the light back off.

 

Other than that, yes, anything dependent on the if statement needs to be 'indented'.

Are you able to provide an example screenshot of how I can create a timer.  thank you!

Link to comment
Share on other sites

6 hours ago, vvtech said:

Can someone provide an example screenshot of how to create a timer.  Thanks.

The timer is an Agent.  "Timer Agent".  Create one there and set the duration.   It can be used for all sorts of reasons.  Typically you start the timer when an event happens.  When the timer expires, program the desired action.  There's other events that can be programmed off of.

What's the application?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.