The program below present a simple conversation "tree" such as might be used in a video game. To see the source code or leave a comment, visit http://thiscouldbebetter.wordpress.com/2013/04/25/a-conversation-engine-for-a-video-game-in-javascript/.

While you can hold an intelligible (if unrewarding) conversation with the current code, it could still use some tweaking. Notably, I had to add the nodes for some of the Options before the actual statement that precedes them. It might also be nice to be able to parse the conversation tree from a text "script" rather than building it as JavaScript objects.