SetLang (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 18:22, 19 August 2014 by David Stoffel (talk) (Text replacement - "wikitable" to "ts")
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.