Script error using when loading save/launching rocket on old save game.

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5267
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Script error using when loading save/launching rocket on old save game.

Post by Klonan »

This can happen when you started the game a very long time ago, or started a game from the map editor after saving it as a scenario.

Unzip the save game, and open the folder:

explorer_2021-01-31_14-58-43.png
explorer_2021-01-31_14-58-43.png (4.67 KiB) Viewed 7990 times

Then delete everything except for the level.dat and script.dat.
NOTE: The level.dat might be split into numbered chunks, e.g level1.dat, level2.dat, level.datmetadata. Don't delete any of them.

explorer_2021-01-31_15-00-11.png
explorer_2021-01-31_15-00-11.png (8.76 KiB) Viewed 7990 times
explorer_2021-01-31_15-00-38.png
explorer_2021-01-31_15-00-38.png (1.31 KiB) Viewed 7990 times

Now copy these 2 files into the save game folder:

control.lua
(118 Bytes) Downloaded 267 times
freeplay.lua
(6.18 KiB) Downloaded 267 times

(These files can also be found in Factorio/Base/Scenarios/Freeplay, if you take them from there be sure to COPY not MOVE)

explorer_2021-01-31_15-01-26.png
explorer_2021-01-31_15-01-26.png (5.24 KiB) Viewed 7990 times

And it should load again.

If that doesn't work post your save game here I and will look at it.
roodammy44
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jan 31, 2021 12:29 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by roodammy44 »

This did not work for me, unfortunately. Here is my original save:
_autosave3.zip
(9.45 MiB) Downloaded 176 times
jocrafter2012
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Mar 21, 2017 4:31 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by jocrafter2012 »

Doesn't work for me either, it can't find the "level.dat", although i have level.dat0 to level.dat32

same level as viewtopic.php?f=7&t=95480
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3015
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by boskid »

level.datX (where X = "metadata" or numbers) is just a level.dat in disguise. Just keep all of those. This save format was introduced recently in 1.1.14 so it had to already load fine in 1.1.14+ and be saved in that new version, that most likely means you do not need any of those fixing steps as save file was already loading fine in one of those recent version.
jocrafter2012
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Mar 21, 2017 4:31 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by jocrafter2012 »

I keept them but it didnt work

The problem is, that I cant launch rockets anymore in that save, although i used to be. Is there maybe a command to "finish" the game?
EDIT:
Clarification, I deleted all files as instructed above, exept for all the level.dat files and the scripts, inserted the designated files and it returned the aforementioned error
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5267
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Klonan »

jocrafter2012 wrote: Mon Feb 01, 2021 11:15 am I keept them but it didnt work

The problem is, that I cant launch rockets anymore in that save, although i used to be. Is there maybe a command to "finish" the game?
EDIT:
Clarification, I deleted all files as instructed above, exept for all the level.dat files and the scripts, inserted the designated files and it returned the aforementioned error
Your specific case is a bug, which I have now fixed for the next release (1.1.20)
roodammy44
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jan 31, 2021 12:29 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by roodammy44 »

Great work! That's some fast dev work!
Stroichik
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Feb 07, 2021 6:25 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Stroichik »

Hello. I have same error with my save. Tried both fixes and they didn't work.

Can u possibly fix my save? 58 play hours...

Edit: I was able to somehow recover a save by using map editor and converting a save into a scenario. So i kinda saved factory.
And somehow today my saves just was able to load without errors. Dunno why. But somehow it all works now, i think there was a patch today too.
Attachments
_autosave3.zip
(27.23 MiB) Downloaded 152 times
wievo
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Feb 20, 2021 11:17 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by wievo »

Did not work for me either. The new save does not even display that it is the incorrect version, loading itself is not possible.
Attachments
_autosave3.zip
(23.9 MiB) Downloaded 142 times
User avatar
rubafix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Nov 16, 2016 8:24 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by rubafix »

hello

i have some questions

is it working without delete files level.dat and script.dat. ?
my files is diffentes is a probleme ?
Image

can i post a script to update all save files ?
is it possible to make a script to command factorio open/update/close save files ?

thx for your time
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5267
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Klonan »

rubafix wrote: Sun Feb 21, 2021 9:08 am hello

i have some questions

is it working without delete files level.dat and script.dat. ?
my files is diffentes is a probleme ?
Image

can i post a script to update all save files ?
is it possible to make a script to command factorio open/update/close save files ?

thx for your time
What specific error do you have?
User avatar
rubafix
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Nov 16, 2016 8:24 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by rubafix »

