Difference between revisions of "SetLang (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
Line 10: Line 10:
 
== Instructions ==
 
== Instructions ==
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
2. You should edit the txtLang table to reflect your available in game languages. ''Names are case sensitive''.
+
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>

Revision as of 19:45, 14 August 2014

Name Type By
setLang("spk", "txt") Definition AFRLme

This small function allows you to quickly set the spoken language & subtitle language. This function is only valid from Visionaire Studio 4.0 beta onwards.

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("en", "de") -- set spoken language to English & subtitle language to German

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(spk, txt)
 game:setValue( VGameStandardLanguage, getObject("Languages[" .. txtLang[txt] .. "]") )
 game:setValue( VGameSpeechLanguage, getObject("Languages[" .. txtLang[spk] .. "]") )
end

Syntax Breakdown

Name Type Description
spk "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.
txt "string" This should be a "string" value containing the 2 letter prefix you added to the txtLang table of the subtitle language you want to set.