Structs:Console

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


The Console struct holds functions that mostly deal with printing text strings on the screen and to the console.

Methods

All of these methods are static and can be called by prefixing them with Console.:

  • void HideConsole()
Hides the console.
  • vararg void Printf(string fmt, ...)
Prints text on the screen and in the console, similarly to A_Log. Has string formatting built in, like String.Format, so values can be passed after the first argument.
  • vararg void PrintfEx(int printlevel, string fmt, ...)
Extended version of Printf that can modify the visibility of the message with the printlevel argument. Possible values for this argument are:
  • PRINT_LOW — pickup messages
  • PRINT_MEDIUM — death messages
  • PRINT_HIGH — critical messages
  • PRINT_CHAT — chat messages
  • PRINT_TEAMCHAT — chat messages from a teammate
  • PRINT_LOG — only to logfile
  • PRINT_BOLD — a global message, such as printed with A_PrintBold
  • PRINT_TYPES — bitmask (Need more info)
  • PRINT_NONOTIFY — do not add to notify buffer; this means the message will not be printed to the console
  • PRINT_NOLOG — do not save to logfile
Note: logfile can be created by launching GZDoom with the -logfile mylogfile.txt command line parameter. This will write console log into a txt file of your choice (the file will be overwritten on every launch).
  • vararg void DebugPrintf(int debuglevel, string fmt, ...) (New from 4.13.0)
Extended version of Printf used for printing developer messages. The debuglevel argument can be used to set at what developer level the message prints. Possible values for this argument are:
  • DMSG_OFF — Print even developer messages are turned off.
  • DMSG_ERROR — Print if the game is printing only error messages (developer = 1)
  • DMSG_WARNING — Print if the game is printing warnings and higher (developer = 2)
  • DMSG_NOTIFY — Print if the game is printing notifications and higher (developer = 3)
  • DMSG_SPAMMY — Print if the game is printing any and all debug messages (developer = 4)
  • void MidPrint(Font fontname, string textlabel, bool bold = false)
Prints text to the console and in the middle of the screen, as opposed to the top left corner. Allows specifying a font, and optionally process the message as bold. In contrast to Printf and PrintfEx, does not have string formatting built in, so String.Format is required to print a formatted string.