Home AMX Forum AMX General Discussion
Options

Question of timelines

Ok, I've tried it a few times and have discovered that I cannot get timelines to work if I use an array variable in their declaration. I was hoping for an explanation of why.

An example:

The following will not work:
Define_Variable (*Or Sometimes Define_Constant, neither works*)

long Proj_Warm_TL[3]  =  {11,12,13}

long Proj_Warm_Times= {60000}

Define_Variable (*Always*)

integer  nProj_Sel

integer Proj_On_Butt[] = {101,103,105}  //Just for the sake of argument

integer nProj_Pwr[3]
integer nProj_Warm[3]

//Fictitious Define_Subroutine Here designation

Define_Call 'Projector On' (integer TWhich_Proj) //VERY Simplified for this exercise
{
   If (! nProj_Pwr[TWhich_Proj] )
   {
      on[nProj_Warm[TWhich_Proj]]
      timeline_create (Proj_Warm_TL[TWhich_Proj], Proj_Warm_Times, 1, timeline_relative, timeline_once)
   }
}

Define_Event

Button_Event [tp,Proj_On_Butt] (*I KNOW I didn't define a TP here....  ASSUME it's a Touch panel that has been defined *)
{
   Push:
   {
      nProj_Sel = Get_last (Proj_on_Butt)
      Call 'Projector On' (nProj_Sel)
   }
}

timeline_event [Proj_Warm_TL[1] (*Or even as 11*) ]
{
   Off [nProj_Warm[1]]
   On [nProj_Pwr[1]]
}
timeline_event [Proj_Warm_TL[2] (*Or even as 12*) ]
{
   Off [nProj_Warm[2]]
   On [nProj_Pwr[2]]
}
timeline_event [Proj_Warm_TL[3] (*Or even as 13*) ]
{
   Off [nProj_Warm[3]]
   On [nProj_Pwr[3]]
}


BUT! This works just Dandy!:
Define_Variable (*Or Sometimes Define_Constant you get it*)

long Proj_Warm_TL1  =  11
long Proj_Warm_TL2  =  12
long Proj_Warm_TL3  =  13

long Proj_Warm_Times= {60000}

Define_Variable (*Always*)

integer  nProj_Sel

integer Proj_On_Butt[] = {101,103,105}  //Just for the sake of argument

integer nProj_Pwr[3]
integer nProj_Warm[3]

//Fictitious Define_Subroutine Here designation

Define_Call 'Projector On' (integer TWhich_Proj) //VERY Simplified for this exercise
{
   If (! nProj_Pwr[TWhich_Proj] )
   {
      on[nProj_Warm[TWhich_Proj]]
      timeline_create ((10+TWhich_Proj), Proj_Warm_Times, 1, timeline_relative, timeline_once)
   }
}

Define_Event

Button_Event [tp,Proj_On_Butt] (*I KNOW I didn't define a TP here....  ASSUME it's a Touch panel that has been defined *)
{
   Push:
   {
      nProj_Sel = Get_last (Proj_on_Butt)
      Call 'Projector On' (nProj_Sel)
   }
}

timeline_event [Proj_Warm_TL1 ]
{
   Off [nProj_Warm[1]]
   On [nProj_Pwr[1]]
}
timeline_event [Proj_Warm_TL2 ]
{
   Off [nProj_Warm[2]]
   On [nProj_Pwr[2]]
}
timeline_event [Proj_Warm_TL3 ]
{
   Off [nProj_Warm[3]]
   On [nProj_Pwr[3]]
}

Ok... Why?

Ignoring all the possible silly typos and stylistic jibber-jabber(I really need a Mr. T emoticon here!!), I don't see why this shouldn't work.

Isn't the value of TL[1] in the first exercise = 11? As a LONG Constant, the same TL1 (or 10+TWhich_Proj) in the second example?

The first example ALWAYS bogs the rest of the code following to a stop..... No more feedback and mostly poor performance. The controller though gives no indication of any problem in diagnostics or telnet messages.

I was just curious for enlightenment purposes.

Thanks in advance for the information.

Comments

Sign In or Register to comment.