Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ali on Fri 14/04/2017 15:06:02

Title: (Game.TranslationFilename == "") Not working any more?
Post by: Ali on Fri 14/04/2017 15:06:02
Hello!

I'm updating Nelly Cootalot: Spoonbeaks Ahoy using AGS 3.4.0. There are lots of scenes where I have to switch objects off or on based on the current translation.

Code (ags) Select

if (Game.TranslationFilename == "") {
  oSp1.Visible=false;
  oFr1.Visible=false;
  oGe1.Visible=false;
  oPo1.Visible=false;
  oF1.SetView (54);
  oF1.Animate (0,  3,  eRepeat,  eNoBlock); 
  }
 
else if (Game.TranslationFilename == "Nelly_Spanish") {
  oSp1.Visible=true;
  oFr1.Visible=false;
  oGe1.Visible=false;
  oPo1.Visible=false;
  oF1.SetView (93);
  oF1.Animate (0,  3,  eRepeat,  eNoBlock); 
  }


The other translations work (Spanish, etc.), but the script for no translation file (Game.TranslationFilename == "") doesn't happen. The same script works back in v3.2.1, but it doesn't work in 3.4.0. Has something changed?
Title: Re: (Game.TranslationFilename == "") Not working any more?
Post by: dayowlron on Fri 14/04/2017 15:45:13
Not sure why it is not working but change it to use IsTranslationAvailable instead.


if (!Game.IsTranslationAvailable()) {
    ...
Title: Re: (Game.TranslationFilename == "") Not working any more?
Post by: Ali on Fri 14/04/2017 16:42:49
Ah! Thanks, that works.

I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.
Title: Re: (Game.TranslationFilename == "") Not working any more?
Post by: Crimson Wizard on Fri 14/04/2017 17:08:23
That's right, something wrong is there, but I cannot tell when it became so, haven't had time to investigate yet.

Manual states that Game.TranslationFilename should return empty string for default translation, but currently it returns "Default".

UPD: This was broken about 1.5 years ago, since AGS 3.3.5. Until fixed the workaround is to compare versus "default" string.
UPD2: In fact, correct workaround is to compare to both (OR-ing two conditions), because if fixed, it will return to "" again.

Quote from: Ali on Fri 14/04/2017 16:42:49
I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.
Yes, the name of the function may be misleading. It really means "is translation loaded".
Title: Re: (Game.TranslationFilename == "") Not working any more?
Post by: Ali on Sun 16/04/2017 13:00:09
Thanks for the explanation, CW!