Home AMX Forum NetLinx Studio
Options

Compare Timeline_Actives?

Is it possible to compare multiple timelines for an IF statement? I have two timelines, one for turning a rear projection CRT on, and another for turning it off. Like many projectors, it will not respond to commands while in its warm-up or cool-down states. I am doing nested IF statements like this:
BUTTON_EVENT[dcTvCmds] //tv inputs, power

{                     
	PUSH:
	{
		IF (!TIMELINE_ACTIVE(tl_TVWarmUp)) 
		{
			IF (!TIMELINE_ACTIVE(tl_TVShutDown))
			{
			SWITCH (get_last(dcTvCmds))
				{
				CASE 1: SEND_STRING dvTV, ""
                             
However, I don't think that will work every time. Is there a way for me to reference the status of both timelines on a single line? Like with an AND or an &&? Something like:
IF (!TIMELINE_ACTIVE(tl_TvWarmUp)) && (!TIMELINE_ACTIVE(tl_TvShutDown))

Comments

  • truetrue Junior Member
    if (!(timeline_active(timeline_1) || timeline_active(timeline_2))) {
        // do stuff if both timelines are inactive
    }
    
  • vegastechvegastech Junior Member
    I guess I should have worded the post a little differently. I need to make sure that neither timeline is active, and then the commands can be sent, so I ended up doing an &&, which accomplished what I was looking for. Thanks Tru for the correct coding structure!
  • PhreaKPhreaK Senior Member
    I think true's method is actually what you may be after. Using an and in that statement will allow the code to trigger if one of them is active (note the parenthesis and the not operator).
  • DHawthorneDHawthorne Junior Member
    PhreaK wrote: »
    I think true's method is actually what you may be after. Using an and in that statement will allow the code to trigger if one of them is active (note the parenthesis and the not operator).

    Nope, the && is what he wants. The ! operator takes precedence and "sticks" to the timeline_active function. The II will fire if either is inactive, and he only wants it if both are.
  • truetrue Junior Member
    DHawthorne wrote: »
    Nope, the && is what he wants. The ! operator takes precedence and "sticks" to the timeline_active function. The II will fire if either is inactive, and he only wants it if both are.

    !(T || T) = F
    !(T || F) = F
    !(F || T) = F
    !(F || F) = T

    Look at the parenthesis location. You can also do it like vegastech was questioning (although there is a syntax error with that code), I was just trying to do it a different way.
  • Jorde_VJorde_V UX Scientist
    @DHawthorne, if you look more closely at true's method you'll see his works as well. Though admitting I had to look twice.
  • DHawthorneDHawthorne Junior Member
    Yep, I see it now too. Point conceded.
Sign In or Register to comment.