Making variable EventSetTimer function?

 

Hi! I'm trying to build my first EA.

Is there anyone who knows how to build the variable EventSetTimer function?

As  you know, EvenSetTimer() is usually called in init() with fixed int variable, like EventSetTimer(60);..

But I'd like to make the 60sec to variable one by using another variable. So I tried like below... 

 

int Timer; 

on  OnInit()

   {

         Timer = 1;

         EventSetTimer(Timer);

              ................

    } 

 void OnTimer()

    {

    ....

    Timer = 30;

     ....

     } 

 

How could I solve this issue? Thank you in advance for your comments. 

 

You need to call EventSetTimer() again.

Each time you want to change timer interval you should call EventSetTimer() with new interval.

 
drazen64:

You need to call EventSetTimer() again.

Each time you want to change timer interval you should call EventSetTimer() with new interval.

Genius! I called EventSetTimer in onTimer function again, and it solved problem very easily.

Thank you very much!! 

Reason: