Skip to main content

Commands & Emotes

Built-in Commands

CommandSyntaxDescription
/me/me bows respectfullyThird-person emote action
/w/w PlayerName messageDirect 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

TypeAutocomplete
PlayerNameOnline player names
ChannelIdAvailable channels
LanguageIdAvailable languages
ItemNameCustom resolver (register via RegisterArgumentResolver)
IntegerNone
FloatNone
FreeTextNone

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:

  1. Say: "I whisper: "
  2. Emote: "leans in close" (never language-corrupted, styled differently)
  3. Say: " Can you hear me?"

Autocomplete

The autocomplete system provides up to 6 suggestions:

  1. After / — channel commands, language commands, custom commands (role-filtered)
  2. After command + space — argument values based on type
TArray<FString> Suggestions = ChatComponent->GetAutoCompleteSuggestions(CurrentInput);