Writing a plug-in — help please

I hope someone can help me out here to at least point me in the proper direction so I can start writing a plug-in for wordpress. I am familiar with PHP and have “hacked” my copy of WP previously but hate doing so as upgrade really becomes a nightmare / impossible.

What I want to do seems fairly simple from the surface. When a new article is published I want to run a function that performs a few tasks on my website / database. It is a separate database so I assume I’ll just have to write a php script to do what I need to be done, but I can’t seem to find the “trigger” of publishing an article.

I would have to pass the article ID from wordpress to my new script and that is about it, any help? Thanks!