Page 1 of 1

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

Posted: Fri Nov 26, 2021 11:15 am
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.

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

Posted: Fri Nov 26, 2021 11:30 am
by Klonan
You can use `log()`

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

Posted: Sat Nov 27, 2021 2:11 am
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?