spokes2112 Posted May 28, 2020 Report Posted May 28, 2020 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
ram123 Posted September 30, 2020 Report Posted September 30, 2020 Greetings, The above lua script works well except that it saves only 1 files and overwrites the same file for the next save even though the number of auto saves are set to 10. I have attached here the edited script for your reference. LuaAutoSave.lua
spokes2112 Posted September 30, 2020 Author Report Posted September 30, 2020 @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
ram123 Posted October 15, 2020 Report Posted October 15, 2020 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, LuaAutoSave.lua
spokes2112 Posted October 15, 2020 Author Report Posted October 15, 2020 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
ram123 Posted October 23, 2020 Report Posted October 23, 2020 Hi, Many thanks for your prompt reply. Please find attached snapshot. Please note my libraries are moved from the c drive to G drive. This will help maintain sufficient free space in c drive. Await yours,
spokes2112 Posted October 24, 2020 Author Report Posted October 24, 2020 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. 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
ram123 Posted October 24, 2020 Report Posted October 24, 2020 Hi, Please find attached snapshot of the results. Thanks.
spokes2112 Posted October 25, 2020 Author Report Posted October 25, 2020 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. The original (May28th) - Why it works for me & not you has me so confused! 😒 Fingers crossed! 😉 Roman AutoSave (Auto).zip AutoSave (Manual).zip
ram123 Posted October 29, 2020 Report Posted October 29, 2020 Hi, Regret that both dosen't work for me. Any ways, many thanks for spending your valuable time to resolve the issue. appreciate it. thks.
spokes2112 Posted October 30, 2020 Author Report Posted October 30, 2020 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 1
ram123 Posted October 31, 2020 Report Posted October 31, 2020 Hi, Bravo!!! Pls open a bottle of champagne 🍺🥂 All working well!!!! I have attached snapshot for reference. many thanks for spending your valuable time to resolve the issue. Appreciate it. thks.🏆🥇 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now