Qsprintf: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Hendricks266 (talk | contribs) No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''qsprintf''' < | '''qsprintf''' <destination quote> <source quote> <parameter 1> [parameter 2] [parameter 3] ... [parameter 32] | ||
Copies the text of < | 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. | 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. | ||
Line 8: | Line 8: | ||
gamevar TEMP 0 1 | gamevar TEMP 0 1 | ||
definequote 254 PLACEHOLDER | definequote 254 PLACEHOLDER | ||
definequote 7 WASTED! | |||
definequote 12 USED STEROIDS | |||
onevent EVENT_DISPLAYREST | onevent EVENT_DISPLAYREST | ||
getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has | getplayer[THISACTOR].actors_killed TEMP // Get the number of kills the player has | ||
redefinequote 254 ALIENS KILLED: % | redefinequote 254 ALIENS KILLED: %d // Redefine a placeholder quote | ||
'''qsprintf''' 254 254 TEMP // Place our variable into the % | '''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! | 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 | endevent | ||
Latest revision as of 21:49, 12 August 2011
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