Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "ftos"
From Quake Wiki
(Created page with "====Syntax:==== <code>string ftos(float f)</code> Converts a float into a string to allow it to be printed to the console or displayed in a centerprint. ====Parameters:==== :...") |
|||
Line 1: | Line 1: | ||
− | + | ''string'' '''ftos'''(''float'' value) | |
− | |||
− | + | == Usage == | |
− | + | Converts a float to a string. Mainly used for printing messages. | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | '''Warning:''' This does not return a unique string but a string shared across all instances of <code>ftos()</code>. Calling it again will change all currently stored references to the latest one. Storing the result has little value and it should only be called once per print function call. | ||
+ | |||
+ | === Parameters === | ||
+ | *''value'' | ||
+ | :The float to turn into a string. | ||
+ | |||
+ | === Return === | ||
+ | The passed float as a string. | ||
+ | |||
+ | == Example == | ||
+ | // Print the amount of ammo the player picked up | ||
+ | sprint(other, "Picked up "); | ||
+ | sprint(other, ftos(self.aflag)); | ||
+ | sprint(other, " shells\n"); | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Latest revision as of 18:29, 31 July 2023
string ftos(float value)
Contents
Usage[edit]
Converts a float to a string. Mainly used for printing messages.
Warning: This does not return a unique string but a string shared across all instances of ftos()
. Calling it again will change all currently stored references to the latest one. Storing the result has little value and it should only be called once per print function call.
Parameters[edit]
- value
- The float to turn into a string.
Return[edit]
The passed float as a string.
Example[edit]
// Print the amount of ammo the player picked up sprint(other, "Picked up "); sprint(other, ftos(self.aflag)); sprint(other, " shells\n");