Implement script loading and saving.

Fairly untested.