Author Topic: (Game.TranslationFilename == "") Not working any more?  (Read 631 times)

Ali

  • What will become of the baron?
    • Ali worked on a game that was nominated for an AGS Award!
      Ali worked on a game that won an AGS Award!
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: Adventure Game Studio
  1. if (Game.TranslationFilename == "") {
  2.   oSp1.Visible=false;
  3.   oFr1.Visible=false;
  4.   oGe1.Visible=false;
  5.   oPo1.Visible=false;
  6.   oF1.SetView (54);
  7.   oF1.Animate (0,  3,  eRepeat,  eNoBlock);  
  8.   }
  9.  
  10. else if (Game.TranslationFilename == "Nelly_Spanish") {
  11.   oSp1.Visible=true;
  12.   oFr1.Visible=false;
  13.   oGe1.Visible=false;
  14.   oPo1.Visible=false;
  15.   oF1.SetView (93);
  16.   oF1.Animate (0,  3,  eRepeat,  eNoBlock);  
  17.   }

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?
« Last Edit: 14 Apr 2017, 15:38 by Ali »

dayowlron

  • been programming computers since 1981
    • I can help with AGS tutoring
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: (Game.TranslationFilename == "") Not working any more?
« Reply #1 on: 14 Apr 2017, 15:45 »
Not sure why it is not working but change it to use IsTranslationAvailable instead.

Code: Adventure Game Studio
  1. if (!Game.IsTranslationAvailable()) {
  2.     ...
  3.  
« Last Edit: 14 Apr 2017, 15:47 by dayowlron »
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Ali

  • What will become of the baron?
    • Ali worked on a game that was nominated for an AGS Award!
      Ali worked on a game that won an AGS Award!
Re: (Game.TranslationFilename == "") Not working any more?
« Reply #2 on: 14 Apr 2017, 16:42 »
Ah! Thanks, that works.

I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: (Game.TranslationFilename == "") Not working any more?
« Reply #3 on: 14 Apr 2017, 17:08 »
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.

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".
« Last Edit: 15 Apr 2017, 01:50 by Crimson Wizard »

Ali

  • What will become of the baron?
    • Ali worked on a game that was nominated for an AGS Award!
      Ali worked on a game that won an AGS Award!
Re: (Game.TranslationFilename == "") Not working any more?
« Reply #4 on: 16 Apr 2017, 13:00 »
Thanks for the explanation, CW!