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
- 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