# Prompt `[Client]`

A library to manage prompts in the game.  
:::tip
The list of the input HashName for keys is available in the [rdr3 discoveries github](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls)
:::

## JO Functions

### jo.prompt.create()

A function to create a new prompt. <br>

#### Syntax

```lua
jo.prompt.create(group, str, key, holdTime, page)
```

#### Parameters

`group` : _string_
> The name of the group. Use "interaction" to display the prompt without need to call jo.prompt.displayGroup every frame
>

`str` : _string_
> The label of the key
>

`key` : _string|table_
> Input (string or list of strings) <br> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`holdTime` : _integer_ `[Optional]`
> Duration to complete the prompt in ms <br> Use `false` for classic prompt without holding timer <br> default: false
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: 0
>

#### Return Value

Type : _integer_

> The prompt ID

---

### jo.prompt.delete()

A function to delete a prompt. <br>

#### Syntax

```lua
jo.prompt.delete(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

---

### jo.prompt.deleteAllGroups()

A function to delete all prompts created <br>

#### Syntax

```lua
jo.prompt.deleteAllGroups()
```

---

### jo.prompt.deleteGroup()

A function to delete a group and all its prompts. <br>

#### Syntax

```lua
jo.prompt.deleteGroup(group)
```

#### Parameters

`group` : _string_
> The name of the group
>

---

### jo.prompt.displayGroup()

A function to display a prompt group during this frame. <br>
Needs to be called each frame. <br>

#### Syntax

```lua
jo.prompt.displayGroup(group, title)
```

#### Parameters

`group` : _string_
> The name of the prompt group to display this frame
>

`title` : _string_
> The title to display for this prompt group
>

---

### jo.prompt.doesLastCompletedIs()

A function that returns if it's the last prompt completed. <br>

#### Syntax

```lua
jo.prompt.doesLastCompletedIs(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if key is the last input completed

---

### jo.prompt.editKeyLabel()

A function to edit the label of a key. <br>

#### Syntax

```lua
jo.prompt.editKeyLabel(group, key, label, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`label` : _string_
> The label of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

---

### jo.prompt.get()

A function to get the prompt ID. <br>

#### Syntax

```lua
jo.prompt.get(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _integer|boolean_

> The prompt ID or `false`

---

### jo.prompt.getAll()

A function to get all registered prompts. <br>

#### Syntax

```lua
jo.prompt.getAll()
```

#### Return Value

Type : _table_

> All prompt registered

---

### jo.prompt.getGroup()

A function to get the group ID. <br>

#### Syntax

```lua
jo.prompt.getGroup(group)
```

#### Parameters

`group` : _string_
> The name of the group
>

#### Return Value

Type : _integer|boolean_

> The group ID or `false`

---

### jo.prompt.getKeyLabel()

#### Syntax

```lua
jo.prompt.getKeyLabel(group, key, page)
```

---

### jo.prompt.getPage()

A function to get the current page ID for a group. <br>

#### Syntax

```lua
jo.prompt.getPage(group)
```

#### Parameters

`group` : _string_
> The name of the group
>

#### Return Value

Type : _integer_

> The page ID

---

### jo.prompt.getProgress()

A function to return the progress of a prompt. <br>

#### Syntax

```lua
jo.prompt.getProgress(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _number_

> Return the percent of the prompt progress

---

### jo.prompt.isActive()

A function to know if a prompt is active or not. <br>

#### Syntax

```lua
jo.prompt.isActive(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if the prompt is active

---

### jo.prompt.isCompleted()

A function to test if the prompt is pressed and completed. <br>

#### Syntax

```lua
jo.prompt.isCompleted(group, key, fireMultipleTimes, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`fireMultipleTimes` : _boolean_ `[Optional]`
> Fire true if the prompt is completed and until another prompt is completed  <br> default: false
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if the key is pressed and completed

---

### jo.prompt.isEnabled()

A function to know if the prompt is enabled. <br>

#### Syntax

```lua
jo.prompt.isEnabled(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if the prompt is enabled

---

### jo.prompt.isExist()

A function to know if a prompt exists. <br>

#### Syntax

```lua
jo.prompt.isExist(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if the prompt exists

---

### jo.prompt.isGroupExist()

A function to know if a prompt group exists. <br>

#### Syntax

```lua
jo.prompt.isGroupExist(group)
```

#### Parameters

`group` : _string_
> The name of the group
>

#### Return Value

Type : _boolean_

> Return `true` if the group exists

---

### jo.prompt.isPressed()

A function to know if a key is pressed. <br>

#### Syntax

```lua
jo.prompt.isPressed(key)
```

#### Parameters

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

#### Return Value

Type : _boolean_

> Return `true` if the key is pressed

---

### jo.prompt.isVisible()

A function to check if a prompt is visible. <br>

#### Syntax

```lua
jo.prompt.isVisible(group, key, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

#### Return Value

Type : _boolean_

> Return `true` if the prompt is visible

---

### jo.prompt.setEnabled()

A function to define if the prompt is enabled or not. <br>

#### Syntax

```lua
jo.prompt.setEnabled(group, key, value, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`value` : _boolean_
> If the prompt is enabled or not
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

---

### jo.prompt.setGroups()

A function to overwrite the prompt groups value. <br>

#### Syntax

```lua
jo.prompt.setGroups(groups)
```

#### Parameters

`groups` : _table_

> The prompt group value from other script get with jo.prompt.getAll()
>

---

### jo.prompt.setVisible()

Turn on/off a prompt. <br>

#### Syntax

```lua
jo.prompt.setVisible(group, key, value, page)
```

#### Parameters

`group` : _string_
> The name of the group
>

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>

`value` : _boolean_
> If the prompt is visible or not
>

`page` : _integer_ `[Optional]`
> The page of the prompt <br> default: current page
>

---

### jo.prompt.waitRelease()

A function to wait for the release of pressed key. <br>

#### Syntax

```lua
jo.prompt.waitRelease(key)
```

#### Parameters

`key` : _string_
> The [input](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/Controls) of the key
>
