nPC conversation codes

From OpenKore Wiki
Revision as of 10:39, 29 November 2012 by EternalHarvest (talk | contribs) (TODO (desired syntax))
Jump to navigation Jump to search

NPC conversation codes are used to specify NPC talk sequences of steps (actions) to do.

Syntax

Sequence consists of whitespace-separated codes. Each code is separated with a whitespace.

Code Description
c Continue talking to the NPC. This is the same as pressing the Next buttom.
r<response #> Send a response to the NPC. The response number is the index of the responses in the displayed response list . This is the same as selecting a response when you talk to an NPC.
w<seconds> Wait for the specified number of seconds before continuing to talk to the NPC.
d<number> Send a number to the NPC. Use this if the NPC asks you to enter an amount.
t=<string> Send a text to the NPC. Use this if the NPC asks you to enter some text.
s Go to sell list. This is the same as pressing the sell button when you talk to a buy/sell NPC.
b Go to the store list. This is the same as pressing the buy button when you talk to a buy/sell NPC.
b<store item #>,<amount> Buy an item from the NPC. See similar buy. Note that the amount is not optional.
n Ends and cancel conversation with the NPC. This is the same as pressing the close or cancel button when talking to an NPC.
e Pretend like conversation was stopped (doesn't send anything additional). Use this after the s or b talk code when talking to a buy/sell NPC.
a=<string> Run a console command.
x Reinitiate NPC conversation. This is always prepended to talknpc sequence. Useful to perform multiple transaction with a single NPC.

API

There is no API for parsing or executing NPC sequences. It's encapsulated in Task::TalkNPC which handles the whole interaction with NPCs.

API for extending (introducing new codes) doesn't exist, but is possible to implement using hooks.

Examples

Talk to a NPC at the coordinates (63, 60), using the talk sequence: next; choose fourth response; next; choose first response; next; next; choose first response; next; end.

talknpc 63 60 c r3 c r0 c c r0 c n

TODO

  • Dynamically detect whether autoTalkCont functionality is needed for a sequence, so form without "c"s can always be used?
  • r="<full response text>"
  • r=/response text regexp/