title: RPG dialogue engine / structure
body: <p>I've always been interested in the data structures involved in an RPG (Role-Playing Game). In particular, I'm curious about dialogue and events based actions.</p>
  
  <p>For example: If I approach an NPC at point <em>x</em> in the game, with items <em>y</em> and quests <em>z</em>, how would I work out what the NPC needs to say? Branching dialogue and responding to player input seems as trivial as having a defined script, and user input causes the script reader to jump to a particular line in the script, which has a corresponding set of response lines (much like a choose your own adventure)</p>
  
  <p>However, tying in logic to work out if the player has certain items, and completed certain quests seems to really ruin this script based model.</p>
  
  <p>I'm looking for ideas (not necessarily programming language examples) of how to approach all of this dialogue and logic, and separate it out so that it's very easy to add new branching content, without delving into too much code.</p>
  
  <p>This is really an open question. I don't believe there's a single solution, but it'd be good to get the ball rolling with some ideas. As more of a designer than a programmer, I'm always interested in ways to separate content and code.</p>