Y_ini - one int saves multiple times?
#1

Hello.
There is a problem that I can't find any explanation of. One int simply saves to file multiple times (2-3), and it screws up the loading of this int. Here's the code:

PHP Code:
new INI:ini = INI_Open("Frakcje.ini"); // OnGameModeExit
INI_WriteInt(ini, "Strefa_0", Strefa[0][sFrakcja]);
INI_WriteInt(ini, "Strefa_1", Strefa[1][sFrakcja]);
INI_WriteInt(ini, "Strefa_2", Strefa[2][sFrakcja]);
INI_WriteInt(ini, "Strefa_3", Strefa[3][sFrakcja]);
INI_WriteInt(ini, "Strefa_4", Strefa[4][sFrakcja]);
INI_WriteInt(ini, "Strefa_5", Strefa[5][sFrakcja]);
INI_WriteInt(ini, "Strefa_6", Strefa[6][sFrakcja]);
INI_WriteInt(ini, "Strefa_7", Strefa[7][sFrakcja]);
INI_WriteInt(ini, "Strefa_8", Strefa[8][sFrakcja]);
INI_WriteInt(ini, "Strefa_9", Strefa[9][sFrakcja]);
INI_WriteInt(ini, "Strefa_10", Strefa[10][sFrakcja]);
INI_WriteInt(ini, "Strefa_11", Strefa[11][sFrakcja]);
INI_WriteInt(ini, "Strefa_12", Strefa[12][sFrakcja]);
INI_WriteInt(ini, "Strefa_13", Strefa[13][sFrakcja]);
INI_WriteInt(ini, "Strefa_14", Strefa[14][sFrakcja]);
INI_Close(ini); 
Frakcje.ini after saving:
PHP Code:
Strefa_0 = 4
Strefa_1 
= 5
Strefa_2 
= 4
Strefa_3 
= 3
Strefa_4 
= 3
Strefa_5 
= 1
Strefa_6 
= 1
Strefa_7 
= 6
Strefa_8 
= 6
Strefa_9 
= 1
Strefa_10 
= 2
Strefa_11 
= 2
Strefa_12 
= 2
Strefa_13 
= 2
Strefa_14 
= 5Strefa_1 = 3
Strefa_1 
= 1 
There is nothing wrong with the code, so what's up with that
Reply
#2

bump
Reply
#3

First of all, You can simplify the code using a for loop

PHP Code:
new string[12];
new 
INI:ini = INI_Open("Frakcje.ini"); // OnGameModeExit
for(new i = 0; i < 15; i++) {
    
format(string, sizeof(string), "Strefa_%i", i);
    
INI_WriteInt(ini, string, Strefa[i][sFrakcja]);
}
INI_Close(ini); 
Second, Your Sciprt might be crashing. Try loading up crashdetect and check the server log.
Reply
#4

I use crashdetect and there are no crashes.
Reply
#5

Are you using YSI 3 or 4? If 4 - is it lastest from github repo? I'll try with an empty project to see if I can reproduce this issue.
Reply
#6

I use YSI 4.00.0001 and don't remember where I got it

/edit: When I save this one int as Strefa_A instead of Strefa_1 (the other ones remain numerated) this issue doesn't trigger anymore. Still, this is not a perfect solution, cause the issue can happen anytime and anywhere else when saving.
Reply
#7

I tested with latest YSI, and it writes correctly (the order is inversed, but that doesn't matter). Try updating it and testing again.
Reply
#8

I updated it but the problem persists (now it writes twice Strefa_14 instead of Strefa_1).
PHP Code:
Strefa_0 = 1
Strefa_14 
= 5
Strefa_2 
= 2
Strefa_3 
= 3
Strefa_4 
= 3
Strefa_5 
= 1
Strefa_6 
= 1
Strefa_7 
= 2
Strefa_8 
= 1
Strefa_9 
= 1
Strefa_10 
= 2
Strefa_11 
= 2
Strefa_12 
= 2
Strefa_13 
= 2
Strefa_14 
= 5
Strefa_1 
= 5 
No idea what should I do.
Reply
#9

Sorry for bumping an old thread but I have the same problem.
I updated YSI to 4.00.0001(the newest version downloaded from here https://github.com/Misiur/YSI-Includes/releases) and one of the variables is double-saved.
Before the update there was no problem with this and I have made no changes in saving before adn after the update.

Any ideas someone?

Thanks in advance!

EDIT:
I had spaces in the Tag. I think this causes the problem!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)