GoldenEye: Source Forums

Editing and Customization => Modding Help => Topic started by: Joe on April 08, 2014, 10:14:39 pm

Title: Concatenating a translation string with another string
Post by: Joe on April 08, 2014, 10:14:39 pm
Hi,

In the soon to be released new version of my GE:S mode (Die Another Day) a HUD progress message will show eliminated players their resurrection queue position instead of this message being rendered by the GEUtil.HudMessage() function.

I don't want to use the "show value" flag because I don't want a max value to be shown so I instead want to use the "only show title" flag.

I've not been able to concatenate the position value with this message's title:

Code: [Select]
            label = "#GES_GP_DAD_RESURRECTION_QUEUE_POSITION"
            position = str(resQueue.index(player) + 1)
           
            GEUtil.InitHudProgressBar(player,
                                      DieAnotherDay.resQueueMessageChannel,
                                      title=label + position, 
                                      flags=GEGlobal.HUDPB_TITLEONLY, x=-1, y=0.75,
                                      color=DieAnotherDay.RQPositionColour)

Instead of displaying "Your resurrection queue position is: 1",  "#GES_GP_DAD_RESURRECTION_QUEUE_POSITION1" is displayed.
Title: Re: Concatenating a translation string with another string
Post by: killermonkey on April 08, 2014, 11:29:04 pm
You need to use the "advanced localization" that we introduced to fix this problem.

"#GES_GP_DAD_RESURRECTION_QUEUE_POSITION\r1"

the \r is a "line break" character that separates the localization string from the data to be inserted.

Alternatively you can use the helper function:

Code: [Select]
from Utils import _

localizer = _("#GES_GP_DAD_RESURRECTION_QUEUE_POSITION", 1)
Title: Re: Concatenating a translation string with another string
Post by: Joe on April 09, 2014, 01:41:20 pm
Thanks KillerMonkey