0
\$\begingroup\$

I am creating a game that requires the use of ini files.

The game works perfectly on my computer.

When I create and executable, the executable even uses the ini files when I am programming/testing the game on the engine.

Directory where the ini files are located:

D:\Users\BonecoSinforoso\AppData\Local\Brasmotor_1

The problem occurs when a person from another computer tries to play. The game does not create any ini files.

Even placing the ini files in the zipped file that I put the game on, it gives an error. Because the ini files don't go to a directory that the game can read.

I would like to know how to make my executable create or move the ini files to a directory where the files can be read.


EDIT 1

How do I create the ini files:

ini_open("config.ini");
    arkivoIdioma=ini_read_string("jogoIdioma","arkivoIdioma","");
    dadosNum=ini_read_real("dadosNum","dadosNum",1);
    paradaModo=ini_read_string("paradaModo","modo","automatico");
    paradaPorcAutomatico=ini_read_real("paradaPorcAutomatico","porcentagem",10);
    paradaPorcAviso=ini_read_real("paradaPorcAviso","porcentagem",10);
ini_close();

Searching about, I found something explanatory about the directory:

The ini files get created. Probably you are not looking in the right place for it. The ini file get created in %AppData%/Local/"YourGameNameHere" folder, that's where you'll find all the files you save.

BY JM DG.

LINK:

https://www.reddit.com/r/gamemaker/comments/5d6pf0/how_do_i_create_a_new_ini_file/

Error obtained by a user:

enter image description here

A little earlier, I made a change to the line of this script. I will wait for this user to test again to see if the error has been resolved.

\$\endgroup\$
2
  • \$\begingroup\$ Is it always BonecoSinforoso or is it the user's actual username? Is it always D:\Users\BonecoSinforoso\AppData\Local or is it the user's actual local appdata directory? (which you can get by calling SHGetKnownFolderPath with FOLDERID_LocalAppData) \$\endgroup\$
    – user253751
    Dec 16, 2020 at 15:03
  • \$\begingroup\$ @user253751 user's actual username. \$\endgroup\$ Dec 19, 2020 at 22:17

1 Answer 1

0
\$\begingroup\$

To solve the problem. Just add the ini files to the game's zipped file:

enter image description here

And adapt the opening code of the zip file:

ini_open("config.ini"); -> ini_open(working_directory+"config.ini");

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .