Page 1 of 1

[scripting] game language

Posted: Fri Oct 09, 2015 5:58 am
by Anakin
Hi,

does anyone know if there is a way to get the game language that is used with an lua script?? In my case I want to load different sound files belong to the language selected in the game settings. That way I want German and English voice streams.

Thank you for your help

Re: [scripting] game language

Posted: Fri Oct 09, 2015 6:21 am
by Marth8880
I doubt it. Any that exist are probably only usable within C.

You should try looking around in the shell scripts, though. You might find something there.

By the way, are you talking about using custom multi-language streams, or the stock ones?

Re: [scripting] game language

Posted: Fri Oct 09, 2015 6:27 am
by Anakin
Custom. You know I have these German grenade warnings and fallback screams used in RC. Many complained about it and wanted English streams. So I wanted to make the mod take the German if you have German settings and English for the others. I could tell everyone in the readme to manual swap the files, but i'm a fan of automatic things :D
My problem is that the grenade warnings are sound effects (fire sound) and not voice streams. I'm sure that Lucas Arts has a solution for the voices, because they had the same problem for campaign for example. But these are voice streams and not sound effects.

Re: [scripting] game language

Posted: Thu Oct 22, 2015 2:06 am
by [RDH]Zerted
Try: ScriptCB_GetLanguage()

Examples from the retail scripts:

Code: Select all

gLangStr,gLangEnum = ScriptCB_GetLanguage()
local CurLang = ScriptCB_GetLanguage()
local langStr, langIndex = ScriptCB_GetLanguage()
if((gPlatformStr ~= "PS2") and (ScriptCB_GetLanguage() ~= "english") and (this.iOnPage == 0)) then
Here's all the lines with "gLang":

Code: Select all

3594:-- 	elseif (gLangStr == "italian") then
3616:-- 	if(gLangStr == "german") then
27688:elseif (gLangStr == "french") then
27689:elseif (gLangStr == "spanish") then
31315:gLangStr,gLangEnum = ScriptCB_GetLanguage()
31397:gMovieStream = shellMovie[gLangStr] or shellMovie["english"]
32043:if ( gLangStr == "english" or gLangStr == "uk_english" ) then
32044:if ( gLangStr ~= "english" and gLangStr ~= "uk_english" ) then
32242:if (gLangStr == "french") then
33451:if((gLangStr == "english") or (gLangStr == "uk_english")) then
33452:if((gLangStr ~= "english") and (gLangStr ~= "uk_english")) then
33453:if((gLangStr ~= "english") and (gPlatformStr == "PS2")) then
33454:if((gLangStr ~= "english") and (gPlatformStr ~= "PC")) then
33470:if((gPlatformStr == "PS2") and (gLangStr == "german")) then
33630:if(1) then -- (gLangStr ~= "english") and (gLangStr ~= "uk_english")) then
34104:if(gLangStr == "english") then
34105:if(gLangStr == "german") then
34106:if(gLangStr == "spanish") then
34107:if(gLangStr ~= "english") then
39047:local bNeedToShrink = ((gLangStr ~= "english") and (gLangStr ~= "uk_english"))
39604:local langShort = strlower(string.sub(gLangStr, 1, 3))
39719:local movie_file = movie_files[gLangStr] or movie_files.english