Alternative print syntax (ACS) - DavidPH/GDCC GitHub Wiki
GDCC, in addition to the standard ACS print format syntax, has a syntax similar to C's printf
with a format string.
Here's an example:
Script "test" ENTER
{
// Output: 10 + 5 is equal to 15
Print("10 + 5 is equal to %i:.", 10 + 5);
}
The first parameter is a string literal (and a string literal only, a variable isn't allowed). Inside the string, a sequence like %*:
where *
is any of the standard ACS print specifiers (like i
/d
for int, s
for a string, etc.), works the same as an ACS print specifier. Any other character(s) in between are treated as a character (or string) to print.
This works on any function taking a print sequence like Print
. For example, ZDoom's Log
, PrintBold
, HudMessage
.
Script "test" ENTER
{
int a = 512;
// Output: A is equal to 512!
HudMessage("A is equal to %i:!", a; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 0.5, 0.5, 0.0);
}