Difference between revisions of "SetLang (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m (Text replacement - "wikitable" to "ts")
Line 1: Line 1:
{| class="wikitable" style="width:100%"
+
{| class="ts" style="width:100%"
 
|-
 
|-
 
! 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
Line 28: Line 28:
  
 
== Syntax Breakdown ==
 
== Syntax Breakdown ==
{| class="wikitable" style="width:100%"
+
{| class="ts" style="width:100%"
 
|-
 
|-
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description

Revision as of 19:22, 19 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.