# Command Parameter Parsing Tool

## Blueprint Console Command Parser - Usage Guide

### Overview

`BlueprintConsoleCommandParser` is a powerful parameter parsing utility that helps you easily parse and convert console command parameters into various data types.

### Features

✅ **Multiple Data Type Support**: Int, Float, Bool, String, Vector, Rotator\
✅ **Smart Type Conversion**: Automatic validation and type conversion\
✅ **Named Parameters**: Support for key=value format\
✅ **Quote Support**: Properly handles strings with spaces\
✅ **Default Values**: All functions support default values\
✅ **Batch Parsing**: Parse multiple parameters at once

***

### Basic Usage

#### 1. Parse Single Parameter

**Get String Parameter**

```cpp
Blueprint Node Flow:
Parameters (String) → Get Parameter (Index: 0) → Result (String)

Example:
Input: "hello world test"
Index: 0 → "hello"
Index: 1 → "world"
Index: 2 → "test"
```

**Get Integer Parameter**

```cpp
Parameters → Get Parameter As Int (Index: 0, Default: 0) → Result (Int)

Example:
Input: "123 456 789"
Index: 0 → 123
Index: 1 → 456
Index: 2 → 789
```

**Get Float Parameter**

```cpp
Parameters → Get Parameter As Float (Index: 0, Default: 0.0) → Result (Float)

Example:
Input: "3.14 2.5 100.5"
Index: 0 → 3.14
Index: 1 → 2.5
Index: 2 → 100.5
```

**Get Boolean Parameter**

```cpp
Parameters → Get Parameter As Bool (Index: 0, Default: false) → Result (Bool)

Supported Formats:
true/false → True/False
1/0 → True/False
yes/no → True/False
on/off → True/False

Example:
Input: "true yes 1 on"
Index: 0 → true
Index: 1 → true
Index: 2 → true
Index: 3 → true
```

***

### Advanced Usage

#### 2. Parse Vectors and Rotators

**Vector - Comma Separated Format**

```cpp
Parameters → Get Parameter As Vector (Start Index: 0) → Result (Vector)

Example:
Input: "100,200,300"
Result: Vector(100, 200, 300)
```

**Vector - Space Separated Format**

```cpp
Example:
Input: "100 200 300"
Result: Vector(100, 200, 300)
```

**Rotator**

```cpp
Parameters → Get Parameter As Rotator (Start Index: 0) → Result (Rotator)

Example:
Input: "90,45,0"
Result: Rotator(Pitch=90, Yaw=45, Roll=0)

Input: "90 45 0"
Result: Rotator(Pitch=90, Yaw=45, Roll=0)
```

***

#### 3. Batch Parsing

**Get All Integer Parameters**

```cpp
Parameters → Get All Parameters As Int → Result (Array<Int>)

Example:
Input: "10 20 30 40 50"
Result: [10, 20, 30, 40, 50]
```

**Get All Float Parameters**

```cpp
Parameters → Get All Parameters As Float → Result (Array<Float>)

Example:
Input: "1.5 2.5 3.5"
Result: [1.5, 2.5, 3.5]
```

***

#### 4. Named Parameters

**Parse Named Parameters**

```cpp
Parameters → Parse Named Parameters → Result (Map<String, String>)

Example:
Input: "name=Player health=100 speed=5.5 active=true"
Result:
{
  "name": "Player",
  "health": "100",
  "speed": "5.5",
  "active": "true"
}
```

**Get Named Parameter Value**

```cpp
Named Parameters → Get Named Parameter (Key: "name") → Result (String)

Example:
Input Parameters: name=Player health=100
Key: "name" → "Player"
Key: "health" → "100"
```

**Get Named Parameter as Integer**

```cpp
Named Parameters → Get Named Parameter As Int (Key: "health", Default: 100) → Result (Int)

Example:
Input Parameters: health=150 level=5
Key: "health" → 150
Key: "level" → 5
```

***

### Complete Blueprint Examples

#### Example 1: Teleport Player Command

```
Command Format: teleport x y z
Example: teleport 100 200 300

Blueprint Flow:
[Event] Callback_BPCommandSystem (Parameters)
    ↓
[Get Parameter As Vector] (Parameters, Start Index: 0)
    ↓
[Get Player Character]
    ↓
[Set Actor Location] (Target: Player, New Location: Vector)
```

#### Example 2: Set Player Properties Command

```
Command Format: setprop health=100 speed=5.5 name="John Doe"
Example: setprop health=150 speed=6.0 name=Player1

Blueprint Flow:
[Event] Callback_BPCommandSystem (Parameters)
    ↓
[Parse Named Parameters] (Parameters)
    ↓
├─ [Get Named Parameter As Int] (Key: "health") → Set Health
├─ [Get Named Parameter As Float] (Key: "speed") → Set Speed
└─ [Get Named Parameter] (Key: "name") → Set Name
```

#### Example 3: Spawn Item Command

```
Command Format: spawn item_name count x y z
Example: spawn Sword 5 100 200 300

Blueprint Flow:
[Event] Callback_BPCommandSystem (Parameters)
    ↓
├─ [Get Parameter] (Index: 0) → Item Name (String)
├─ [Get Parameter As Int] (Index: 1, Default: 1) → Count (Int)
└─ [Get Parameter As Vector] (Start Index: 2) → Location (Vector)
    ↓
[Spawn Item] (Item Name, Count, Location)
```

