How to write scripts?