Add an event to the script reload.

This allows scripts being reloaded to clean up after themselves.
Merge pull request #1505 from baroldgene/patch-1

Add an event to the script reload.