[Solved] Questions on on_configuration_changed and migration

Place to get help with not working mods / modding interface.
Schallfalke
Fast Inserter
Fast Inserter
Posts: 162
Joined: Sun Oct 28, 2018 7:57 am
Contact:

[Solved] Questions on on_configuration_changed and migration

Post by Schallfalke »

on_configuration_changed() is supposed to be called when game detects mod version changes, right?

I have a game saved in game version 0.16.51 with my mod version 0.16.1. Now I made an update for 0.17, and try to load in game version 0.17.4. However, on_configuration_changed() is bypassed. on_load() is called directly, causing failure to load values.
So did I do something wrong?
If on_configuration_changed() is not supposed to be called during mod version update, where should I have the code for handling game.* and global.* variables?

Thanks for any help.
Last edited by Schallfalke on Sat Mar 02, 2019 5:52 pm, edited 1 time in total.
eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: Questions on on_configuration_changed and migration

Post by eduran »

https://lua-api.factorio.com/latest/Data-Lifecycle.html

on_configuration_changed happens after on_load.
cskzhi
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Oct 26, 2024 5:19 pm
Contact:

Re: [Solved] Questions on on_configuration_changed and migration

Post by cskzhi »

Sorry I have to dig this out, I see Factorio has new DLC update recently and download the game back. My last saves are 3 years ago on v1.1.32, I found this thread had the similar case like mine; I can't load the old save from 3 years ago on the current Factorio on Steam. Thanks to @eduran on the Docs page for Data Lifecycle , and really hope @Schalifalke can provide the way you solve the error, cuz you marked the thread "Solved" but not providing the solve method. Therefore, to save my old save game with 55 hours playing time, I have to find out myself.

I managed to load the game back on Factorio without having the scenario error popup. I believe it is just a temporary fix for my saves, but to provide here to help further players who may have similar issues like us in this thread.

1. Locate your saves files in C:\Users\yourusername\AppData\Roaming\Factorio\saves, the "AppData" folder is hidden so you need to show hidden files to access
2. Unzip the save files, and locate the file from Factorio error's message, mine is "freeplay.lua" on the method "on_configuration_changed"
3. The only thing I did was to comment out the "on_configuration_changed" block, and zip the folder back to .zip filetype, and Factorio will load the save, but I believe it's still running on v1.1.32 instead of 2.0.11.

Yay, but I can at least open my old save from 3 years ago, not sure how to convert to 2.0.11 but, that is good enough for me.

PS: updated link for Data Lifecycle: https://lua-api.factorio.com/latest/aux ... cycle.html
Last edited by cskzhi on Sat Oct 26, 2024 5:35 pm, edited 1 time in total.
Post Reply

Return to “Modding help”