You might need to change this
var %c = 1, %addr = [color:red]$address($nick,2)[/color]
To this
var %c = 1, %addr = [color:blue]$wildsite[/color]
The $address() identifier relies on the IAL, if the msg comes from a user not on any common channels it will return $null