snippet packet
Platform: mIRC
Published Feb 07, 2011
Updated Feb 12, 2011
This a snippet packet containing 4 snippets
• $dices
echo -a $dices(C,N)
where C is the number of combinations, and N is the random number 1 to N
like
echo -a $dices(5,10)
will choose 5 random numbers between 1 to 10
• $char_it
echo -a $char_it(text)
the properties for $char_it is en,de
convert all text into characters number
like
//echo -a $char_it(test).en
will return
116 101 115 116
//echo -a $char_it(116 101 115 116).de
will return test
• /type_back
/type_back text
will write all text in backwards
/type_back test
will return tset
• /convert
/convert C | ?N
convert all characters into Octal, Decimal, Hexadecimal and Binary
/convert +
will return
Converted values for + is Octal: 53 | Decimal: 43 | Binary: 101011 | Hexadecimal: 2B
if you want, you can choose character numbers, like, the value for space character is 32
you need to put a ? before the character number
/convert ?32
Converted values for Character 32 is Octal: 40 | Decimal: 32 ( ) | Binary: 100000 | Hexadecimal: 20
;; The original idea for the $dices was not mine, but i realized it (original idea, made by request)
alias dices {
var %x = $$1, %y = $$2, %z
%z = $regsubex($str($chr(44),$calc(%x - 1)),//g,$r(1,%y))
return %z
}
;; $char_it
alias char_it {
var %x = $1-, %y
%y = $regsubex($str($chr(32),$iif($prop == en,$mid(%x,1,\n),$gettok(%x,1,32))),//g,$iif($prop == en,$asc($mid(%x,\n,1)),$iif($chr($gettok(%x,\n,32)) == $chr(32),$replace($chr($gettok(%x,\n,32)), $chr(32), $chr(0160)),$chr($gettok(%x,\n,32)))))
return $iif($prop == de,$remove(%y,$chr(32)),%y)
}
;; /type_back
alias type_back {
var %x = $1-
echo -a $regsubex($str(.,$mid(%x,1,\n)),/./g,$mid(%x,$+(-,\n),1))
}
;; /convert
alias convert {
if ($$1 isnum 0-9) || ($$1 !isnum) {
var %x = $iif($regex($$1,/\?(\d+)/), $regml(1), $asc($left($$1,1)))
echo -a Converted values for $iif($regml(1), Character) $iif($regml(1), $+(,%x,), $(,$left($$1,1),)) is Octal: $base(%x,10,8) $chr(124) Decimal: $iif($regml(1), %x $+($chr(40),$chr(%x),$chr(41)), %x) $chr(124) Binary: $base(%x,10,2) $chr(124) Hexadecimal: $base(%x,10,16)
}
else { echo -a 4ERROR: cannot find the value for $$1 }
}