Autonauts Modding
ModText Class Reference

Public Member Functions

string GetLanguage ()
 
string GetText (string TextID, bool ModText=true)
 
void SetText (string TextID, string Text, bool ModText=true)
 
void SetDescription (string UniqueName, string Description)
 

Member Function Documentation

◆ GetLanguage()

string ModText.GetLanguage ( )

Get the current language

Version
137.14.11
Returns
string - Language:
  • English
  • German
  • French
  • Russian
  • ChineseSimplified
  • JapaneseKana
  • BrazilianPortugeuse
  • Spanish
  • Polish
  • Korean
  • Turkish
Example
Lang = ModText.GetLanguage()
Note
Can be used in functions: Creation(), BeforeLoad(), AfterLoad(), AfterLoad_CreatedWorld(), AfterLoad_LoadedWorld(), AfterSave(), OnUpdate()

◆ GetText()

string ModText.GetText ( string  TextID,
bool  ModText = true 
)

Get a text string by ID

Version
137.14.11
Parameters
TextID- string - The identifier for text string
Returns
string
Example
FolkString = ModText.GetText("Folk", false)
Note
Can be used in functions: BeforeLoad(), AfterLoad(), AfterLoad_CreatedWorld(), AfterLoad_LoadedWorld(), AfterSave(), OnUpdate()

◆ SetDescription()

void ModText.SetDescription ( string  UniqueName,
string  Description 
)

Sets rollover description of a mod object

Version
137.14.11
Parameters
UniqueName- string - The unique name of the mod
Description- string - The new text string value
Returns
None
Example
ModText.SetDescription("Pirate", "A scurvy dog")
Note
Can be used in functions: BeforeLoad(), AfterLoad(), AfterLoad_CreatedWorld(), AfterLoad_LoadedWorld(), AfterSave(), OnUpdate()

◆ SetText()

void ModText.SetText ( string  TextID,
string  Text,
bool  ModText = true 
)

Set a text string by ID

Version
137.14.11
Parameters
TextID- string - The identifier for text string, TextID for a mod object is the unique name
Text- string - The new text string value
Boolean- True if setting text for a mod object, false if changing a game text - Defaults to true
Returns
None
Example
PirateTranslations = {}
PirateTranslations["German"] = "Pirat"
PirateTranslations["Korean"] = "해적"
PirateTranslations["ChineseSimplified"] = "海盗"
function Creation()
ModGoTo.CreateGoTo("Pirate", null, null, "PirateModel", false)
end
function BeforeLoad()
Lang = ModText.GetLanguage()
if PirateTranslations[Lang] ~= nil then
ModText.SetText("Pirate", PirateTranslations[Lang])
end
end
Note
Can be used in functions: BeforeLoad(), AfterLoad(), AfterLoad_CreatedWorld(), AfterLoad_LoadedWorld(), AfterSave(), OnUpdate()

The documentation for this class was generated from the following file: