At first? learning python. Codecademy it’s a good start!
Then, you can use xPacketTool to read client/server packets when you click that npc and all his options. The rest will be easy if you know Python and take a look the code from this section.
All relevant info can be found around 0x7046 (client packet) happening at selecting npc and 0xB046 (server packet) that it’s his response.