Chat Commands Manager
CLI library for Outward chat. Eliminates the need to build a separate UI to execute mod functions by providing an in-chat console.
模組介紹 作者原文
Outward Chat Commands Manager
CLI brought to Outward Chat
Deeper Explanation
CLI stands for Command Line Interface. This mod brings a CLI-like
experience to the in-game chat, allowing you to easily create and use commands
directly in chat.
Commands can be created through the Mods
Communicator without the need to build a custom UI. This provides fast and
convenient access to dynamic mod methods through chat commands.
The Chat Commands Manager includes command history and allows navigation using
the ArrowUp and ArrowDown keys. It also provides several
helper commands and the ability to bind recently used commands to hotkeys.
As a command manager, it allows inspection of all registered commands, including
the original Outward commands. The tool also supports creating cheat commands
and debug-mode–required commands. When cheat commands are used, the current
game session will be marked as unsavable, preventing progress from being
saved.
How to use it
Firstly, install [Mods
Communicator]( After that,
you can publish and subscribe to ChatCommandsManager events.
All events are registered and visible in Mods Communicator’s logging system.
However, it is still recommended to read the event descriptions below and
review the examples.
Built-in Commands
The most important commands are:
/commands, /help, and /history.
These commands provide essential information about available commands and their
usage.
For hotkey control, the following commands are available:
/lockKey and /releaseKey.
Use /help lockKey for detailed information about how to use these
commands.
Events
Publish
Mod Namespace: gymmed.chat_commands_manager_*
Add Command
Event Name: ChatCommandsManager@AddChatCommand
Accepts all command parameters data described in the Command Parameters section.
Example
This example shows a command registered during
ResourcesPrefabManager.Load. This is done for safety in case a soft
dependency is missing. Commands can be added or removed dynamically at any time.
using OutwardModsCommunicator;...
[HarmonyPatch(typeof(ResourcesPrefabManager), nameof(ResourcesPrefabManager.Load))]
public class ResourcesPrefabManager_Load
{
static void Postfix(ResourcesPrefabManager __instance)
{
Dictionary<string, (string, string)> myParameters = new()
{
{
"myParameter",
("parameterDescription", defaultValue)
}
};
Action<Character, Dictionary<string, string>> myFunction = MyCommandFunction;
var payload = new EventPayload
{
// command is a chat message trigger /myCommandName
["command"] = "myCommandName",
["parameters"] = myParameters,
["function"] = myFunction,
["description"] = "Your command description that will be seen through /help myCommandName."
};
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", payload);
}
}
public static void MyCommandFunction(Character characterSender, Dictionary<string, string> arguments)
{
ChatPanel panel = characterSender?.CharacterUI?.ChatPanel;
if(panel == null)
{
Plugin.LogMessage("MySuperFunction Tried to use missing chatPanel.");
return;
}
// send message to chat
panel.ChatMessageReceived("System", "<color=#9900cc>Your command was triggered!</color>");
// parameter value = argument
arguments.TryGetValue("myParameter", out string parameterValue);
if(string.IsNullOrWhiteSpace(parameterValue))
{...Your code when argument is missing.
return;
}...Your code when argument is provided.
}
Remove Command
Event Name: ChatCommandsManager@RemoveChatCommand
Accepts only the following parameter:
"command" — the name of the command to remove.
Example
using OutwardModsCommunicator;...
[HarmonyPatch(typeof(ResourcesPrefabManager), nameof(ResourcesPrefabManager.Load))]
public class ResourcesPrefabManager_Load
{
static void Postfix(ResourcesPrefabManager __instance)
{
var payload = new EventPayload
{
// command is a chat message trigger /myCommandName
["c
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: