Home AMX User Forum AMX Technical Discussion

How to Create many instances of a Timeline

johnbonz1johnbonz1 Posts: 26
edited October 2022 in AMX Technical Discussion

In my previous posts I created a Stop watch/Countdown timer. I want to create multiple instances of the timelines required to run the stopwatch/countdown. So if I am on panel 1 and I want to create a countdown for 1 minute, and then wife is using another panel, 2, and she wants to have a countdown to boil eggs for 10 minutes.
So I am using 8400 - panel 1 and she is using a 8400 panel 2, so I dont think u can create a Array of Timelines in Netlinx.
so you would think you can do this:

TIMELINE_EVENT[TL_StopWatch[nPNL] // capture all events for Timeline TL_StopWatch
but instead I have to create a Timeline for every panel like this:

Panel 1 Timeline:

TIMELINE_EVENT[TL_StopWatch_1] // capture all events for Timeline TL_StopWatch_1


Panel 2 TimeLine:

TIMELINE_EVENT[TL_StopWatch_2] // capture all events for Timeline TL_StopWatch_2
and so on. If I have 50 panels I would need to create 50 seperate Timlines for each panel. This doesnt seems right as I should be able to create an Array of timelines based on the panel but one entry in the timeline section.

Anyone ever run into this?


  • Stack the TIMELINE_EVENTS and then use the timeline.id event data member to map back to the timeline you care about

    (*               CONSTANT DEFINITIONS GO BELOW             *)
        long TL_1 = 1001;
        long TL_2 = 1002;
        long TL_3 = 1003;
        long TL[] = {TL_1, TL_2, TL_3};
        long TL_TIME[] = {1000};
    define_function integer getLongArrayIndex(long item, long array[]) {
        stack_var integer i;
        for(i = length_array(array); i; i--) {
        if(item == array[i]) {
        return i;
    (*                 STARTUP CODE GOES BELOW                 *)
        timeline_create(TL[1], TL_TIME, length_array(TL_TIME), TIMELINE_ABSOLUTE, TIMELINE_REPEAT);
        timeline_create(TL[2], TL_TIME, length_array(TL_TIME), TIMELINE_ABSOLUTE, TIMELINE_REPEAT);
        timeline_create(TL[3], TL_TIME, length_array(TL_TIME), TIMELINE_ABSOLUTE, TIMELINE_REPEAT);
    (*                  THE EVENTS GO BELOW                    *)
    timeline_event[TL_3] {
        amx_log(AMX_ERROR,format('timeline_event[TL[%d]]',getLongArrayIndex(timeline.id, TL)));
Sign In or Register to comment.