I know exactly what you mean... i learnt it the hard way... what i show below also applies for heroes... many ppl say my pekka is dumb, my BK is dumb he went the other way etc.. we want the troops to go in a direction a we assume he reads our mind... So here is what you do
Attachment 90890
If you want your troops to not wander away or go around the base, break their path... as show in the pic if you take out the barracks or the builder buts the troops would go to the next closest building (all the melee style attack troops only).... the same concept can be used for your hogs,giants, golems etc...