Page 1 of 1

[1.101] frequent crashing ending log with mod "AutoDeconstruct control.lua"

Posted: Wed Jan 10, 2024 11:08 am
by smasher77777
Factorio 1.101 (steam verified files) started randomly crashing/closing frequently. So If you load my save file [with the mods] it should or can produce the factorio-current.log during loading the save file. The crashes are so randomly that it can happen also after saving a save file or etc.
The logs always seem to end with:
576.654 Checksum for script __AutoDeconstruct__/control.lua: 1402689405
The mod Editor Extensions is also spamming in the log:
Verbose PrototypeMigrationList.cpp:338: "ee-debug-world-start-in-editor" mentioned as TO in prototype migration was not found in the map prototype dictionary, ignoring ...

Re: [1.101] frequent crashing ending log with mod "AutoDeconstruct control.lua"

Posted: Wed Jan 10, 2024 11:36 am
by Loewchen
393.780 Error MainLoop.cpp:1391: Exception at tick 7404444: Die Mod Biter sabotage (0.1.0) hat einen Fehler verursacht, der nicht behoben werden kann.
Bitte informiere den Autor der Mod über diesen Fehler.

Error while running event biter-sabotage::on_built_entity (ID 6)
__biter-sabotage__/control.lua:7: bad argument #2 of 3 to 'print' (table expected, got string)
stack traceback:
[C]: in function 'print'
__biter-sabotage__/control.lua:7: in function <__biter-sabotage__/control.lua:3>
Tell the mod author.

Re: [1.101] frequent crashing ending log with mod "AutoDeconstruct control.lua"

Posted: Wed Jan 10, 2024 1:14 pm
by smasher77777
I am the mod author and I can tell you that that specifically unrecoverable error was because of me trying to get the print function to work with a string "" and a variable. Lua in VSC recommended me to separate them with commas but that caused that bad argument error so that error in particular had nothing to do with the issues I was experiencing. These crashes had no log trace print to them. That is the Problem. If it would have been a normal exit the logs would end with Good Bye. They do not.

Re: [1.101] frequent crashing ending log with mod "AutoDeconstruct control.lua"

Posted: Wed Jan 10, 2024 1:43 pm
by Pi-C
This is the crashing line:

Code: Select all

player.print("You built "event.created_entity.name)
This should work:

Code: Select all

player.print("You built "..event.created_entity.name)
The '..' is the operator for concatenating strings. Alternatively, you could use this:

Code: Select all

player.print( {"", "You built ", event.created_entity.name} )
Using a table is similar to using localised text, where you give a table containing a template (in this case: the empty string "") and optional additional arguments (in this case: "You built " and event.created_entity.name). As an empty template is used here, all the optional arguments will be concatenated unless they are nil.

Note: Your string is not a localised string because "You built " will be output no matter what language the player is using. You could add a template for this message by adding something like this to your locale file:

Code: Select all

[my-messages]
built=You built __1__
Then change the print line to

Code: Select all

player.print( {"my-messages.built", event.created_entity.name} )
Once you've restarted the game (so it will know about the new strings), this string will be translated to the player's language if "my-messages.built" has been added to that language's locale file; if it hasn't been translated to that language yet, the English version will be used as fallback.

For more detailed information on localization, there's a tutorial you should check out.