Code:
alias _prefix return -!.

alias prefixcheck if (?test iswm $1 && $left($1,1) isin $_prefix) return *

alias transmit {
  if ($1 == !) { msg $chan $2- }
  elseif ($1 == -) { msg $nick $2- }
  elseif ($1 == .) { notice $nick $2- }
}

on *:TEXT:$($prefixcheck($1)):#my-chan:{
  transmit $left($1,1) Test was a success!
}
So $prefixcheck($1) examines the first word and if that matches, the identifier returns "*", thus making the event itself match. Otherwise it (implictly) returns $null, which makes the event fail.