I would like to dump the map settings that I have found to work well for me from several existing saves, and then create them as presets.
I have tried to write map_gen_settings and map_settings to files and expected something like map_gen_presets.lua However, while I do get a partial output from
Code: Select all
/c game.write_file("map-gen-settings.txt", serpent.block(game.surfaces[1].map_gen_settings))
Attempting similar with map_settings to retrieve the difficulty and enemy settings etc, I simply get:
Code: Select all
{__self = "userdata"}
I then found parse_map_exchange_string(map_exchange_string) which was introduced in 17.50, and would appear to give exactly what I need in the returned MapExchangeStringData
Sadly, I've not been able to get this to work.
Using default settings on a new map and exporting the map string, I have tried this:
Code: Select all
/c game.write_file("my-map-settings.txt", parse_map_exchange_string(>>>eNpjYBBiYGYAgwZ7EOZgSc5PzIHxQJgrOb+gILVIN78oFVmYM 7moNCVVNz8TVXFqXmpupW5SYjGKYo7Movw8dBNYi0vy81BFSopSU 4uRRbhLixLzMktz0fUyMH6/sbyxoUWOAYT/1zMo/P8PwkDWA6BfQ JiBsQGiEigGA6zJOZlpaQwMCo5A7ASSZmRkrBZZ5/6waoo9I0SNn gOU8QEqciAJJuIJY/g54JRSgTFMkMwxBoPPSAyIpSVAK6CqOBwQD IhkC0iSkbH37dYF349dsGP8s/LjJd+kBHtGQ1eRdx+M1tkBJdlB/ mSCE7NmgsBOmFcYYGY+sIdK3bRnPHsGBN7YM7KCdIiACAcLIHHAm 5mBUYAPyFrQAyQUZBhgTrODGSPiwJgGBt9gPnkMY1y2R/cHMCBsQ IbLgYgTIAJsIdxljBCmQ78Do4M8TFYSoQSo34gB2Q0pCB+ehFl7G Ml+NIdgRgSyP9BEVBywRAMXyMIUOPGCGe4aYHheYIfxHOY7MILzE EjVF6AYIzPMkzCjILSAAzMDAgCTxWTGtfUAK4Wh8A==<<<))
Code: Select all
Cannot execute command.Error:(command):1:unexpected symbol near '>'
Has anyone had any success with this command? I would be very grateful for mistakes to be pointed out.