Skip to content

Pluralize function for "DrawString" margin commands in SCORINFO

It's not possible to dynamically pluralize strings created in DrawString margin commands with this new function! This is especially useful for the "Entering MAPXX: {mapname} in x second(s)" line that's in the main header on the scoreboard. Here is an example of how it works:

IfIntermission( true ) && IfOnlineGame( true ) && IfCVar( cl_intermissiontimer == true )
{
	DrawString( value = pluralize( "There {is/are} # second{s} left until we enter ", intermissiontimeleft ) + nextlevellump + ": " + nextlevelname, textcolor = "Green" )
}

Braces (which are uncommon characters in normal sentences) are reserved to indicate which parts of the sentence contain the singular/plural phrases. The '/' between the braces is optional, but there are the rules:

  1. If there's no slash, then text that's inside the braces is always for plural and will only appear when the special value isn't equal to 1 (e.g. "second{s}").

2a. If there's a slash, then text to the left of it is used for singular, while text to the right is used for plural.

2b. There must only be one slash.

The '#' is reserved for the special value itself, but if this appears between braces, then it's left unformatted. Supported special values include: cvar, intermissiontimeleft, totalplayers, playersingame, teamplayercount, teamliveplayercount, teamfragcount, teampointcount, teamwincount, teamdeathcount, and spectatorcount. Anything else is unacceptable and will throw a fatal error.

Edited by Adam Kaminski

Merge request reports