These are my templates for writing different kinds of scripts.  Edit appropriately.  I hope they help.