Chat is just an orderly conversation, quest is a quest, random is just random lines of dialogue, and trade opens a trade window (merchants, blacksmiths, etc.) Lines of dialogue are randomly assigned to a table depending on the type of conversation and the topic.