API Question call for saving a scenario

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
115
Points
78
Hi guys,

I'm trying to do a simple thing with my new module, but I can't do it in the "optimal" way, at least I think.

I want to save the scenario to a desired file of mine everytime the scenario is saved by orbiter.

So basically when I close the simulation and when I press CTRL+S. I can do it manually by putting the call of oapiSaveScenario(...) into clbkVisualDestroyed (it works only there, no way of having a saved scenario in clbkSimulationEnd) and by calling it also in clbkConsumeBufferedKey with ctrl+s, but is there a way to simply tell orbiter api to save scenario to default scn file AND to my file everytime a saving is performed?

thanks guys! :tiphat:
 
It seems to me that you should be able to write a function that saves the file you want and then call it in your module's clbkSaveState.
 
It seems to me that you should be able to write a function that saves the file you want and then call it in your module's clbkSaveState.

Thanks, I did it, but this starts a loop: when callbacksavestate is called, it finds inside itself a savescenario call,which calls callbacksavestate,which calls savescenario..... and so on
 
Thanks, I did it, but this starts a loop: when callbacksavestate is called, it finds inside itself a savescenario call,which calls callbacksavestate,which calls savescenario..... and so on

Pseudocode:

Code:
int inSave = 0;

void clbkSaveState() {
    if ( inSave == 0 ) {
        inSave = 1;
        oapiSaveScenario();
        inSave = 0;
    }
}
 
it seems to work, thank you kamaz!

I've been trying to use only standard calls for oapi so much that I'm almost forgetting how to play around with vars and functions sometimes... :facepalm:
 
The other issue is that clbkSaveState isn't actually documented in the API's.
 
Back
Top