You don't have to use $v1 but $1.
Using $1 also gives those old mirc users (below the version of 6.16, which the $v1 & $v2 were added) a safe bet for this code to work for them 100%.