implement pre_advance event

pre advance event fires before the user sees the advancement dialog.
Implements fr https://gna.org/bugs/?21464