Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Tequila144 on Wed 23/01/2008 12:19:00

Title: Translate graphic elements on GUI
Post by: Tequila144 on Wed 23/01/2008 12:19:00
I have translate my game from Italian to English. 
The game uses a GUI with graphic elements (in Italian). 
I had thought about using this: 
 
if (Game.TranslationFilename == "English") { 
use GUI(english); 

 
but isn't good because in the game there are many lines; GUItalian Off and On (and i don't modify it).. 
Is possible, with script up, modify only the graphic elements of the Italian GUI?
Title: Re: Translate graphic elements on GUI
Post by: Khris on Wed 23/01/2008 14:26:00
Option 1:
Change the buttons' graphics depending on Game.TranslationFilename using GUIButton.NormalGraphic and related ones.

Option 2:
Set the GUIButton graphics like this:
function init_guis() {
  String s;
  s = "10"; restartYesButton.NormalGraphic = s.AsInt;
  s = "11"; restartNoButton.NormalGraphic = s.AsInt;
  ...
}

// in game start
init_guis();

Now "10", "11", ... will appear in the translation source and can be directly translated into the numbers of the english button graphic slots.
Title: Re: Translate graphic elements on GUI
Post by: Tequila144 on Thu 24/01/2008 20:34:19
I have try the first option.. 
I have read the manual but I don't understanding how run the script:   
GUIButton.NormalGraphic 
 
For example, the gui is the GUI 0 and the button to modify (in english version) is the Button 0, the number of the spriteimage to use in the English version  is 190.

Then:


if (Game.TranslationFilename == "English") { 
GUIButton.NormalGraphic ????

Title: Re: Translate graphic elements on GUI
Post by: Khris on Thu 24/01/2008 22:01:43
Either name the button (scriptname field of the properties window). Say you call it "mybutton1".
Then the script line should read
  mybutton1.NormalGraphic = 190;

Alternatively, you can reference the buttons by using only the index numbers:
  GUIButton*b = gui[0].Controls[0].AsButton;    // .AsButton returns null if control isn't a button
  if (b != null) b.NormalGraphic = 190;
Title: Re: Translate graphic elements on GUI
Post by: Tequila144 on Thu 24/01/2008 22:25:13
Quote from: KhrisMUC on Thu 24/01/2008 22:01:43
Either name the button (scriptname field of the properties window). Say you call it "mybutton1".
Then the script line should read
  mybutton1.NormalGraphic = 190;

Ok, but i have 4 GUI, do I specify that the button is of the GUI0?
Title: Re: Translate graphic elements on GUI
Post by: Khris on Thu 24/01/2008 22:45:25
No, it's not possible to have two buttons with the same name, even if they're on different GUIs.
Call them whatever you want, then use that name. Since there's only one button of that name, AGS doesn't need to know the GUI's name or number.
(Did you try it before asking, I wonder...)
Title: Re: Translate graphic elements on GUI
Post by: Tequila144 on Thu 24/01/2008 23:05:43
Quote from: KhrisMUC on Thu 24/01/2008 22:45:25
No, it's not possible to have two buttons with the same name, even if they're on different GUIs.
Call them whatever you want, then use that name. Since there's only one button of that name, AGS doesn't need to know the GUI's name or number.
(Did you try it before asking, I wonder...)

Ok, sorry (but i not have AGS to the moment)..
and thanks.  ;)