Gamestudio Links
Zorro Links
Newest Posts
IG plugin initial release
by TTT. 11/11/19 23:32
Optimize non asset/algo specific
by StefanCGN. 11/11/19 15:32
New Zorro version 2.20
by jcl. 11/11/19 09:11
OANDA pricing changes
by AndrewAMD. 11/11/19 02:25
Can't Connect..IG Plugin
by TTT. 11/10/19 23:12
CONTACT* contact
by Dooley. 11/10/19 14:08
How to control entry/exit price?
by Petra. 11/10/19 10:30
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
5 registered members (TTT, AndrewAMD, Paulius, kvm, 1 invisible), 641 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
andrews825, KKelk, TTT, Mr_Rob, dkz
18325 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Loading Keybindings from a File #478348
10/08/19 06:07
10/08/19 06:07
Joined: May 2005
Posts: 712
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 712
Chicago, IL
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...

Quote
file_str_read(filehandle,str_forward);
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:

Quote
key_forward = 17;
str_cpy(str_forward,"W");

Last edited by Dooley; 10/08/19 06:08.
Re: Loading Keybindings from a File [Re: Dooley] #478377
10/10/19 03:44
10/10/19 03:44
Joined: May 2005
Posts: 712
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 712
Chicago, IL
Looks like I was able to solve this by doing it slightly differently...

Quote
key_forward = file_var_read(key_filehandle);
str_for_key(str_forward,key_forward);


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.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1