Page 1 of 1

Have a variable appear in a localization key

Posted: Thu Jul 10, 2014 11:18 am
by Noobasaurus
I have a variable that I want to appear in a string as a message to a player. I know that I can have variables in print messages, but I need one that appears to the player. Is there any way to do this?

Re: Have a variable appear in a localization string

Posted: Thu Jul 10, 2014 11:38 am
by GAB
I'm not sure if I understand well what you want, but I know that the script for the Felucia campaign, has a sort of variable localization string stuff. Maybe it would help you:
Hidden/Spoiler:
[code] --Setup callback to show update messages when turrets are killed
turret_count = 5
TurretKill = OnObjectKillClass(
function(object, killer)
if killer and IsCharacterHuman(killer) then
turret_count = turret_count - 1

if turret_count > 0 then
ShowMessageText("level.fel1.objectives.campaign.5a-" .. turret_count, 1)
end
end
end,
"tur_bldg_recoilless_fel_auto"
)
end[/code]

Re: Have a variable appear in a localization string

Posted: Thu Jul 10, 2014 11:41 am
by Marth8880
If you mean basically using anything *but* localization key with ShowMessageText, I'm almost positive you can't do that. :(

Re: Have a variable appear in a localization string

Posted: Thu Jul 10, 2014 11:43 am
by Noobasaurus
@GAB: Thanks. That's really close to what I want, but that sets it to a certain localization key. I want to modify the localization string with a variable.

@Marth: So I'll have to use a localization key then, but I need it to load a variable.