Author Topic: Flushing saved variables  (Read 4206 times)

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Flushing saved variables
« on: November 11, 2016, 03:20:14 AM »
So this is kind of a question rather than an issue but could be an issue lol.

When you save a variable to your profile, does it get written immediately or when va closes? The reason I'm asking is that I'm relying on some quite important variables to set states and when va crashes (god forbid lol) those variables switch back to the state they were when va was started up. Which seems to indicate that saving a variable isn't flushed out to the drive until va is shutdown properly. Now obviously it could be whatever caused the crash doing this but I just wanted to know basically how reliable those variable states were when saved to the profile?
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Flushing saved variables
« Reply #1 on: November 11, 2016, 09:13:05 AM »
My testing does seem to indicate saving of variables only occurs either when the profile is edited(even without changes), or the application shuts down gracefully.

I've actually been meaning to ask, is there a way to have VoiceAttack shut itself down gracefully using an action(not a keypress)?

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Flushing saved variables
« Reply #2 on: November 11, 2016, 11:25:46 AM »
so if I swear at one of my voicepacks they would quite rightly quit immediately and never speak to me again?
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: Flushing saved variables
« Reply #3 on: November 12, 2016, 10:05:58 PM »
The values are saved with the profile and are only persisted when the profile is saved (or if the application exits and the variables have not been persisted).  They might even save if you change profiles, but I'd need to either test that or code dive to confirm.  Persisting a variable EVERY time it is set to a new value might cause problems (overhead of checking whether or not a variable needs to be persisted, persisting the value in an asynchronous environment and so on) so I narrowed it down to very specific points.  If you need a finer level of control, you will want to build a plugin.  Sorry about that!

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Flushing saved variables
« Reply #4 on: November 14, 2016, 11:12:17 AM »
nope don't be sorry Gary, you know what you're doing :)

As long as I know exactly whats going on then I can work with it. Maybe I could force a profile switch and back again to flush it through. I shall think about that one and try not to be so reliant on those variables getting messed up.
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.