Text engine

i need to develop a text engine for a game. basically it has to be able to call up different text blocks depending on the character and any extenuating circumstances i.e. things you may have collected, people you may have talked to, places you may have visited etc.

what would be the best way of strucutring and executing something like this in flash? xml? arrays?

hit me. with a stick. of sweet knowledge.
thanks.