> For the complete documentation index, see [llms.txt](https://kb.heathen.group/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.heathen.group/old-kb/toolkit-for-ui-and-ux/unity/objects/command-library.md).

# Command Library

## Introduction

{% hint style="info" %}
Part of the [Command System](/old-kb/toolkit-for-ui-and-ux/unity/learning/core-concepts/command-system.md) of the UX Foundation and UX Compelete assets
{% endhint %}

A scriptable object referencing a set of commands and details about how those commands are to be parsed. A command is simply a [GameEvent](/old-kb/assets/system-core/game-events.md) that can be looked up by name. Your game can then listen for these game events to know when a command was ran. This system also handles paramiterizezd commands, that is the arguments following a command can be parsed and sent along with it.

```csharp
/emote wave
```

This might be parsed to invoke a Game Event named `emote` and pass a string argument of `wave` you can then handle this event and use the argument to determin what animation to play in the case of an emote system.

### Fields and Attributes

### useCaseSinsativeCommandNames

When parsing should case be respected

```csharp
public bool useCaseSinsativeCommandNames = false;
```

### commandStartString

What token should be watched for when searching strings for commands

```csharp
public string commandStartString = "/";
```

### developerCommands

Commands identified as "developer" commands, when parsing you can filter out developers commands. When used these are usually commands that are not restrectied from player access but require an additional layer of effort on the player's part similar to "console commands" in games like Elder Scrolls or Fallout.

If you want to prevent players from running a command, do not innclude it in your released game. If you do include a command in your game your players will find a way to run it.

```csharp
public List<GameEvent> developerCommands
```

### userCommands

Commands identified as "user" commands, when parsing. User commands are always searched when parsing and are in constrast to "developer" commands.

```csharp
public List<GameEvent> userCommands
```

## Methods

### TryParseCommand

Attempts to match the input string to a command optionally filtering on user commands only

```csharp
public bool TryParseCommand(string inputString, 
                            bool userOnly, 
                            out GameEvent gameEvent, 
                            out string argument)
```

### TryCallCommand

Attempts to match the input string to a command and to raise the matching command event with the provided arguments

```csharp
public bool TryCallCommand(string inputString, 
                           bool userOnly, 
                           out string errorMessage)
```

### VerifyCommand

Returns true if the provided string is a command

```csharp
public bool VerifyCommand(string inputString, 
                          bool userOnly, 
                          out string errorMessage)
```

### ParseCommand

parses a command and returns the [Command Data](/old-kb/toolkit-for-ui-and-ux/unity/objects/command-data.md).

```csharp
public CommandData ParseCommand(string inputString, bool userOnly)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kb.heathen.group/old-kb/toolkit-for-ui-and-ux/unity/objects/command-library.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
