Changing external variables change back when i restart terminal

 

Hi. I am trying to change the external bool value from true to false,but every time i restart the terminal it changes back to true.Is there a way to do it?

extern bool reset = true;


void OnTick()

  {

 
  if (reset==true)
{  
 int handle = FileOpen("Time.txt",FILE_COMMON|FILE_WRITE); 
   FileWrite(handle, TimeToStr(TimeCurrent()) );
   FileClose( handle ); 
   reset=false;
 }

   
   }
 
Γιάννης Χριστόπουλος:

Hi. I am trying to change the external bool value from true to false,but every time i restart the terminal it changes back to true.Is there a way to do it?

(1) When the application exits, the value of "reset" is saved.

(2) At the next startup, the saved value is read and the value of "reset" is changed.

int OnInit()
{
   if (GlobalVariableCheck("KeepReset"))
   {
      reset = (bool)GlobalVariableGet("KeepReset");
   }
   else
   {
      GlobalVariableSet("KeepReset", (double)reset);
   }

   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
   GlobalVariableSet("KeepReset", (double)reset);
}
 
Nagisa Unada:

(1) When the application exits, the value of "reset" is saved.

(2) At the next startup, the saved value is read and the value of "reset" is changed.

Thank you very much Nagisa
Reason: