Overcoming obstacles isnt a 5 second scripting task.
If you want to include a robust obstacle handler in your scripts, it will take quite some time to write.
You will need to use collision flags and detect the type of obstacle blocking you, and what needs to be done to overcome it.
There is some old example code to get you started, if I feel unlazy later I will find it and link it here. Otherwise, maybe someone else will. It was a simple obstacle handler written by Maxi.