Move scripts stuff into its own file.

We now register a function ("C closure in a global variable") for testing purposes. We'll be able to call back and forth that way.