I dont really script but looking at the help file i thought maybe $istok would help.
example.
on *:text:*:#: if ($istok($1-,hi,32)) { ....
and what about on *:text:*hi*:#: if you are only looking for one word and dont have to parse alot of if statements that maybe an option