Read Variables from Text file

Posted By: Truth

Read Variables from Text file - 07/31/13 13:06

Hi, does anyone have an example on how i can do this? i want to create a text file with variables like draw distance(camera.clip_far = ) and users who play my game will be able to change this and when the game launches the engine will read the variable from the text file and apply it. Thanks laugh
Posted By: Superku

Re: Read Variables from Text file - 07/31/13 13:16

Just use file_open_read/write and the corresponding var instructions. The trick is to read and write them in the same order, for instance as follows:

filehandle = file_open_read("my_save.txt");
camera.clip_far = file_var_read(filehandle);
player_level = file_var_read(filehandle);
...

Save them in the same order.
© 2024 lite-C Forums