Custom select language

Started by Mehrdad, Sat 14/05/2011 15:08:09

Previous topic - Next topic

Mehrdad

Hello

Is here any way for make custom menu to select language in game intro without use winsetup.exe ?
My official site: http://www.pershaland.com/

Gilbert

If you're using the internal translation system of AGS (i.e. not one you scripted into the game yourself) you can script your codes that modify the .cfg file of the game, but note that you still need to restart the game (re-executing the game executable, not via RestartGame() ) for this to take effect.

monkey0506

Actually, I forget which AGS version implemented it, but there's now the Game.ChangeTranslation function, which IIRC doesn't require a restart.

Code: ags
Game.ChangeTranslation("French");

Mehrdad

Thanks a lot.is this function change automatically language in winseup.exe?
My official site: http://www.pershaland.com/

monkey0506

#4
winsetup sets the default translation to use when the game is loaded. The Game.ChangeTranslation function is a script function you would call from the game script, for example in on_key_press or a GUIControl's event handler:

Code: ags
// on_key_press
  else if (keycode == eKeyCtrlL)
  {
    // Ctrl+L pressed, change to the next translation
    if (Game.TranslationFilename == "English") Game.ChangeTranslation("Spanish");
    else if (Game.TranslationFilename == "Spanish") Game.ChangeTranslation("French");
    else if (Game.TranslationFilename == "French") Game.ChangeTranslation("English");
  }
}

// btnFrench_Click
  Game.ChangeTranslation("French");


I haven't actually used the function myself, but I believe this code would do what you're looking for. ;) Oh, and this function does not affect the configuration file generated by winsetup at all, but it would be possible to overwrite the CFG file using the File functions. If you do though, just be careful to not overwrite the user's other settings. Also, you may even want to make it optional for the user whether or not the default language is changed.

Mehrdad

Thank you very much.I have will test this code.and i report here if was any error.although i think code is complete correct.

Thanks for help
Mehrdad
My official site: http://www.pershaland.com/

SMF spam blocked by CleanTalk