You have to either loop all the words of topic $1- (to check each for being a token of your badword string), or loop your badwords (to check each for being a token of topic $1-). Or use a more sophisticated method like $hfind(R). IMO a simple loop will suffice because topic changes are rather infrequent and performance shouldn't be a big issue.

Basically, you want to do what all "badword scripts" do. The only difference is that you'll check $1- of the "on topic" event instead of the "on text" event. Take a look at some existing badword scripts - you'll find dozends in these forums and a lot more on dedicated mIRCscript websites.