Commands & Emotes
Built-in Commands
| Command | Syntax | Description |
|---|---|---|
/me | /me bows respectfully | Third-person emote action |
/w | /w PlayerName message | Direct message (whisper) |
Custom Commands
Register custom slash commands with typed arguments:
UERPChatSubsystem* ChatSub = GetGameInstance()->GetSubsystem<UERPChatSubsystem>();
FERPChatCommand GiveXP;
GiveXP.Command = TEXT("givexp");
GiveXP.Description = FText::FromString("Grant XP to a player");
GiveXP.RequiredRole = ERPPlayerRoleEnum::GameMaster;
// Add typed arguments
FERPCommandArgument PlayerArg;
PlayerArg.Name = TEXT("player");
PlayerArg.Type = ERPArgTypeEnum::PlayerName; // Auto-complete with online players
PlayerArg.bRequired = true;
GiveXP.Arguments.Add(PlayerArg);
FERPCommandArgument AmountArg;
AmountArg.Name = TEXT("amount");
AmountArg.Type = ERPArgTypeEnum::Integer;
AmountArg.bRequired = true;
GiveXP.Arguments.Add(AmountArg);
ChatSub->RegisterCommand(GiveXP);
Argument Types
| Type | Autocomplete |
|---|---|
PlayerName | Online player names |
ChannelId | Available channels |
LanguageId | Available languages |
ItemName | Custom resolver (register via RegisterArgumentResolver) |
Integer | None |
Float | None |
FreeText | None |
Handling Custom Commands
ChatSub->OnCustomCommandExecuted.AddDynamic(this, &AMyGM::OnCommand);
void AMyGM::OnCommand(const FString& CommandName, const TArray<FString>& Args, APlayerState* Sender)
{
if (CommandName == TEXT("givexp"))
{
// Args[0] = player name, Args[1] = amount
}
}
Inline Emotes
Wrap action text in configurable delimiters (default *...*):
I whisper: *leans in close* Can you hear me?
Produces two segments:
- Say: "I whisper: "
- Emote: "leans in close" (never language-corrupted, styled differently)
- Say: " Can you hear me?"
Autocomplete
The autocomplete system provides up to 6 suggestions:
- After
/— channel commands, language commands, custom commands (role-filtered) - After command + space — argument values based on type
TArray<FString> Suggestions = ChatComponent->GetAutoCompleteSuggestions(CurrentInput);