Qsprintf

From EDukeWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

qsprintf <destination quote> <source quote> <parameter 1> [parameter 2] [parameter 3] ... [parameter 32]

Copies the text of <source quote> to <destination quote>, replacing in order each instance of %d (%ld works too) with a gamevar passed in its parameter position, and each instance of %s with a quote in its parameter position.

You can use a single quote for both placeholders. Also, you can use a single quote to display many different texts at the same time, since using qsprintf in a quote doesn't alter the text displayed by a gametext command used before with that quote.


gamevar TEMP 0 1
definequote 254 PLACEHOLDER
definequote  7 WASTED!
definequote 12 USED STEROIDS 

onevent EVENT_DISPLAYREST
getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has

redefinequote 254 ALIENS KILLED: %d    // Redefine a placeholder quote
qsprintf 254 254 TEMP                   // Place our variable into the %d string
gametext STARTALPHANUM 10 10 254 0 0 0 ZERO ZERO xdim ydim // And print to the upper left!

redefinequote 254 %s! %s
qsprintf 254 254 12 7
quote 254 // print: "USED STEROIDS! WASTED!"

endevent