Qsprintf: Difference between revisions
Jump to navigation
Jump to search
New page: qsprintf <quote1> <quote2> <gamevar> <gamevar> ... Copies the text of <quote2> to <quote1>, replacing all variable placeholders %ld with their gamevar values in relative order. [[Categor... |
No edit summary |
||
Line 2: | Line 2: | ||
Copies the text of <quote2> to <quote1>, replacing all variable placeholders %ld with their gamevar values in relative order. | Copies the text of <quote2> to <quote1>, replacing all variable placeholders %ld with their gamevar values in relative order. | ||
An example: | |||
<pre> | |||
gamevar TEMP 0 1 | |||
definequote 254 PLACEHOLDER | |||
definequote 255 PLACEHOLDER | |||
onevent EVENT_DISPLAYREST | |||
getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has | |||
redefinequote 255 ALIENS KILLED: %ld // Redefine a placeholder quote | |||
qsprintf 254 255 TEMP // Place our variable into the %ld string | |||
gametext STARTALPHANUM 10 10 254 0 0 ZERO ZERO xdim ydim // And print to the upper left! | |||
endevent | |||
</pre> | |||
[[Category:EDuke32 specific commands]] | [[Category:EDuke32 specific commands]] | ||
[[Category:String manipulation]] | [[Category:String manipulation]] |
Revision as of 19:31, 19 June 2007
qsprintf <quote1> <quote2> <gamevar> <gamevar> ...
Copies the text of <quote2> to <quote1>, replacing all variable placeholders %ld with their gamevar values in relative order.
An example:
gamevar TEMP 0 1 definequote 254 PLACEHOLDER definequote 255 PLACEHOLDER onevent EVENT_DISPLAYREST getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has redefinequote 255 ALIENS KILLED: %ld // Redefine a placeholder quote qsprintf 254 255 TEMP // Place our variable into the %ld string gametext STARTALPHANUM 10 10 254 0 0 ZERO ZERO xdim ydim // And print to the upper left! endevent