no specific error
script to update all save

Code: Select all

@echo off
cd /d %~dp0
set sevenzip=
set factorio=C:\Users\%USERNAME%\AppData\Roaming\Factorio\saves
set source=c:\Program Files (x86)\Steam\steamapps\common\Factorio\data\base\scenarios\freeplay

rem copy files to factorio saves folders
copy %source%\control.lua %factorio%
copy %source%\freeplay.lua %factorio%
cd /d %factorio%

rem 7z.exe path
if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exe
if "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exe
if "%sevenzip%"=="" echo 7-zip not found&pause&exit

rem make folder zip name
FOR %%i IN (*.zip) DO mkdir "%%~ni"

rem copy lua in folders
for /r "%factorio%" %%i in (.) do @copy "control.lua" "%%i"
for /r "%factorio%" %%i in (.) do @copy "freeplay.lua" "%%i"

rem add folder to zip
FOR /r %%i IN (*.zip) DO "%sevenzip%" a "%%~ni.zip" "%%~ni\control.lua" > nul
FOR /r %%i IN (*.zip) DO "%sevenzip%" a "%%~ni.zip" "%%~ni\freeplay.lua" > nul

rem remove all temp folders
for /f "tokens=*" %%i in ('dir /b /s /a:d "%~1"') do rd /S /Q "%%~i"
del freeplay.lua
del control.lua
exit
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5267
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Klonan »

rubafix wrote: Mon Feb 22, 2021 11:05 am no specific error
If theres no error then you don't need to do anything
cool_balrog00
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 10, 2021 2:45 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by cool_balrog00 »

Hello! I've been struggling with this for a while now. My save has many level.dat files but no one file named "level.dat" without a number affixed to the end.
Capture.PNG
Capture.PNG (3.84 KiB) Viewed 5817 times
I just loaded the backup and it still runs (but will crash if I click on the rocket silo GUI at the top left or if I launch a rocket). After applying the fix I receive an error looking for "level.dat" (I triple-checked that I didn't delete it by mistake, and did not LOL) and it won't load or allow me to convert to a scenario.
screen.PNG
screen.PNG (9.46 KiB) Viewed 5817 times
I've attached a copy of my save after following the steps above. Would you mind taking a look? (I have many many hours on this one and would hate to lose it).

I have the backup I made as well if you need me to upload that. Any help would be much appreciated! Thank you!
Attachments
Industrial Punk 2.zip
(21.52 MiB) Downloaded 132 times
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 411
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Stringweasel »

cool_balrog00 wrote: Fri Dec 10, 2021 3:01 pm Hello! I've been struggling with this for a while now. My save has many level.dat files but no one file named "level.dat" without a number affixed to the end.

Capture.PNG

I just loaded the backup and it still runs (but will crash if I click on the rocket silo GUI at the top left or if I launch a rocket). After applying the fix I receive an error looking for "level.dat" (I triple-checked that I didn't delete it by mistake, and did not LOL) and it won't load or allow me to convert to a scenario.

screen.PNG

I've attached a copy of my save after following the steps above. Would you mind taking a look? (I have many many hours on this one and would hate to lose it).

I have the backup I made as well if you need me to upload that. Any help would be much appreciated! Thank you!
A while ago the devs change how saving works. Newer versions of Factorio saves multiple `level.datX` files, instead of only one `level.dat`, so there's nothing missing :)

Are you running the newest version of Factorio? I've had it before complain about not finding `level.dat`, but that was because I was trying to load a newer save on an older version of Factorio.
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
cool_balrog00
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 10, 2021 2:45 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by cool_balrog00 »

Thanks for de-mystifying my many files LOL! I'm running the current version of Factorio. Just downloaded the latest version this morning.
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 531
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Silari »

cool_balrog00 wrote: Fri Dec 10, 2021 4:48 pm Thanks for de-mystifying my many files LOL! I'm running the current version of Factorio. Just downloaded the latest version this morning.
The one you uploaded has a second nested directory inside the zip - there should only be one. It's still missing files though when that's fixed. Upload your backup copy that still loads.
cool_balrog00
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 10, 2021 2:45 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by cool_balrog00 »

Attached is the original save file that still runs. Thanks for looking!
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 531
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Script error using when loading save/launching rocket on old save game.

Post by Silari »

cool_balrog00 wrote: Sat Dec 11, 2021 1:18 am Attached is the original save file that still runs. Thanks for looking!
Nothing attached there. Make sure you give it time to upload and double check after posting.
Post Reply

Return to “Technical Help”