miRC already has this built in: $base()
The basics:
$base(input,baseIn,baseOut)
input -> number representation to be converted
baseIn -> the base of the input (2 for binary, 8 for octal, 10 for decimal, 16 for hex, but can be any base)
baseOut -> the base to convert 2 (2 for binary, 8 for octal,...)
Example:
Binary to Decimal: $base(10,2,10) = 2
Octal to Decimal: $base(10,8,10) = 8
Hex to Decimal: $base(10,16,10) = 16