Roof height and overhangings

i have a script of placing roof over walls but it has certain problems as you can see in screenshots

  1. when roof is placed it has no overhangings and for that i used curve offset.
    2)but when i have value of curve offset and get overhangings then roof do not touch the wall but little above.
  2. For dragging roof back to touch wall , i use base offset value but when i pull the roof downward using base offset value obviously then the roof height is affected as its upper peak pulled down from upper level.

what are your recommendations in this case