Interface UserInterface

User Interface API.

interface UserInterface {
    clearTerminal(): void;
    getGameInfo(): GameInfo;
    getStyles(): IStyleSettings;
    getTheme(): UserInterfaceTheme;
    resetStyles(): void;
    resetTheme(): void;
    setStyles(newStyles): void;
    setTheme(newTheme): void;
    windowSize(): [number, number];
}

Methods

  • Clear the Terminal window, as if the player ran clear in the terminal

    Returns void

    Remarks

    RAM cost: 0.2 GB

  • Sets the current styles

    Parameters

    Returns void

    Remarks

    RAM cost: 0 GB

    Example

    Usage example (NS2)

    const styles = ns.ui.getStyles();
    styles.fontFamily = 'Comic Sans Ms';
    ns.ui.setStyles(styles);
  • Sets the current theme

    Parameters

    Returns void

    Remarks

    RAM cost: 0 GB

    Example

    Usage example (NS2)

    const theme = ns.ui.getTheme();
    theme.primary = '#ff5500';
    ns.ui.setTheme(theme);
  • Get the current window size

    Returns [number, number]

    An array of 2 value containing the window width and height.

    Remarks

    RAM cost: 0 GB