Loading Keybindings from a File

Posted By: Dooley

Loading Keybindings from a File - 10/08/19 06:07

I wrote a script to be able to save custom keybindings to a text file, then have the game load them on start. It worked fine in A7, but since I updated to A8, it seems to cause problems...

key_forward = key_for_str(str_forward);

The writing to file works fine, as before, but when it reads the strings from the file to load custom keybindings, the game seems to encounter very strange errors. Is there anything wrong with the way I am reading this "str_forward" string, and assigning it to the "key_forward" variable?

When no file has been saved, the game will load the default values. When this happens, everything works as it is supposed to. In that case, the script will just apply these values manually, like this:

key_forward = 17;
Posted By: Dooley

Re: Loading Keybindings from a File - 10/10/19 03:44

Looks like I was able to solve this by doing it slightly differently...

key_forward = file_var_read(key_filehandle);

It was strange, and I can't explain why I was getting other errors, but by saving the key as a variable instead of a string, it seems to fix all the problems.
© 2020 lite-C Forums