Skip to content

Developer Wiki

Earu edited this page Sep 6, 2021 · 12 revisions

Introduction

Most of the EasyChat API can be found within the EasyChat global table that is available on both client and server realms. EasyChat also provides an API for its own markup parsing and drawing thats available from the ec_markup global table available on the client realm.

Functions

  • EasyChat.AddDeadTag(table msg_components) -> table [CL]
    • Adds a (DEAD) string to the table passed and returns said table. If no table is passed a new one is created.
  • EasyChat.AddTeamTag(table msg_components) -> table [CL]
    • Adds a (TEAM) string to the table passed and returns said table. If no table is passed a new one is created.
  • EasyChat.AddLocalTag(table msg_components) -> table [CL]
    • Adds a (LOCAL) string to the table passed and returns said table. If no table is passed a new one is created.
  • EasyChat.AddNameTags(Player ply, table msg_components) -> table [CL]
    • Adds team name and team color to the table passed depending on the local user settings and return said table. If no table is passed a new one is created.
  • EasyChat.AddText(Panel richtext, varargs ...) -> void [CL]
    • Similar to chat.AddText but for richtext panels, it uses the local user settings and EasyChat features.
  • EasyChat.AddMode(String mode_name, function(String text) callback) -> void [CL]
    • Adds a new typing mode that will use the callback passed when used.
  • EasyChat.AddTab(String tab_name, Panel tab_panel, String? icon_path) -> void [CL]
    • Adds a new tab to the chatbox using the name and panel passed.

WIP

Hooks

Here's the list of hooks EasyChat runs.

Shared

  • ECInitialized: Ran when everything has initialized.

    • () -> void
  • ECDestroyed: Ran when EasyChat gets destroyed (when disabled or reloaded).

    • () -> void
  • ECOpened: Ran when a player (always LocalPlayer() on client) opens the chatbox.

    • (Player ply) -> void
  • ECClosed: Ran when a player (always LocalPlayer() on client) closes the chatbox.

    • (Player ply) -> void
  • ECPreLoadModules: Ran before EasyChat modules.

    • () -> void
  • ECPostLoadModules: Ran after EasyChat modules.

    • () -> void
  • ECPreDestroy: Ran before EasyChat gets cleared for reload or other reasons.

    • () -> void
  • ECPostDestroy: Ran after EasyChat has been cleared for reload or other reasons.

    • () -> void
  • ECPostInitialized: Ran after EasyChat is done initializing for the first time (NOT A RELOAD).

    • () -> void

Client

  • ECOpenURL: Ran when the local player opens an URL via the chatbox. Returning false will prevent the player from opening the URL.

    • (string URL) -> boolean
  • ECShouldOpen: Ran before the chatbox opens it passes the mode in which it was opened (secondary or normal) and the requested EasyChat mode if its opened in secondary mode. Return false to prevent the chatbox from opening.

    • (boolean is_secondary, number? requested_mode) -> boolean
  • ECSecondaryOpen: Ran when the chat is opened in secondary mode, passes the name of which EasyChat mode will be used. Return true to notify EasyChat that you have handled this hook.

    • (string mode_name) -> boolean
  • ECTabChanged: Ran when the active tab changes in the chat, passes the previous active tab name and the current active tab name.

    • (string old_tab_name, string new_tab_name) -> void
  • ECShouldSendMessage: Ran when the local player wants to send a message from the chat. Return false to block the message from being sent.

    • (string msg) -> boolean
  • ECSettingsOpened: Ran when the chat settings are opened.

    • () -> void
  • ECHUDBoundsUpdate: Ran every time the chat hud bounds update, passes x, y, width, height of the hud. Return new bounds to change the position of the chat hud.

    • (number x, number y, number w, number h) -> number, number, number, number
  • ECHUDFontChanged: Ran when the local player changes the chat hud font, passes the font data.

    • (table font_data) -> void
  • ECMacroRegistered: Ran when a macro is registered, passes the macro name and its data.

    • (string macro_name, table macro) -> void
  • ECMacroDeleted: Ran when a macro is deleted, passes the macro name.

    • (string macro_name) -> void
Clone this wiki locally