Multilingual Game, loading text from files.

For questions about using Classic.

Post » Sat Oct 04, 2008 11:14 am

I need help with this.

I want to load an external file for the text in my game.
The best way to explain myself is in pseudocode:

[code:2ytzm2bq]+Start of Layout
-Load LanguageText file

+*Condition*
-Set Text to LanguageText file, Line 1

+"Other Condition"
-Set Text to LanguageText file, Next (or previous) Line

+"Yet Another Condition"
-Set Text to LanguageText file, Specified Line[/code:2ytzm2bq]

Any ideas?
Thanks :)
B
2
S
1
G
4
Posts: 92
Reputation: 1,384

Post » Sat Oct 04, 2008 12:02 pm

Use List object and load file into it. Retrieving 'n' line:
[code:1qwg8gn4]ListBox.LineText(n)[/code:1qwg8gn4]
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Sat Oct 04, 2008 4:39 pm

i'll have an example cap in a second. but it seems construct can't display japanese characters :(

edit:
PUT THE TWO .INI FILES IN YOUR C DIRECTORY (C:\)
http://upload.dfyb.net/uploaded/language_test.zip
PUT THE TWO .INI FILES IN YOUR C DIRECTORY (C:\)

i built mine so you could change languages on the fly, but you could easily have it to where you only change languages in the options or at the start.

to the devs: any idea if you'll support japanese (unicode?) characters in the future? i tried it from .ini files and from .html files and neither let me display japanese characters.

also, in order to allow you to click a button and go to the "next" line, i had to name the items plain numbers (1, 2, 3, etc) and set text as INI.ItemString("dialog1", global('line')). originally i had them named "line_1" etc, and tried to set text as INI.ItemString("dialog1", "line_"global('line')) -- is there a way to do that (to have a mix between text in quotes and calling a value)?

it'd be useful for things like "there are # balls in view" without having to use more than one text object.
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Sat Oct 04, 2008 8:46 pm

Thanks, that's kind of what I was trying.
But the differenceIt is that it didn't occur to me to use global('line').

I'll see what I can do now. :)
B
2
S
1
G
4
Posts: 92
Reputation: 1,384

Post » Sun Oct 05, 2008 12:39 am

[quote="dfyb":3k6b3mud]PUT THE TWO .INI FILES IN YOUR C DIRECTORY (C:\)[/quote:3k6b3mud]
Aaaagh! Don't do this, use the AppPath expression to load it from the same directory as the application! There's never any need to force people to put files in a fixed directory! (Sorry, pet peeve)

[quote:3k6b3mud]to the devs: any idea if you'll support japanese (unicode?) characters in the future? i tried it from .ini files and from .html files and neither let me display japanese characters.[/quote:3k6b3mud]
Hmm, not sure if we can do it soon. It's a bit late really - we didn't start off with support for unicode, so it'd be a lot of work going through Construct's code changing it. Maybe for a version 2 type thing...
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,298

Post » Sun Oct 05, 2008 1:33 am

[quote="Ashley":2bc1zjda][quote="dfyb":2bc1zjda]PUT THE TWO .INI FILES IN YOUR C DIRECTORY (C:\)[/quote:2bc1zjda]
Aaaagh! Don't do this, use the AppPath expression to load it from the same directory as the application! There's never any need to force people to put files in a fixed directory! (Sorry, pet peeve)[/quote:2bc1zjda]
i was hoping there'd be a feature like this (as i would never want to release something without it), i just didn't know about it :)

edit: got it working. thanks

[quote="Ashley":2bc1zjda][quote:2bc1zjda]to the devs: any idea if you'll support japanese (unicode?) characters in the future? i tried it from .ini files and from .html files and neither let me display japanese characters.[/quote:2bc1zjda]
Hmm, not sure if we can do it soon. It's a bit late really - we didn't start off with support for unicode, so it'd be a lot of work going through Construct's code changing it. Maybe for a version 2 type thing...[/quote:2bc1zjda]
i was hoping it'd be able to be implemented through a seperate object or something, but that isn't the case? i'd like to have my games be in both english/japanese, but as i don't plan on having tons of dialog (at least in my first game project), i guess i could just do it through images. also, the japanese indie game scene is pretty big -- if at all possible, i think it'd be worth having construct be more viable to them (i think displaying japanese characters is a bigger issue than the actual interface being in english or japanese -- i think they could get around an english interface, but they'd still want to make games their friends could play).

edit: i'm still curious if there's someway to do "line_" + global('line') to get line_1, etc. using text as an output (after unsuccessful tests calling .ini items):

"line_" + global('line') -- this produces "line_"
global('line') + "test" -- this produces only the number from the 'line' variable - eg "1"
"line_" + global('line') + "test" -- this produces "line_test" (ignoring the 'line' variable)

[quote:2bc1zjda]also, in order to allow you to click a button and go to the "next" line, i had to name the items plain numbers (1, 2, 3, etc) and set text as INI.ItemString("dialog1", global('line')). originally i had them named "line_1" etc, and tried to set text as INI.ItemString("dialog1", "line_"global('line')) -- is there a way to do that (to have a mix between text in quotes and calling a value)?

it'd be useful for things like "there are # balls in view" without having to use more than one text object.[/quote:2bc1zjda]
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Sun Oct 05, 2008 4:28 am

Use & for string concatenation. + is for addition.

Eg. "There are " & Balls.Count & " balls in play"
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,298

Post » Sun Oct 05, 2008 8:52 pm

just realized the inability to display japanese characters also rules out my idea to create a flash card application in construct to help my studies (i'd release it to the public, too) :(

it'd be too much work to use images for all that
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Sun Oct 05, 2008 9:56 pm

I actually needed japanese symbols for something and I ended up using a font of characters. I had to match them up myself, but it beat drawing them all out.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Mon Oct 06, 2008 5:37 am

[quote="dfyb":1hked6q6]just realized the inability to display japanese characters also rules out my idea to create a flash card application in construct to help my studies (i'd release it to the public, too) :(

it'd be too much work to use images for all that[/quote:1hked6q6]

Fortunately, there is alternatives :D [url:1hked6q6]http://www.mnemosyne-proj.org/[/url:1hked6q6] [url:1hked6q6]http://ichi2.net/anki/[/url:1hked6q6]

Utf-8 support would be much appreciated, though! (I study Japanese too, btw. Actually... Japanese is my main subject. I'm going to be a translator.)
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests