Home AMX User Forum NetLinx Studio

TIMELINE_EVENT[0]

Greetings,
TIMELINE_EVENT[0]
  {
  nTimelineNumber=TIMELINE.ID
  }
The above doesn't seem to work. Has anyone wildcarded a timeline event successfully?

Thanks.

Comments

  • ericmedleyericmedley Posts: 4,177
    Nope'
    There's been a long time wish for such a thing as well as a timeline array

    TIMELINE_EVENT[my_timelines]

    A timeline stack does work, however

    TIMELINE_EVENT[timeline_1]
    TIMELINE_EVENT[timeline_2]
    TIMELINE_EVENT[timeline_3]
    TIMELINE_EVENT[timeline_4]
    {
    //
    }
  • the8thstthe8thst Posts: 470
    ericmedley wrote: »
    Nope'
    There's been a long time wish for such a thing as well as a timeline array

    TIMELINE_EVENT[my_timelines]

    A timeline stack does work, however

    TIMELINE_EVENT[timeline_1]
    TIMELINE_EVENT[timeline_2]
    TIMELINE_EVENT[timeline_3]
    TIMELINE_EVENT[timeline_4]
    {
    //
    }

    You can follow that stack up with the timeline.ID parameter to figure out which timeline tripped the event too.

    Here is one way I have used a stack of timelines:
    timeline_event[tlVolUP[1]]
    timeline_event[tlVolUP[2]]
    timeline_event[tlVolUP[3]]
    timeline_event[tlVolUP[4]]
    timeline_event[tlVolUP[5]]
    timeline_event[tlVolUP[6]]
    timeline_event[tlVolUP[7]]
    timeline_event[tlVolUP[8]]
    timeline_event[tlVolUP[9]]
    timeline_event[tlVolUP[10]]
    timeline_event[tlVolUP[11]]
    timeline_event[tlVolUP[12]] {
    	stack_var integer index
    	stack_var integer nOutput
    	
    	// tlVolUP is an array of timeline id #s
    	for (index = 1; index <= length_array(tlVolUP); index){
    		if (timeline.id == tlVolUp[index]) {
    			break
    		}
    	}
    	
    	nOutput = metAudioOutputMap[index]
    	
    	if (audSwitcher[nOutput].input) {
    		if (audioAdjustVolume(nOutput, 2)) {
    			send_level metreauKeypads[index], 1, ((audSwitcher[nOutput].volume * 2) + 35)
    		}
    	}
    }
    
  • TurnipTruckTurnipTruck Posts: 1,485
    the8thst wrote: »
    You can follow that stack up with the timeline.ID parameter to figure out which timeline tripped the event too.

    Thanks guys. This is how I have been doing it. I thought the [0] would be a better way. I think I posted the same question a few years ago and got the same answer. Thanks again!
  • a_riot42a_riot42 Posts: 1,624
    the8thst wrote: »
    You can follow that stack up with the timeline.ID parameter to figure out which timeline tripped the event too.

    Here is one way I have used a stack of timelines:
    timeline_event[tlVolUP[1]]
    timeline_event[tlVolUP[2]]
    timeline_event[tlVolUP[3]]
    timeline_event[tlVolUP[4]]
    timeline_event[tlVolUP[5]]
    timeline_event[tlVolUP[6]]
    timeline_event[tlVolUP[7]]
    timeline_event[tlVolUP[8]]
    timeline_event[tlVolUP[9]]
    timeline_event[tlVolUP[10]]
    timeline_event[tlVolUP[11]]
    timeline_event[tlVolUP[12]] 
    {
      stack_var integer index
      stack_var integer nOutput
    	
      // tlVolUP is an array of timeline id #s
      for (index = 1; index <= length_array(tlVolUP); index){
        if (timeline.id == tlVolUp[index]) {
    	break
        }
      }
    	
      nOutput = metAudioOutputMap[index]
    
      if (audSwitcher[nOutput].input) {
        if (audioAdjustVolume(nOutput, 2)) {
          send_level metreauKeypads[index], 1, ((audSwitcher[nOutput].volume * 2) + 35)
        }
      }
    }
    

    What's the point of the for loop? Wouldn't this work just as well?
    timeline_event[tlVolUP[1]]
    timeline_event[tlVolUP[2]]
    timeline_event[tlVolUP[3]]
    timeline_event[tlVolUP[4]]
    timeline_event[tlVolUP[5]]
    timeline_event[tlVolUP[6]]
    timeline_event[tlVolUP[7]]
    timeline_event[tlVolUP[8]]
    timeline_event[tlVolUP[9]]
    timeline_event[tlVolUP[10]]
    timeline_event[tlVolUP[11]]
    timeline_event[tlVolUP[12]]
    {
      stack_var integer index
      stack_var integer nOutput
    	
      nOutput = metAudioOutputMap[timeline.id]
    	
      if (audSwitcher[nOutput].input) {
        if (audioAdjustVolume(nOutput, 2)) {
    	send_level metreauKeypads[timeline.id], 1, ((audSwitcher[nOutput].volume * 2) + 35)
        }
      }
    }
    
  • the8thstthe8thst Posts: 470
    That would not work in this case. The timeline IDs are not 1-12, so the timeline ID is different than the index of the array.

    This was from a piece of code that I originally wrote without the idea of stacking timelines, so I didn't setup the timeline IDs to be an easy sequence for that to work, so the for loop was the quickest way to do it.
  • a_riot42a_riot42 Posts: 1,624
    the8thst wrote: »
    That would not work in this case. The timeline IDs are not 1-12, so the timeline ID is different than the index of the array.

    This was from a piece of code that I originally wrote without the idea of stacking timelines, so I didn't setup the timeline IDs to be an easy sequence for that to work, so the for loop was the quickest way to do it.

    In that case I would create a map similar to the one you are using for the outputs to avoid a for loop in a timeline.
    Paul
Sign In or Register to comment.