Build a String variable with GetLocalizedText and LocalizedTextTable

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Alatriste
Posts: 181
Joined: Wed Nov 11, 2015 5:07 pm
Contact:

Build a String variable with GetLocalizedText and LocalizedTextTable

Post 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:
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Build a String variable with GetLocalizedText and LocalizedTextTable

Post 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")
User avatar
Alatriste
Posts: 181
Joined: Wed Nov 11, 2015 5:07 pm
Contact:

Re: Build a String variable with GetLocalizedText and LocalizedTextTable

Post 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!
Post Reply