Page 1 of 1

Build a String variable with GetLocalizedText and LocalizedTextTable

Posted: Thu May 31, 2018 6:13 pm
by Alatriste
Hi Tony,

I'm trying to create a string using 3 variables to show an alert with the following messsage: "Item Achieved: Perfume"
To do so, I'm using
Variable["Alert"] = GetLocalizedText("Item","room001_perfume", "DisplayedName")
The problem is that I don't know how to fit the LocalizedTextTable command to display the "Item Achieved:" string that I already set in the Localized Text object. So far I only managed to display the "Perfume" string in the alert message.

Any help? :roll:

Re: Build a String variable with GetLocalizedText and LocalizedTextTable

Posted: Thu May 31, 2018 10:39 pm
by Tony Li
Hi,

To combine two strings, use "..":

Code: Select all

Variable["Alert"] = "Item Achieved: " .. GetLocalizedText("Item","room001_perfume", "DisplayedName")
Unfortunately this will show "Item Achieved:" in English. To avoid scripting, one solution is to define an "item" that contains custom fields for special phrases such as "Item Achieved". Let's say your item is called "Phrases", and it has a custom field named "ItemAchieved" with localized versions. Then use this:

Code: Select all

Variable["Alert"] = GetLocalizedText("Item","Phrases","ItemAchieved") .. ": " .. GetLocalizedText("Item","room001_perfume", "DisplayedName")

Re: Build a String variable with GetLocalizedText and LocalizedTextTable

Posted: Fri Jun 01, 2018 6:03 am
by Alatriste
Good idea! I managed to make this work in a previous project through PlayMaker, but I was wondering if it would be possible to replicate the same effect without scripting, which so far seems to be possible. :)

Thanks Tony!