If you are trying to store $comchan($nick,1) to a variable in a script, you need to use an event that includes $nick (most of them do, but not all). If you wish to use $comchan( ) in the form you have it in the thread topic, then you need to supply the $1 yourself, such as in an alias called with a parameter.
on *:JOIN:#: echo -ti2 $chan * First common channel with $nick is $comchan($nick,1)
alias FirstChan return $comchan($1,1)
//echo -a $FirstChan(Hammer)