D
Dazai
Guest
// SAVE:
ini_write_real("game", "item_array_length", array_length_1d(game.item));
for(i = 0; i < array_length_1d(game.item); i++){
ini_write_real("game", "item[" + string(i) + "].type", game.item.type);
}
// LOAD:
for(i = 0; i < array_length_1d(ini_read_real("game", "item_array_length", 14)); i++){
game.item.type = ini_read_real("game", "item[" + string(i) + "].type", 0);
}
For some reason everything works in my .ini files except when I try to do arrays like this. I suspect it's because of the + string(i) + that I'm doing. Does anybody know why this won't work?
EDIT: Already solved. It was the additional array_length_1d in the LOAD loop. Removing that solved the problem. Mods feel free to delete this!
ini_write_real("game", "item_array_length", array_length_1d(game.item));
for(i = 0; i < array_length_1d(game.item); i++){
ini_write_real("game", "item[" + string(i) + "].type", game.item.type);
}
// LOAD:
for(i = 0; i < array_length_1d(ini_read_real("game", "item_array_length", 14)); i++){
game.item.type = ini_read_real("game", "item[" + string(i) + "].type", 0);
}
For some reason everything works in my .ini files except when I try to do arrays like this. I suspect it's because of the + string(i) + that I'm doing. Does anybody know why this won't work?
EDIT: Already solved. It was the additional array_length_1d in the LOAD loop. Removing that solved the problem. Mods feel free to delete this!