Difference between revisions of "SetLang (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ||
|- | |- | ||
− | | setLang(" | + | | setLang("txt", "vox") || Definition || AFRLme |
|} | |} | ||
Line 12: | Line 12: | ||
2. You should edit the '''txtLang''' table to reflect your available in game languages. ''Names are case sensitive''.<br/> | 2. You should edit the '''txtLang''' table to reflect your available in game languages. ''Names are case sensitive''.<br/> | ||
3. To use this function you should create an ''execute a script'' action containing... | 3. To use this function you should create an ''execute a script'' action containing... | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
− | setLang("de", "en") -- set | + | setLang("de", "en") -- set text language to German & spoken language to English |
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 22:54, 20 August 2022
Name | Type | By |
---|---|---|
setLang("txt", "vox") | Definition | AFRLme |
This small function allows you to quickly set the text & voice output languages.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. You should edit the txtLang table to reflect your available in game languages. Names are case sensitive.
3. To use this function you should create an execute a script action containing...
setLang("de", "en") -- set text language to German & spoken language to English
Main Script
-- * table containing the available game languages with 2 letter prefix for table names * --
local txtLang = {en = "English", de = "German", fr = "French"}
function setLang(txt, vox)
if vox == nil then vox = txt end -- fallback in case vox equals nil
-- + --
game.StandardLanguage = Languages[ txtLang[txt] ] -- update text language
game.SpeechLanguage = Languages[ txtLang[vox] ] -- update speech language
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
txt | "string" | This should be a "string" value containing the 2 letter prefix you added to the txtLang table of the text language you want to set. |
vox | "string" | This should be a "string" value containing the 2 letter prefix you added to the txtLang table of the spoken language you want to set. |