Hello, this is because of unicode and how mirc represent data with utf16, the smiley face use two 16 bits value, called surrogates, to encode that character, when you use $asc(<smileyface) $asc will only return the value of the first 16 bits, the second 16 bits value can be obtained with $asc($mid(<smileyface>,2,1)).
$chr and $asc deal with 16 bits value, representing that smiley face takes two of them.