How to know the timer value when the EventSetTimer is ON?
#define TIMER_VALUE 10 void OnInit() { EventSetTimer(TIMER_VALUE); } void OnTimer() { Print("TIMER_VALUE: ",TIMER_VALUE); // Print the current value of the timer. }
int global_timer_value = 10; void OnInit() { EventSetTimer(global_timer_value); } void OnTimer() { Print("TIMER_VALUE: ",global_timer_value); // Print the current value of the timer. }
I hope this can help you.
Edwin Hernando Artunduaga Quiñonez:
I hope this can help you.
Thank you for the reply. But this is not my query. I know that I can do this with Global Variables. But I wanted to know the Timer event count. I want to know how I can get the Timer event timer count. It is hard to explain I guess. But I hope you have understood this.
You mean you want to know the number of calls to your event handler? You can do this with a static counter.
long count=0; void OnInit() { EventSetTimer(10); count=0; } void OnTimer() { // Print the current value of the timer. Print("Timer: "+(string)count); count++; }
Its a timer it measures intervals, it's not a counter.
As one can see I have applied the Timer and want to know the value of the timer in the OnTimer(). Say if it is 1 then print one or 2 when it is 2.
Please let me know what I can do?