You could use something that acts as a type of "check" to see if something has actually been highlighted, for example:
$highlight(0) - Returns the number of "items" in your highlight settings.
$highlight(N) - Returns the N'th item.
So, looping around that, and since words can be seperated by commas, we loop around the commas also and check if they are in the persons sentence, plus check if highlight is even turned on using $highlight (true/false) and if everything is okay, /window -s.
On *:Text:*:#:{
var %i = 1
while (($highlight(0) >= %i) && ($highlight)) {
var %n = $highlight(%i)
var %o = $numtok(%n,44)
while (%o) {
if (($gettok(%n,%o,44) isin $1-) && ($window($chan).state == hidden)) { window -w $chan }
dec %o
}
inc %i
}
}
Hope this helps,
Eamonn.