Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mehrdad on Sat 14/05/2011 15:08:09

Title: Custom select language
Post by: Mehrdad on Sat 14/05/2011 15:08:09
Hello

Is here any way for make custom menu to select language in game intro without use winsetup.exe ?
Title: Re: Custom select language
Post by: Gilbert on Sat 14/05/2011 16:19:26
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.
Title: Re: Custom select language
Post by: monkey0506 on Sat 14/05/2011 23:16:45
Actually, I forget which AGS version implemented it, but there's now the Game.ChangeTranslation function, which IIRC doesn't require a restart.

Game.ChangeTranslation("French");
Title: Re: Custom select language
Post by: Mehrdad on Sun 15/05/2011 09:22:43
Thanks a lot.is this function change automatically language in winseup.exe?
Title: Re: Custom select language
Post by: monkey0506 on Sun 15/05/2011 17:11:56
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:

// 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.
Title: Re: Custom select language
Post by: Mehrdad on Mon 16/05/2011 10:44:15
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