Timelines
davidv
Posts: 90
I want to make a timeline that will call a Function every 60 minutes. I'm not sure where to put the data. Can anyone help me?
0
Comments
Once you've got your Timeline running it fires the Timeline_Event[TimelineName] event - which is where you'd want your function to go.
Hope this helps.
Yes I did.
However this will not be acutated by a button push.
I want this timeline running at startup and every 60minutes I want to perform my Define_Function.
Then I want my timeline to start over again and repeat.
This is what I have so far.
DEFINE_VARIABLE
LONG TimeArray[100]
DEFINE_CONSTANT
TL1 = 1
DEFINE_EVENT
TIMELINE_EVENT[TL1] // capture all events for Timeline 1
{
fnGetRSS
}
DEFINE_PROGRAM
{
TimeArray[1] = 6000
TIMELINE_CREATE(TL1, TimeArray, 1, TIMELINE_ABSOLUTE,TIMELINE_REPEAT)
}
IF(TIMELINE_ACTIVE(TL1))
{
Do some stuff
}
Then create a timeline_event[timeline_id]{ doMyFunction()};
That should do it.
Jeff
I'm not sure why you are using the If(timeline_active(tl1)) section. It sounds like you want the timeline constantly running, so the code in this section will always run. You could save some processor time by just putting the chunk of code directly in the mainline (DEFINE_PROGRAM section). If you want to make sure the timeline is constantly running, you could add a if(!timeline_active(TL1)){ timeline_create(); } chunk of code, but unless you stop the timeline, I don't see that being an issue (altho I am not quite sure what happens when the number of iterations exceeds the capacity of the variable holding the number, but I think it would just wrap back to 0 or 1).
Jeff
LONG TimeArray[3600000]
Define_Constant
TL1 = 1
DEFINE_EVENT
TIMELINE_EVENT[TL1]
{
fnGetRSS() // This is my define_function call //
}
Define_Start
TIMELINE_CREATE(TL1, TimeArray, 1, TIMELINE_RELATIVE,TIMELINE_REPEAT)
The number inside the [ ] tells netlinx how many elements are in the array. The way you had it written, I think the compiler would have yelled at you... if not, you would have chewed up a bunch of memory that won't be used (you are only using the first value in the array).
Even tho you are only using 1 slot in the array, the variable still needs to be declared as an array or the compiler will complain.
Jeff