Okay your script is useful, but i would really like to understand it

. I've looked on the internet for some tutorials, but nothing really explains it. It would be simple to just copy & paste it in, but this is part of a school project, and i'd need to explain in good detail how i did it.
I'd really appreciate it if you broke it down and commented the code so i could understand fully.
Thanks.