Difference between revisions of "Sprint"
(Added note about scr_maxlines affecting max calls per frame/tic) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Sprint is a quake-c engine function that prints text to a specific entity. Most often it is used by the default game code to print text to the player or to players connected to a multiplayer game. In contrast to [[centerprint]], sprint prints text in the upper left-hand corner of the screen. | Sprint is a quake-c engine function that [[Quake-c printing function|prints text]] to a specific entity. Most often it is used by the default game code to print text to the player or to players connected to a multiplayer game. In contrast to [[centerprint]], sprint prints text in the upper left-hand corner of the screen. | ||
In the 2021 release the output of sprint is mirrored in the console log file | In the 2021 release the output of sprint is mirrored in the console log file | ||
Line 6: | Line 6: | ||
void(entity client, string s) sprint = #24; | void(entity client, string s) sprint = #24; | ||
== Notes == | |||
On a locally hosted game sprint seems to be able to react to 4 calls per 'frame' per entity(?) - meaning that if you call sprint more than 4 times in a row some of the text will probably disappear or otherwise not make it to the screen. Note that this has nothing to do how much text is shown, only the number of function calls. Increasing the [[Cvars|cvar]] <code>scr_maxlines</code> (defaults to 4, max of 20) seems to increase this limit. | On a locally hosted game sprint seems to be able to react to 4 calls per 'frame' per entity(?) - meaning that if you call sprint more than 4 times in a row some of the text will probably disappear or otherwise not make it to the screen. Note that this has nothing to do how much text is shown, only the number of function calls. Increasing the [[Cvars|cvar]] <code>scr_maxlines</code> (defaults to 4, max of 20) seems to increase this limit. | ||
=== Related functions | 'sprint' will fail if it is called with a string parameter of longer than 2047 characters. | ||
== Writebyte equivalent == | |||
<code>msg_entity = self.owner;</code> | |||
<code>WriteByte( MSG_ONE, SVC_PRINT );</code> | |||
<code>WriteShort( MSG_ONE, 1 );</code> | |||
<code>WriteString( MSG_ONE, "hello world!\n" );</code> | |||
==Related functions== | |||
[[centerprint]] | [[centerprint]] | ||
Latest revision as of 07:51, 17 February 2022
Sprint is a quake-c engine function that prints text to a specific entity. Most often it is used by the default game code to print text to the player or to players connected to a multiplayer game. In contrast to centerprint, sprint prints text in the upper left-hand corner of the screen.
In the 2021 release the output of sprint is mirrored in the console log file
Defs.qc Declaration[edit | edit source]
void(entity client, string s) sprint = #24;
Notes[edit | edit source]
On a locally hosted game sprint seems to be able to react to 4 calls per 'frame' per entity(?) - meaning that if you call sprint more than 4 times in a row some of the text will probably disappear or otherwise not make it to the screen. Note that this has nothing to do how much text is shown, only the number of function calls. Increasing the cvar scr_maxlines
(defaults to 4, max of 20) seems to increase this limit.
'sprint' will fail if it is called with a string parameter of longer than 2047 characters.
Writebyte equivalent[edit | edit source]
msg_entity = self.owner;
WriteByte( MSG_ONE, SVC_PRINT );
WriteShort( MSG_ONE, 1 );
WriteString( MSG_ONE, "hello world!\n" );