Home AMX User Forum NetLinx Studio

Timeline Questions

Quick question on timelines...is the following code legal and will work?
DEFINE_CONSTANT //Timeline Constants

TL_SOURCE_SELECT[]= {1,2,3}

//snip

button_event [vdvTPSwitcher, nSwitcherOutputs]
{
    push:
    {
	stack_var integer nOutput
	stack_var integer nButton
	stack_var integer nTP
	stack_var dev	dvTP

	nOutput = get_last(nSwitcherOutputs)
	nButton = button.input.channel
	nTP = get_last(vdvTPSwitcher)
	dvTP= button.input.device

	if(timeline_active(TL_SOURCE_SELECT[nTP]))
	    timeline_kill(TL_SOURCE_SELECT[nTP])
	if(iSelectedInput > 0)
	{
	    if(length_string(CSelectedOutput) = 0)
		CSelectedOutput = "itoa(nSwtOutputMap[nOutput])"
	    else
		CSelectedOutput = "CSelectedOutput,itoa(nSwtOutputMap[nOutput])"

	    on[dvTP,nButton]
	}
	else
	{
	    SourceFeedback(nSwtOutputMap[nOutput],dvtp)
	    on[dvTP,nButton]
	}

	timeline_create(TL_SOURCE_SELECT[nTP],TL_OUTPUT_TIMES,1,TIMELINE_ABSOLUTE,TIMELINE_ONCE)
    }
}

DEFINE_EVENT //Timeline Events
timeline_event[TL_SOURCE_SELECT]
{

    //do something

}

It didn't seem to work in testing, and I was curious if it is even legal to do it this way.

Comments

  • ericmedleyericmedley Posts: 4,177
    Quick question on timelines...is the following code legal and will work?
    DEFINE_CONSTANT //Timeline Constants
    
    TL_SOURCE_SELECT[]= {1,2,3}
    
    //snip
    
    button_event [vdvTPSwitcher, nSwitcherOutputs]
    {
        push:
        {
    	stack_var integer nOutput
    	stack_var integer nButton
    	stack_var integer nTP
    	stack_var dev	dvTP
    
    	nOutput = get_last(nSwitcherOutputs)
    	nButton = button.input.channel
    	nTP = get_last(vdvTPSwitcher)
    	dvTP= button.input.device
    
    	if(timeline_active(TL_SOURCE_SELECT[nTP]))
    	    timeline_kill(TL_SOURCE_SELECT[nTP])
    	if(iSelectedInput > 0)
    	{
    	    if(length_string(CSelectedOutput) = 0)
    		CSelectedOutput = "itoa(nSwtOutputMap[nOutput])"
    	    else
    		CSelectedOutput = "CSelectedOutput,itoa(nSwtOutputMap[nOutput])"
    
    	    on[dvTP,nButton]
    	}
    	else
    	{
    	    SourceFeedback(nSwtOutputMap[nOutput],dvtp)
    	    on[dvTP,nButton]
    	}
    
    	timeline_create(TL_SOURCE_SELECT[nTP],TL_OUTPUT_TIMES,1,TIMELINE_ABSOLUTE,TIMELINE_ONCE)
        }
    }
    
    DEFINE_EVENT //Timeline Events
    timeline_event[TL_SOURCE_SELECT]
    {
    
        //do something
    
    }
    

    It didn't seem to work in testing, and I was curious if it is even legal to do it this way.

    I don't beleive you can use an array to address Timelines. (at least not right now. It's been discussed, and cussed...)

    You'll have to stack them instead.

    so,
    DEFINE_CONTSTANT
    
    TL_01=1001
    TL_02=1002
    TL_03=1003
    
    
    DEFINE_EVENT
    
    
    TIMELINE_EVENT[TL_01]
    TIMELINE_EVENT[TL_02]
    TIMELINE_EVENT[TL_03]
    {
    stack_var TL_ID
    TL_ID=timeline.id
    switch(timeline.sequence)
      {
      case 1: // first time event
        {
        // do something
        }
      }
    }
    
    // etc...
    
    
  • It has been my experience that a timeline value/id must be resolvable at compile time. Using an array won't work.
  • Ok, thanks for that. I'll modify the code.
Sign In or Register to comment.