Here's a script that implements a gossip menu.
Most changes in the past few years were renames and small refactorings, so if you're used to old scripts it should still look familiar.
Look into CreatureAI.h for GossipSelectCode() and the other AI hooks.