OnDialogueResponse
A player answered a dialogue page - the choice they picked, or 0 when it closed.
option is the choice they picked, 1 for the top one. The page then closes unless this callback shows the next one
with ShowPlayerDialogue - the conversation goes on without a flicker. option is 0 when the page closed without
a pick: reason is "" for the player’s own close (Esc), else "you walked away" (5 m from the actor),
"the actor is gone", "you died" or "you left". HidePlayerDialogue and a page replaced by the next do not
come here.
Syntax
Section titled “Syntax”function OnDialogueResponse(pid, dialogid, option, reason) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
dialogid |
number | the page’s number, as the mode gave it to ShowPlayerDialogue |
option |
number | the choice picked, 1 for the top one; 0 = closed without a pick |
reason |
string | why it closed when option is 0; "" = the player’s own close, and always "" for a pick |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”local GATE, GATE_PASS = 1, 2function OnDialogueResponse(pid, dialogid, option, reason) if dialogid == GATE then if option == 1 then ShowPlayerDialogue(pid, GATE_PASS, "", "Off you go then. Mind the mud.", {"Thank you."}, GetPlayerData(pid, "talking_to")) elseif option == 2 then SendClientMessage(pid, COLOR_RED, "The watchman eyes you suspiciously.") end endendSee also
Section titled “See also”ShowPlayerDialogue · OnPlayerInteractActor · the Dialogue group of the index