#### Example 4: Multiple Parameter Validation

```
Command Format: 111 10 20 30 40 50
Process multiple integer parameters

Blueprint Flow:
[Event] Callback_BPCommandSystem (CommandName: "111", Parameters)
    ↓
[Get All Parameters As Int] (Parameters)
    ↓
[For Each Loop]
    ↓
[Print String] (Array Element)

Result: Prints 10, 20, 30, 40, 50 in sequence
```

***

### Utility Functions

#### Parameter Count

```cpp
Get Parameter Count (Parameters) → Count (Int)

Example:
Input: "one two three"
Result: 3
```

#### Split Parameters

```cpp
Split Parameters (Parameters, Delimiter: " ") → Array (Array<String>)

Example:
Input: "param1 param2 param3"
Result: ["param1", "param2", "param3"]
```

#### Remove Quotes

```cpp
Remove Quotes (Parameter) → Result (String)

Example:
Input: '"Hello World"'
Result: "Hello World"
```

#### Validation Functions

```cpp
Is Valid Int (Parameter) → Result (Bool)
Is Valid Float (Parameter) → Result (Bool)
Is Valid Bool (Parameter) → Result (Bool)

Examples:
"123" → IsValidInt = true
"abc" → IsValidInt = false
"3.14" → IsValidFloat = true
"true" → IsValidBool = true
```

***

### Error Handling

All parsing functions support default values. When parameters are invalid or don't exist, the default value is returned:

```cpp
Get Parameter As Int (Index: 999, Default: -1) → -1
Get Parameter As Float (Index: 999, Default: 0.0) → 0.0
Get Parameter As Bool (Index: 999, Default: false) → false
```

***

### Performance Optimization Tips

1. **Cache Parsed Results**: If you need to use the same parameter multiple times, parse and store it
2. **Use Batch Functions**: When you need all parameters, use `Get All Parameters As Int/Float`
3. **Validate Parameters**: Use `Is Valid` functions to validate before parsing

***

### Common Use Cases

#### Scenario 1: GM Command - Give Item

```
Command: giveitem ItemID Count
Console: giveitem 1001 50

Blueprint:
- Get Parameter As Int (Index: 0) → Item ID
- Get Parameter As Int (Index: 1, Default: 1) → Count
- GiveItem(ItemID, Count)
```

#### Scenario 2: Debug Command - Set Time

```
Command: settime hour minute
Console: settime 12 30

Blueprint:
- Get Parameter As Int (Index: 0, Default: 12) → Hour
- Get Parameter As Int (Index: 1, Default: 0) → Minute
- SetTime(Hour, Minute)
```

#### Scenario 3: Test Command - Batch Spawn

```
Command: spawnmultiple count x,y,z
Console: spawnmultiple 10 100,200,300

Blueprint:
- Get Parameter As Int (Index: 0) → Count
- Get Parameter As Vector (Start Index: 1) → Location
- For Loop (Count times) → SpawnActor(Location)
```

***

### API Quick Reference

<table><thead><tr><th width="277.6666259765625">Function Name</th><th width="203.3333740234375">Input</th><th>Output</th><th>Description</th></tr></thead><tbody><tr><td><code>Get Parameter</code></td><td>Index, Default</td><td>String</td><td>Get string parameter</td></tr><tr><td><code>Get Parameter As Int</code></td><td>Index, Default</td><td>Int</td><td>Get integer parameter</td></tr><tr><td><code>Get Parameter As Float</code></td><td>Index, Default</td><td>Float</td><td>Get float parameter</td></tr><tr><td><code>Get Parameter As Bool</code></td><td>Index, Default</td><td>Bool</td><td>Get boolean parameter</td></tr><tr><td><code>Get Parameter As Vector</code></td><td>Start Index, Default</td><td>Vector</td><td>Get vector parameter</td></tr><tr><td><code>Get Parameter As Rotator</code></td><td>Start Index, Default</td><td>Rotator</td><td>Get rotator parameter</td></tr><tr><td><code>Get All Parameters As Int</code></td><td>-</td><td>Array</td><td>Get all integers</td></tr><tr><td><code>Get All Parameters As Float</code></td><td>-</td><td>Array</td><td>Get all floats</td></tr><tr><td><code>Parse Named Parameters</code></td><td>-</td><td>Map&#x3C;String,String></td><td>Parse named parameters</td></tr><tr><td><code>Get Named Parameter</code></td><td>Key, Default</td><td>String</td><td>Get named parameter value</td></tr><tr><td><code>Split Parameters</code></td><td>Delimiter</td><td>Array</td><td>Split parameters</td></tr><tr><td><code>Get Parameter Count</code></td><td>-</td><td>Int</td><td>Get parameter count</td></tr></tbody></table>

***

### Summary

Using `BlueprintConsoleCommandParser` allows you to:

✅ Greatly simplify parameter parsing code\
✅ Automatically handle type conversion\
✅ Support complex parameter formats\
✅ Provide comprehensive error handling\
✅ Improve development efficiency and code readability

Now you can focus on implementing command logic instead of dealing with tedious string parsing! 🎉
