This is actually done to a degree in some varieties of online games (MUSHs, for example).

For a more complex scenario, a panel of moderators (White Cell) would be workable as well. It would most likely be cheaper than the fully programmed alternatives, and more flexible and 'realistic' as well.