Saving and language [SOLVED]

  • #1, by gabartsFriday, 09. November 2018, 15:35 A year ago
    I've put intro video in a scene with transparent back as suggested. In the beginning of scene
    I've used the code:

    Pause 600 mms
    If autosave #0 exists
    Else
    Execute autosave #0
    End if
    1
    2
    3
    4
    5

    Then in main menu i have 2 flag buttons for switching language with a condition set.
    They control also the switch of graphic both in italian and english for menu buttons.

    The new game object area on left click has this:

    If autosave #0 exists
    Load autosave #0
    Else
    some other actions...
    1
    2
    3
    4

    The problem is that if I start for the first time my game let say in italian the autosave #0 will be italian so if I start again in english later it will load the cutscenes in italian...
    I didn't noticed this problem in my first project with the scumm template. How can I fix this?

    Also if I use a scene for the intro video I see cursor and main interface appearing for 1 second and with menu instead the engine seems not to load properly the autosave code and it freezes...

    Forum Fan

    136 Posts


  • #2, by andy-rinaldiFriday, 09. November 2018, 18:43 A year ago
    Hi Gabarts,
    you can use the autosave feature in order to save the language. For example:
    If the player click on italian flag, the autosave #0 is executed,
    If the player click on english flag, the autosave #1 is executed.

    Then when the player start a new game, you can check those conditions in order to direct the player to correct language.

    At the start the game:
    if autosave #0 exists
    load italian cutscene
    else
    load english cutscene
    end if

    This if you have just 2 languages. Also you can use this system in order to skip the screen flag saving the language session.

    If I understand what you mean.

    However your first code is incomplete, you forget to insert the action after the first condition.

    Let me know.
    Andy


    Forum Fan

    160 Posts

  • #3, by gabartsFriday, 09. November 2018, 21:47 A year ago
    Hey Andy,

    yes I have other action in the first code, but the problem is slightly different. Here the situation:

    I have 3 cutscenes (3 menus), inside I have 2 objects with a condition set (language_switch) that is triggered when player clicks in the 2 flag buttons in the main menu. This condition controls also the buttons in italian and buttons in english. So, basically all the graphic for buttons and cutscenes is controlled by this condition.

    Here what I have precisely in my project:

    in the object area_1 (new game/nuova partita) on left click:

    If autosave #0 exists
    Load autosave #0
    Else
    Change condition 'nuova over' to false
    Change condition 'new_over' to false
    Show scene 'intro'
    End if
    1
    2
    3
    4
    5
    6
    7

    In the At beginning of scene inside intro scene I have:

    If autosave #0 exists
    Else
    Execute autosave #0
    End if
    Play video 'intro_logo.mkv'
    Show menu 'cutscene1'
    1
    2
    3
    4
    5
    6
    7
    Where cutscene1 contains both italian and english graphic.

    I need to tell the engine to reset the game considering the language switch, because now with this code if I start in italian the autosave #0 is of course stored with condition for italian language.

    EDIT: language_switch is a condition I have put in the main menu.

    Forum Fan

    136 Posts

  • #4, by afrlmeFriday, 09. November 2018, 22:28 A year ago
    Hmm.. you could also read the config.ini after loading a save game to see which language is set & then update the language based on that.

    Imperator

    6804 Posts

  • #5, by gabartsFriday, 09. November 2018, 23:39 A year ago
    Yeah, I've made some changes in the code, now it loads correctly the start intro, cutscenes with correct language but still it doesn't recognize the autosave #1

    Here what I have done:

    in the intro scene "At beginning of scene" I have now:

    Pause for 700 milliseconds
    If condition 'language_switch' is true
    Execute autosave #0
    Play video 'intro logo.mkv'
    Show menu 'cutscene1'
    Else
    Execute autosave #1
    Play video 'intro logo.mkv'
    Show menu 'cutscene1'
    End if
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    I have now 2 buttons (controlled by condition language_switch) and inside each I use:

    If autosave #0 exists
    Load autosave #0
    Else
    Change condition 'new over' to false
    Show scene intro
    End if
    1
    2
    3
    4
    5
    6

    And viceversa with autosave #1 for the other language

    The result is the same, it seems to load only the first autosave #0 correctly, bypassing autosave #1

    And logically I see why is not working, because after the first click on start (either italian or english) 1 autosave is executed. So if I click start in the other language it bypass the first 2 lines of code and loop again the intro saving the game in the current state...

    But I don't know where to put the code correctly to make the reset.


    Forum Fan

    136 Posts

  • #6, by andy-rinaldiSaturday, 10. November 2018, 00:41 A year ago
    You should have a Delete autosave function in the action part section.
    When you run Execute autosave #0 then run Delete autosave #1 and viceversa.
    So you have always only 1 autosave active.

    If language_switch is true shows italian language button?
    If language_switch is false shows english language button?

    What is "new over" condition?

    Let me know or send me a email.

    Forum Fan

    160 Posts

  • #7, by sebastianSaturday, 10. November 2018, 01:31 A year ago
    do i get this correctly that the issue is to preserve the config.ini settings after loading a game?

    Thread Captain

    2334 Posts

  • #8, by gabartsSaturday, 10. November 2018, 06:07 A year ago
    do i get this correctly that the issue is to preserve the config.ini settings after loading a game?
    My config.ini file is always empty.

    It seems weird anyway that in a software like Visionaire there is no reset to initial state for start buttons...

    I delete all the game folder under user/local and start a fresh boot. Then I start my game let say in italian, if i make some progress and later switch to english and click new game it loads the current state and doesn't reset. Maybe it's just an action or function but I cannot find it! smile

    Forum Fan

    136 Posts

  • #9, by gabartsSaturday, 10. November 2018, 08:35 A year ago
    I solved with an extra splash screen for language selection where autosave #0 is executed so then you can start from zero.

    Forum Fan

    136 Posts

  • #10, by sebastianSaturday, 10. November 2018, 09:17 A year ago
    when you dont save your language settings in the config ini, the game would be the same language after each restart of the game file.
    The idea behind the config file is to store all needed information which need to be preserves. Either via loading a game or just restarting the complete game file. 
    reading the config.ini would need lua to do this. 
    You can do this in the game start action and also after a savestate was succsessfully loaded to overwrite the default or different settings from another savestate. 
    The slashscreen solution will onlynwork for game start but not midgame language changing and then loading another gamestate where the language was still different 

    Thread Captain

    2334 Posts

  • #11, by gabartsSaturday, 10. November 2018, 10:25 A year ago
    Yes it works because I have also 2 flags for language switch in main menu and those control the changes after the game is started. The splash screen is only for start. Of course the Lua code to check config.ini would be the cleaner solution but I need a programmer for that smile

    Forum Fan

    136 Posts

Write post