Jump to content
The simFlight Network Forums

An alternate "AutoSave" for FSUIPCv4.xx


spokes2112

Recommended Posts

This lua script was done only as an interesting project in response to this thread, requiring that autosaves not occur during the most critical phase of flight in an advanced aircraft.. The landing.
For FSUIPCv4.xx only.

FSUIPCv5+ already has facilities to toggle off/on its own built in AutoSave. 
A lua script has also been made for FS9/FSUIPCv3.xxx, introducing auto save for this older sim where none was available beforehand in FSUIPC. If there is interest I may finalize the script with more substantial testing and then upload it.   

You may get it here.

Roman

Link to comment
Share on other sites

  • 4 months later...

@ram123,

I updated the lua almost immediately after releasing it. 
I used "WinMerge" to compare your file to the updated version & they are the exact same except for the settings.
You have the updated version.. Good!

I don't know why you are having these problems. Mine has been working fine for months.

One thing I did notice while testing :
If you are watching the folder: My Documents\Flight Simulator X Files while the lua is saving, you may have to use the right click context menu and use refresh to see the changes. Maybe it's just my computer, but Windows doesn't update the file explorer window while this is happening.

Also, as stated in the readme, if you a referring to any special files (.FMC / .ASC for example) saved by the aircraft on a flight save, only the newest will be saved overwriting the previous.
Nothing* can be done about this, it is triggered and handled within the aircraft coding itself.  
*  (Just had an idea on how to handle this, will give it a try over the next few days)

Roman

ex.jpg.68f79118eee288d19ffd329c40dd2bca.jpg

Link to comment
Share on other sites

  • 2 weeks later...

HI,

Got busy with office so, late post!!

Ref below quote,

//

If you are watching the folder: My Documents\Flight Simulator X Files while the lua is saving, you may have to use the right click context menu and use refresh to see the changes. Maybe it's just my computer, but Windows doesn't update the file explorer window while this is happening.

//

I was flying the aerosoft airbus a320 ( don't knw whether it matters or not).

 have attached herewith the snapshots taken at 3 minute interval which shows the previous file is overwritten by the new file. Also attached the setting file for your reference.

Appreciate to hear,

 

Screenshot 2020-10-15 223310.png

Screenshot 2020-10-15 220637.png

Screenshot 2020-10-15 220202.png

LuaAutoSave.lua

Link to comment
Share on other sites

Tested your code unaltered on my system and it works fine for me. 
Hmmm.. 
Either the save path given to the lua is in UNC format ( which i cannot test ) or there is a permissions issue.
Could you use the following lua once to give me the FSUIPC given path?
Simply save the following code and save to whatever name you wish (*.lua), then, assign a temporary keyboard key to run it.
Please take a screenshot of this running lua and attach.

local SavePath = ipc.readSTR(0x1000, 256)
SavePath = string.sub(SavePath, 1, string.match(SavePath, '^.*()\\')) .. "ZZ_Lua_Save_"
ipc.setowndisplay("Lua Autosave TEST", 30, 2, 40, 0)
ipc.display(SavePath, 15)
ipc.sleep(15000)

Your reply will give me a direction on which way to go with this.

Roman 
 

Link to comment
Share on other sites

A good test! 👍
Found the problem. For some reason, on your system, the string that makes up the working path / file name prefix is not concatenating. ( ".." in lua) 
ex.
example.png.2eb0662c3dab74182a9f3c3d25fe59cc.png 

Here's a revised test.
If it gives you a similar output as mine then I will make a revised version. 
If it does not, will still make a revised version, but this time with a manual path entry in the user settings to bypass the automatic path discovery. 👎

local SavePath = tostring(ipc.readSTR(0x1000, 256))
SavePath = string.sub(SavePath, 1, string.match(SavePath, '^.*()\\'))
SavePath = tostring(SavePath .. "ZZ_Lua_Save_")
ipc.setowndisplay("Lua Autosave TEST", 30, 2, 40, 0)
ipc.display(SavePath, 15)
ipc.sleep(15000)

 Roman 
 

Link to comment
Share on other sites

Hi,
   
Here are 2 full versions, attached, for testing.
- Please try the (Auto) version first
- Both are set up with your settings, ready to go
- Perhaps you should set up a keyboard key to restart the lua so you can test both, "on the go"
- The (Manual) version requires the setup path in the user settings. It is also setup for you - easy replacement.

I think what is happening is the use of "\" in the path. In lua this character is a string escape, special.
What I have done, in the (Auto) version is to replace the "\" with "\\" in the path string. 
example2.png.760da14c79347ed1a62d4042cc024976.png
The original (May28th) - Why it works for me & not you has me so confused! 😒

Fingers crossed! 😉
Roman

AutoSave (Auto).zip AutoSave (Manual).zip

Link to comment
Share on other sites

Hi @ram123,

Let's give this one last try.
This new version is based on the premise that the FSUIPC file saving worked fine, your #1 file was always created.
It was my file handling, always having the newest file named #1, then others in order, that was causing all the issues.
The "KISS" principle was applied and all of my file handling was removed.
 
👍If Aerosoft did it correctly then you will have all the matching .FMS files in C:\documents\Aerosoft\Airbus.
👍Much less code! It should have a lesser effect on your sim.
👎No more file handling - 
This means the file name suffix doesn't necessarily mean it is the newest. Files go in order from 0 --> 1 --> 2 --> max # --> 0 etc..
If the saved flight is loaded from the FSX UI then the newest will always be at the top, then, in order of the time saved.
If the flight is loaded from the optional FSUIPC interface then you would have to use windows sorting to find the newest. ( via Date Modified )
👎The command : "Delete ALL auto saved flights" was removed. ( no more file handling ) 

Attached with your settings already applied - again, fingers crossed.

Roman

LuaAutoSave.lua

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.