i've done this for a customer..
the basic thing i did was to create an /ads directory under cache_builders
i grabbed a custom island template and replicated it about 15 times.. made each advert unique...
then in the send_header and send_footer functions (html.inc.php), i decided which ad island to include based upon :
1. $header['Category']
2. $ubb
3. $header['Board']
those 3 allowed me to determine 'where' i was in the board for any context..
then header.tpl and footer.tpl were modified to just include the designated ad island, based upon context and voila.. forum / context sensitive adverts (or islands)..
note: i used a separate /ads sub-dir because i just wanted to keep it from interfering with standard content islands and i also wanted the islands to not have $tbopen and $tbclose stuff either...
it's doable