Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "bprint"

From Quake Wiki

 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
====Syntax:====
+
''void'' '''bprint'''(''string'' msg)
<code>void bprint(string s)</code>
 
  
Broadcasts text to all players in the map. This is used for player join/leave messages and obituaries.
+
== Usage ==
====Parameters:====
+
Broadcasts a message to all players in the game. Messages will continue to print on the same line until a '''\n''' character is placed, allowing chaining of calls to print to the same line.
:<code>s</code> - The string to print.
 
====Returns:====
 
:void
 
  
 +
This builtin has special functionality in that it can accept an unlimited number of string arguments (with a cap of 255 characters in a string). Multiple versions of the builtin can be assigned to the same index with as many additional string arguments as needed e.g.
 +
    void bprint3(string start, string middle, string end) = #23;
 +
This can allow for easily inserting numbers into the middle of the string since normally this would require a chain of multiple calls to do.
 +
bprint3("There are ", ftos(self.count), " switches remaining\n");
 +
will display as "There are 4 switches remaining" if <code>self.count</code> is 4.
 +
 +
=== Parameters ===
 +
*''msg''
 +
:The message to display.
 +
 +
== Example ==
 +
// Print an obituary after a player dies
 +
bprint(player.netname);
 +
bprint(" saw an untimely demise\n");
  
 
[[Category:QuakeC Function]]
 
[[Category:QuakeC Function]]

Latest revision as of 16:01, 31 July 2023

void bprint(string msg)

Usage[edit]

Broadcasts a message to all players in the game. Messages will continue to print on the same line until a \n character is placed, allowing chaining of calls to print to the same line.

This builtin has special functionality in that it can accept an unlimited number of string arguments (with a cap of 255 characters in a string). Multiple versions of the builtin can be assigned to the same index with as many additional string arguments as needed e.g.

    void bprint3(string start, string middle, string end) = #23;

This can allow for easily inserting numbers into the middle of the string since normally this would require a chain of multiple calls to do.

bprint3("There are ", ftos(self.count), " switches remaining\n");

will display as "There are 4 switches remaining" if self.count is 4.

Parameters[edit]

  • msg
The message to display.

Example[edit]

// Print an obituary after a player dies
bprint(player.netname);
bprint(" saw an untimely demise\n");