School shooter followed video game-like 'script'