Skip to content

Adding critical messages to the main menu using QModServices

AlexejheroYTB edited this page Aug 15, 2020 · 3 revisions

If you need to show some critical message from your mod to the player, you can use AddCriticalMessage method from QModServices under the QModManager.API namespace.

/// <summary>
/// Adds a critical message to the main menu.
/// Message will stay in the main menu and on the loading screen.
/// </summary>
/// <param name="msg">The message to add.</param>
/// <param name="size">The size of the text.</param>
/// <param name="color">The color of the text.</param>
/// <param name="autoformat">Whether or not to apply formatting tags to the message, or show it as it is.</param>
    void AddCriticalMessage(string msg,
                            int size = MainMenuMessages.defaultSize,
                            string color = MainMenuMessages.defaultColor,
                            bool autoformat = true);

Added messages will stay in the main menu and on the loading screen to minimize the chance that player will miss them.

Example:

using QModManager.API;

// ...

QModServices.Main.AddCriticalMessage("Something serious has happened !");

main_menu

  翻译: