[ 1.1 ] How do I see information before the whole game loads?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
yaim904
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

[ 1.1 ] How do I see information before the whole game loads?

Post by yaim904 »

Context
When the game is loading, some errors usually appear, however, the message that is displayed does not usually give me all the information I need.
I want
So I want to know how I do to:
Personalize the message.
Write to file.
Motrar another message.
Any of the above works for me.
Clarification
I know this code exists game.write_file, but it runs once the whole game is loaded.

And I already tried with this code

Code: Select all

-- __FUNCTION__.FileWrite( Data, Name )
-- __FUNCTION__.FileWrite( Data, Name, Mode )

function __FUNCTION__.FileWrite( _data, _name, _mode )
    -- valdación básica
    if isNil( _data ) then return false end

    -- Validar parametros
    _name = _name or __FUNCTION__.getDate( ) ".lua"
    _mode = _mode or "r+"

    local types = { "r", "w", "a", "r+", "r+", "w+" }
    if not __FUNCTION__.getKey( types, _mode ) then return false end

    -- Escribir en el archivo
    local file = io.open( "./script-output/" .. _name, _mode )
    file:write( _data )
    file:close( )
    return true
end
But it doesn't recognize IO, It doesn't recognize OS either but that's probably something else.
Last edited by yaim904 on Sat Nov 27, 2021 2:06 am, edited 1 time in total.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by google.
:D

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [ 1.1 ] How do I see information before the whole game loads?

Post by Klonan »

You can use `log()`

User avatar
yaim904
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: [ 1.1 ] How do I see information before the whole game loads?

Post by yaim904 »

Klonan wrote:
Fri Nov 26, 2021 11:30 am
I used it, and it worked great for me. Thanks.

But, I noticed that the values ​​are not preserved when changing from Setting to Data, so I do not know I will insist on writing and reading to a file, ... or do you know a way to avoid that data layering?
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by google.
:D

Post Reply

Return to “Modding help”