The way .tim files work is explained very well
in this article. However, the same article does not describe tile IDs very well, especially in the case of walls and obstacles. You might need to do some experimenting in this case, depending upon what order you have your wall images arranged in.
The pit graphics aren't too difficult. Let's call your style MyStyle, for example's sake. First, on the bottom layer is the MyStylePit image. Next, MyStylePitside is drawn as many times as possible, starting from the left. (this may be zero times) Finally, MyStylePitsideSmall is added to fill in any pit widths smaller than the width of MyStylePitside.
This is just what I understand the system to be - if someone points out I'm wrong I'll gladly step aside and let them do some better explaining.
____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text