These techniques should help you to find bugs faster when you're scripting.
If something is not working, check which variables could be wrong, check the output of the variables using hints.
Vektorboson released a 'debugging console for advanced users that is very helpful at debugging your scripting in real time.
Documentation on using the console can be found http://home.arcor.de/vektorboson/res/console2.0docs.zip here]).
Try to simplify the problem, take the part which does not work out in an extra test mission, so that you don't have to watch/whatever the effect of the whole rest of the script(s).
If you're scripting for an addon, don't pack the scripts in the PBO, as you have to restart after every change, make a test mission with the script included there.