Skip to content

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

JO Functions ​

jo.prompt.create() ​

A function to create a new prompt.

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)
The input of the key

holdTime : integer Optional

Duration to complete the prompt in ms
Use false for classic prompt without holding timer
default: false

page : integer Optional

The page of the prompt
default: 0

Return Value ​

Type : integer

The prompt ID

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
local duration = 1000
jo.prompt.create(group, keyLabel, key, duration)

jo.prompt.delete() ​

A function to delete a prompt.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Example ​

lua
local group = "interaction"
local key = "INPUT_JUMP"
jo.prompt.deletePrompt(group, key)

jo.prompt.deleteAllGroups() ​

A function to delete all prompts created

Syntax ​

lua
jo.prompt.deleteAllGroups()

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
local duration = 1000
jo.prompt.create(group, keyLabel, key, duration)
jo.prompt.deleteAllGroups()
print(jo.prompt.isGroupExist('interaction'))
-- Expected output : false

jo.prompt.deleteGroup() ​

A function to delete a group and all its prompts.

Syntax ​

lua
jo.prompt.deleteGroup(group)

Parameters ​

group : string

The name of the group

Example ​

lua
local group = "shop"
jo.prompt.deleteGroup(group)

jo.prompt.displayGroup() ​

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

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

Example ​

lua
CreateThread(function()
  local group = "shop"
  local title = "Stable shop"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  jo.prompt.create(group, keyLabel, key)
  while true do
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

jo.prompt.doesLastCompletedIs() ​

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

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if key is the last input completed

Example ​

lua
local group = "shop"
local key = "INPUT_ENTER"
print(jo.prompt.doesLastCompletedIs(group, key))

jo.prompt.editKeyLabel() ​

A function to edit the label of a key.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

label : string

The label of the key

page : integer Optional

The page of the prompt
default: current page

Example ​

lua
local group = "shop"
local key = "INPUT_JUMP"
local label = "The new label"
jo.prompt.editKeyLabel(group, key, label)

jo.prompt.get() ​

A function to get the prompt ID.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : integer|boolean

The prompt ID or false

Example ​

lua
local group = "shop"
local key = "INPUT_JUMP"
print(jo.prompt.get(group, key))

jo.prompt.getAll() ​

A function to get all registered prompts.

Syntax ​

lua
jo.prompt.getAll()

Return Value ​

Type : table

All prompt registered

Example ​

lua
local groups = jo.prompt.getAll
log(groups)

jo.prompt.getGroup() ​

A function to get the group ID.

Syntax ​

lua
jo.prompt.getGroup(group)

Parameters ​

group : string

The name of the group

Return Value ​

Type : integer|boolean

The group ID or false

Example ​

lua
local groupName = "MyGroup"
local group = jo.prompt.getGroup(groupName)
log(group)

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.

Syntax ​

lua
jo.prompt.getPage(group)

Parameters ​

group : string

The name of the group

Return Value ​

Type : integer

The page ID

Example ​

lua
local groupName = "MyGroup"
local page = jo.prompt.getPage(groupName)
log(page)

jo.prompt.getProgress() ​

A function to return the progress of a prompt.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : number

Return the percent of the prompt progress

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
CreateThread(function()
  while true do
    print(jo.prompt.getProgress(group, key))
    Wait(0)
  end
end)

jo.prompt.isActive() ​

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

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if the prompt is active

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
jo.prompt.isActive(group, key)
-- Expected output : false

jo.prompt.isCompleted() ​

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

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

fireMultipleTimes : boolean Optional

Fire true if the prompt is completed and until another prompt is completed
default: false

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if the key is pressed and completed

Example ​

lua
CreateThread(function()
  local group = "interaction"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  local duration = 1000
  jo.prompt.create(group, keyLabel, key, duration)
  while true do
    if jo.prompt.isCompleted(group, key) then
      print('Key completed !')
    end
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

jo.prompt.isEnabled() ​

A function to know if the prompt is enabled.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if the prompt is enabled

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
jo.prompt.isEnabled(group, key)
-- Expected output : false

jo.prompt.isExist() ​

A function to know if a prompt exists.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if the prompt exists

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
print(jo.prompt.isPromptExist('interaction', 'INPUT_JUMP'))
-- Expected output : true
print(jo.prompt.isGroupExist('new_group', 'INPUT_RELOAD'))
-- Expected output : false

jo.prompt.isGroupExist() ​

A function to know if a prompt group exists.

Syntax ​

lua
jo.prompt.isGroupExist(group)

Parameters ​

group : string

The name of the group

Return Value ​

Type : boolean

Return true if the group exists

Example ​

lua
local group = "interaction"
local keyLabel = "The key"
local key = "INPUT_JUMP"
jo.prompt.create(group, keyLabel, key)
print(jo.prompt.isGroupExist('interaction'))
-- Expected output : true
print(jo.prompt.isGroupExist('new_group'))
-- Expected output : false

jo.prompt.isPressed() ​

A function to know if a key is pressed.

Syntax ​

lua
jo.prompt.isPressed(key)

Parameters ​

key : string

The input of the key

Return Value ​

Type : boolean

Return true if the key is pressed

Example ​

lua
local key = "INPUT_FRONTEND_ACCEPT"
print(jo.prompt.isPressed(key))

jo.prompt.isVisible() ​

A function to check if a prompt is visible.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

page : integer Optional

The page of the prompt
default: current page

Return Value ​

Type : boolean

Return true if the prompt is visible

Example ​

lua
local group = "shop"
local key = "INPUT_JUMP"
local isVisible = jo.prompt.isVisible(group, key)
log(isVisible)

jo.prompt.setEnabled() ​

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

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

value : boolean

If the prompt is enabled or not

page : integer Optional

The page of the prompt
default: current page

Example ​

lua
local group = "shop"
local key = "INPUT_JUMP"
jo.prompt.setEnabled(group, key, false)

jo.prompt.setGroups() ​

A function to overwrite the prompt groups value.

Syntax ​

lua
jo.prompt.setGroups(groups)

Parameters ​

groups : table

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

Example ​

lua
local groups = exports.resourceName:getPrompt()
jo.prompt.setGroups(groups)

jo.prompt.setVisible() ​

Turn on/off a prompt.

Syntax ​

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

Parameters ​

group : string

The name of the group

key : string

The input of the key

value : boolean

If the prompt is visible or not

page : integer Optional

The page of the prompt
default: current page

Example ​

lua
local group = "shop"
local key = "INPUT_JUMP"
local isVisible = false
jo.prompt.setVisible(group, key, isVisible)

jo.prompt.waitRelease() ​

A function to wait for the release of pressed key.

Syntax ​

lua
jo.prompt.waitRelease(key)

Parameters ​

key : string

The input of the key

Example ​

lua
CreateThread(function()
  local group = "interaction"
  local keyLabel = "The key"
  local key = "INPUT_JUMP"
  local duration = 1000
  jo.prompt.create(group, keyLabel, key, duration)
  while true do
    if jo.prompt.isCompleted(group, key) then
      print('Key completed !')
      jo.prompt.waitRelease(key)
      print('Key released !')
    end
    jo.prompt.displayGroup(group, title)
    Wait(0)
  end
end)

Last updated: