Solarus-Games English Forum

Solarus => Development => Topic started by: PhoenixII54 on June 15, 2015, 09:37:01 PM

Title: [Solved but strange] Problem with save variables in custom game manager
Post by: PhoenixII54 on June 15, 2015, 09:37:01 PM
In my test game, i made a custon central game and save manager.
When creating a game, everything seems fine but it doesn"t seem to take the save and get savegame values function in account. For example, in initialization, i set max life to 10 and two option values for the sound and music volumes in costom named variables, but when calling the game:save() function, max life reverts to 1 and the option variables just don't exist. No error is thrown.
My question is : did i make something wrong or is there a bus with the save management ?

I attached the game manager script so you can chack foir any error.

Thanks in advance for your answer.
Title: Re: Problem with save variables in custom game manager
Post by: Christopho on June 16, 2015, 10:29:47 AM
I don't see an error just by reading the code.
Maybe someone else will find something?
If not, can you give a link to your whole quest (with google drive or something) so that we can reproduce the bug?
Title: Re: Problem with save variables in custom game manager
Post by: PhoenixII54 on June 16, 2015, 10:46:07 AM
Here it is. Hope it helps you.



https://drive.google.com/folderview?id=0BzXzhPafClIMfkV3a2FESnVrUDdCNlRzbWpyZ3JYMmRQZkZ1aUhySzBpQXlTTWNuTld5Tzg&usp=sharing (https://drive.google.com/folderview?id=0BzXzhPafClIMfkV3a2FESnVrUDdCNlRzbWpyZ3JYMmRQZkZ1aUhySzBpQXlTTWNuTld5Tzg&usp=sharing)


Note : Feel free to switch the "debug" variable in main to see the cell viewer i made to find the problem with streams
Title: Re: Problem with save variables in custom game manager
Post by: Christopho on June 16, 2015, 11:44:03 AM
I have just tested and I don't see what you describe. When I save, values are not reverted. My save file has the correct values: max_life is 10 and I have your two new values:

_ability_tunic = 1
_current_life = 1
_joypad_action = "button 0"
_joypad_attack = "button 1"
_joypad_down_key = "axis 1 +"
_joypad_item_1 = "button 2"
_joypad_item_2 = "button 3"
_joypad_left_key = "axis 0 -"
_joypad_pause = "button 4"
_joypad_right = "axis 0 +"
_joypad_up_key = "axis 1 -"
_keyboard_action = "space"
_keyboard_attack = "c"
_keyboard_down = "down"
_keyboard_item_1 = "x"
_keyboard_item_2 = "v"
_keyboard_left = "left"
_keyboard_pause = "d"
_keyboard_right = "right"
_keyboard_up = "up"
_max_life = 10
_starting_map = "tests/out_tile_test_map"
_starting_point = ""
_version = 2
option_music_volume = 50
option_sound_volume = 50
Title: Re: Problem with save variables in custom game manager
Post by: PhoenixII54 on June 16, 2015, 12:15:41 PM
OK, thanks for testing.

Just tested and it worked fine too...

Sounds funny as the last time i tried it just didn't work. Maybe restarting the editor and/or the computer did help.