Page 1 of 1

Different languages, same game...

PostPosted: Mon Feb 25, 2008 7:02 pm
by Lyberodoggy
Ok, here I am again with a brand new useless idea :P
I came up with this idea during .ini creation in my tutorial about scoreboards.
Before continuing, I would like to say that I recommend this method only for puzzles. It can also be used on adventures, but it is gonna be far more difficult and I don't know if it can be used with dialogues yet...
Well let's get straight to the point: You can supply your game with a language pack by putting a languages.ini file in your project's "External Folder". Open your text editor.
You 'll have to create the file from scratch and it must look like this:
Code: Select all
[1]
1=English_text1
2=English_text2
[2]
1=German_text1
2=German_text2
etc

where English_text1 etc will be replaced by the text you will use for your game...
When finished writing it, save it as languages.ini
You will then have to create a language selection screen. Create a frame and go to advanced...
Type the code
Code: Select all
loadcontrol CheckboxObject(1)
CheckboxObject(1).Visible=true
CheckboxObject(1).Caption=English
CheckboxObject(1).Move x*y,z*d,a*e,t*y
//replace the letters with actual coordinates

for each language you want to include.
In this frame create a hotspot which will be the button for applying the language to an integer variable
create the integer variable named "selected_language"
Now go to the button hotspot.
Under its "Advanced" tab type this piece of code:
Code: Select all
//checking if player has selected more than one languages:
If CheckboxObject(1).value+CheckboxObject(2).value+...=1 Then
If CheckBoxObject(1).value=1 Then
selected_language=1
//where 1 represents English. In your .ini, you have written the English
//text under [1], so it will be used as the index for English.
else If CheckBoxObject(2).value=1 Then
selected_language=2
//where 2 represents German, because in your .ini German text is under [2] index
//same for all languages
end if
else
msgbox "select ONE language"
end if

Add another button hotspot which will be used for going to next frame. Name it "next". Go to its advanced Tab, type
Code: Select all
If selected_language=" " Then
msgbox "Please select your language"
Else
Action.PopupSaveGame
Action.Gotoframe "YourInitialFrame
End If

In the frame of your game, type this code for every text:
Code: Select all
//remember to replace the index of the text and the number of the row of
//the INI every time
Text(1).Caption=Action.ReadFromINI("languages.ini",selected_language,1)
Text(2).Caption=Action.ReadFromINI("languages.ini",selected_language,2)
//etc



Hope you will use it :P
Code: Select all
If facing any problems with the tutorial then
 feel free to ask me...
Else If you liked it then
feel free to let me know
End If :P

PostPosted: Mon Feb 25, 2008 7:45 pm
by GM-Support
Thanks for posting this!

PostPosted: Mon Feb 25, 2008 7:52 pm
by Lyberodoggy
My pleasure to be of help :P

PostPosted: Tue Feb 26, 2008 1:38 pm
by Lyberodoggy
I think that we could get it to work with dialogues too, using the
Code: Select all
DialogueObject(i).caption=

command...


I 'm not sure yet...

PostPosted: Tue Feb 26, 2008 7:51 pm
by Chromegloss55
Well, for my Connect 4 game, which is available in English, French, Spanish and German, at the start of the game, I simply use this code:

Code: Select all
Q = ReadINI("Settings.txt", 1, 1)

If Q = 1 then Language = "English"
If Q = 2 then Language = "Spanish"
If Q = 3 then Language = "French"
If Q = 4 then Language = "German"


Then when you set a language:

Code: Select all
WriteINI "Settings.txt", 1, Q


Where Q represents language selected.

This is how the program always starts in the last selected language.
_________________
us economic recessions

PostPosted: Tue Feb 26, 2008 8:02 pm
by Lyberodoggy
I didn't place a writeINI command in purpose, in order for the code not to get to difficult to understand... It's going to anyway load the right language because the language variable is saved along with the player's progress.

PostPosted: Tue Feb 26, 2008 8:06 pm
by Lyberodoggy
Ah, I forgot to write this one:
If you want the player to skip the language selecting screen every time he starts a game, create a custom menu and include a "select language" button which transfers the player to the language selection frame apart from the "Start New Game" and "Load" buttons.

PostPosted: Tue Feb 26, 2008 8:08 pm
by Chromegloss55
You definately have loads of great ideas! I'd love to do a project with you one day...
_________________
Hair Problems Forum

PostPosted: Tue Feb 26, 2008 8:25 pm
by Lyberodoggy
Thanks... The same goes for you, I think you have lots of ideas and solutions too...

And I definitely would like to do a project with you too :P

PostPosted: Tue Feb 26, 2008 8:29 pm
by Chromegloss55
Well, if you have any ideas, get back to me.
_________________
Shinto Forum

PostPosted: Tue Feb 26, 2008 8:33 pm
by Lyberodoggy
Ideas about what? Techs, Projects or... ?

PostPosted: Tue Feb 26, 2008 8:35 pm
by Chromegloss55
For a game or project...
_________________
Expatriate insurance Forum

PostPosted: Tue Feb 26, 2008 8:37 pm
by Chromegloss55
I can't start any NEW PROJECTS at the moment, because I'm way too busy. I've got this Connect 4 to release, then I've got to release 100 VB Techniques. Then I have to pay those who asked for pay in relation to Connect 4. Plus I have Furtive and Hundiendo Isla to work on as well. My schedule is pretty full. But I can help out with an existing project, and when I'm done with these projects, I can help you start a new one.
_________________
Indian Forum

PostPosted: Tue Feb 26, 2008 8:43 pm
by Lyberodoggy
Ok, I will wait for you to be free in order to start a project together... Maybe we could develop the trilogy I 've mentioned here http://www.adventuremaker.com/phpBB2/viewtopic.php?t=3582 or anything you want... But let's not get off-topic this much :P

PostPosted: Tue Feb 26, 2008 8:46 pm
by Chromegloss55
Yep.

I'll of course do anything for free. (I know what it's like to have to shell out money. It's painful!)
_________________
going green

PostPosted: Tue Feb 26, 2008 8:56 pm
by Lyberodoggy
Chromegloss55 wrote:Well, for my Connect 4 game, which is available in English, French, Spanish and German, at the start of the game, I simply use this code:

Code: Select all
Q = ReadINI("Settings.txt", 1, 1)

If Q = 1 then Language = "English"
If Q = 2 then Language = "Spanish"
If Q = 3 then Language = "French"
If Q = 4 then Language = "German"


Then when you set a language:

Code: Select all
WriteINI "Settings.txt", 1, Q


Where Q represents language selected.

This is how the program always starts in the last selected language.

Thanks for your free-of-charge assistance :P
as for this post, I think I didn't get you (or you didn't get me...)
I created this tutorial, in order to include every single text of the game written in three or four languages... Not just the menus...
I don't get this line: If Q = 1 then Language = "English"
Language is a variable? Or a function? and if it's a variable, how does it work after assigning a value in it?