A lot of these samples are code samples that have been collected from various developers, and placed here to help others that need examples of working code. Hopefully you will find example for what you are looking for.
Most PayPal buttons can be created from your PayPal account by using the button factory. However, some things you can not directly add to your buttons such as coupons/discounts and etc. These features require the use of either scripts, or 3rd party shopping carts that support features like this. If you want to use a script, the files and instructions on these pages can provide you with the necessary information to create a script.
For more detailed information on the PayPal buttons, I would suggest viewing the Developers Guide. You can find the developers guide for Website Payments Standard on PayPal's developers site at www.x.com
Simple little plugins. Insert the JS and just use it. Include the JS once, and use it in every FORM on a page. These scripts will solve many of your problems. Each example uses the same technique, so they may be combined to create more complex solutions. If you look at the more complex examples following these simple examples, you will see the same general approach is used, but the complexity is increased. All these items interface with the output of the standard PayPal button factories.