Fixed querying the characters script for XP.

This was previously randomly freezing the game at battles' ends, when winning.

Should hopefully fix #271

Thanks to Shirish for pointing out.