Every docs URL answers with Markdown when you add .md. Site map: llms.txt
Prompt Builder
Build a group of RDR2 prompts (press, hold or mash) on the game's own input actions and hold timings, try them in a preview, and download the Lua.
Bu dokümanlar şimdilik İngilizce.
The Prompt Builder makes the “press E to …” boxes RDR2 shows in the bottom right of the screen. You set up a group of prompts, try each one in a preview that behaves like the real thing, and get a ready resource: a client.lua that registers the prompts, shows the group near a spot and fires an event when a prompt completes, plus its fxmanifest.lua.
What it is for
Prompts are the standard way to offer an action in RedM, but setting one up takes a dozen native calls, a control hash, a hold type hash and a text label trick, and nothing shows until every step is right. Here you pick the action and the timing from the game’s own lists and get code that already works, so you only have to write what happens when the prompt fires.
Quick start
- In Group, set the Group name (the line under the prompts) and the Resource name.
- Leave Only near a spot on and type the X, Y, Z and Radius (m) of the place, or turn it off while you test so the group shows everywhere.
- Edit Prompt 1 and Prompt 2, or press Add prompt. For each one set the Text, the Input action and the Mode.
- Put the client event your script listens for in Event to trigger.
- Click or hold the rows in the preview to check the timing.
- Press Download resource, unzip into
resourcesand addensure <resource name>toserver.cfg.
Group
| Option | What it does | Default |
|---|---|---|
| Group name | The text under the prompts. | Valentine bank |
| Resource name | Folder and zip name, and the name in the manifest. Anything that is not a letter, digit, _ or - becomes _. |
my_prompts |
| Only near a spot | Show the group only within the radius of a point. Off shows it everywhere. | on |
| X, Y, Z | The point. | -308.42, 775.88, 118.7 (the Valentine bank) |
| Radius (m) | Distance from the point, measured in 3D. | 2 |
Reset puts the whole document back to these defaults.
Prompts
| Option | What it does | Default for a new prompt |
|---|---|---|
| Text | What the prompt says. | New prompt |
| Id | The prompt’s name in the Lua table and in the console message. | prompt<n> |
| Input action | The INPUT_ action the prompt listens to. Type to search the game’s 373 actions. The hint shows its hash and the controller button it reads. |
INPUT_CONTEXT_A |
| Mode | How the player completes it (see below). | Press |
| Tab | 1 to 8. Prompts on tab 2 and up sit on another page of the group. | 1 |
| Key in the preview | The key drawn in the preview, up to 6 characters. In game RDR2 draws the player’s own binding. | G |
| Event to trigger | A client event fired when the prompt completes. Empty prints prompt <id> completed to the F8 console instead. |
empty |
The cross on a prompt’s panel removes it.
Modes
| Mode | What the player does | Extra field |
|---|---|---|
| Press | Presses the key. | none |
| Press, fire on release | Presses and lets go. It completes on release. | none |
| Hold (game timing) | Holds the key for one of the game’s own hold timings. | Hold timing |
| Hold (your own time) | Holds the key for any number of milliseconds. | Hold time (ms) |
| Mash | Presses the key a set number of times. | Presses needed |
Hold timing lists the hold types of the game’s own prompts.meta, shortest first:
| Hold timing | Length |
|---|---|
SHORT_TIMED_EVENT_MP |
250 ms |
SHORT_TIMED_EVENT |
300 ms |
MEDIUM_TIMED_EVENT |
600 ms |
LONG_TIMED_EVENT |
1,500 ms |
PLAYER_FOCUS_TIMING |
2,000 ms |
PLAYER_REACTION_TIMING |
3,000 ms |
RUSTLING_CALM_TIMING |
5,000 ms |
KEYBOARD_DELETE |
5,000,000 ms |
These are the timings the game’s own prompts use. KEYBOARD_DELETE is in the list because the game defines it, but at over 83 minutes it is not a hold anybody finishes, and the preview never completes it.
The preview
The preview is drawn in the style of the in-game prompt box: one row per prompt on the current tab, the group name underneath, and < and > to switch tabs when there is more than one. Click a Press row, release on a fire on release row, hold a Hold row until its ring fills, or click a Mash row until the counter reaches the number. A row flashes when it completes. The look is drawn by the page, not taken from the game, so fonts and sizes are close rather than exact.
What it writes
With the default document, client.lua starts with your settings:
-- Generated with fivemad.com/redm/tools/prompt-builder
-- Prompt natives are called by hash (Citizen.InvokeNative). Each hash is commented with its
-- name in the RDR3 native database, so the script keeps working when a name changes.
local GROUP_NAME = "Valentine bank"
local ZONE = vector3(-308.42, 775.88, 118.7)
local RADIUS = 2.0
local TABS = 1
local PROMPTS = {
{ id = "bank", control = 0xD51B784F, text = "Open the bank", page = 0, mode = "standard", release = false }, -- INPUT_CONTEXT_Y
{ id = "rob", control = 0xE3BF959B, text = "Rob the vault", page = 0, mode = "hold", holdType = 0x87A8DDB3 }, -- INPUT_CONTEXT_X, LONG_TIMED_EVENT
}The rest of the file is the same for every document: it registers each prompt, and every frame you are inside the radius it shows the group and checks each prompt. The part you will want to read is the handler:
local function onPrompt(def)
if def.event then
TriggerEvent(def.event)
else
print(('prompt %s completed'):format(def.id))
end
endOutside the radius the loop sleeps 500 ms between checks. A completed prompt cannot fire again for 1 second, so one long hold does not trigger twice. When the resource stops, every prompt it made is deleted.
Every prompt native is called by its hash through Citizen.InvokeNative, with its current name in a comment beside it. Many RDR3 natives have no settled name yet and names have changed between versions of the native list; the hash does not change. Text is passed through VAR_STRING with the game’s LITERAL_STRING label, which is how RDR2 shows a plain string in a prompt.
fxmanifest.lua is short:
fx_version 'cerulean'
game 'rdr3'
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
name 'my_prompts'
description 'Prompt group made with fivemad.com/redm/tools/prompt-builder'
client_script 'client.lua'Switch between the two with the client.lua and fxmanifest.lua chips above the code.
Handling the event
Event to trigger is fired with TriggerEvent, so it is a client event in the player’s own game. Listen for it in a client script, and send it on to the server yourself if the server has to act:
AddEventHandler('myshop:open', function()
TriggerServerEvent('myshop:server:open')
end)Tips
- Grab coordinates with the Coords Picker and paste them into X, Y and Z. The distance check includes height, so use a Z close to where the player stands.
- Turn Only near a spot off while testing, then back on before you ship.
- The defaults use the context actions
INPUT_CONTEXT_Y,INPUT_CONTEXT_XandINPUT_CONTEXT_A. Give each prompt in a group its own action so the player can tell which key does what. - Put actions you rarely need on tab 2, so the first page stays short.
- The document is saved in your browser, so you can close the page and come back to it.
Common mistakes
The warning panel under the preview catches these before you download:
- An input action that is not in the list. The field turns amber and the code writes
control = 0. Pick a name from the suggestions. - Two prompts with the same id. Each needs its own.
- A prompt with no text.
- An empty tab. If a prompt is on tab 3 and none is on tab 2, the group shows an empty page.
And one it cannot catch: the prompt shows but nothing happens. The event name in Event to trigger has to match your AddEventHandler exactly, and it is a client event (see above).
Limitations
- The preview key is decoration. In game RDR2 draws whatever key or button the player has bound to the action.
- The generated loop only knows one zone. For the same group in several places, edit
ZONEinto a list of points. - The page cannot run RDR2, so how the prompt looks in game is not something it can show you exactly.