convert asc to chr

By |[Arkham]| on Jun 10, 2009

ASCII stands for American Standard Code for Information Interchange.
//echo -a $chr(64)
it will display @ and if you type
//echo -a $asc(@)
it will display 64.

based on that statement above i have an idea to convert ascii character to numerics character.
this little snippet allow you to convert a text into numeric characters.

usage: //asc2chr helloworld
output: $+($chr(104),$chr(101),$chr(108),$chr(108),$chr(111),$chr(119),$chr(111),$chr(114),$chr(108),$chr(100))

just simply load this snippet into your mirc`s remote section.

alias asc2chr {
  var %i = 1 
  while (%i <= $len($1-)) {
    var %buff = $instok(%buff,$+($chr(36),$chr(99),$chr(104),$chr(114),$chr(40),$asc($mid($1-,%i,1)),$chr(41)),%i,44)
    inc %i
  }
  echo -a $+($chr(36),$chr(43),$chr(40),%buff,$chr(41))
}

Comments

Sign in to comment.
Testor   -  Jul 29, 2009

Thanks :D

 Respond  
Jonesy44   -  Jun 11, 2009

Nice one:)

 Respond  
|[Arkham]|   -  Jun 11, 2009

ok already fix it.. ^_^

 Respond  
|[Arkham]|   -  Jun 11, 2009

jonesy44: thanks man.. yeah just figured out that the %data var is useless..
napa182: nice line bro.. i see regex is very interesting since it can simplifying many line into one line..

 Respond  
napa182   -  Jun 10, 2009

you can also do somthing like this as well

alias asc2chr echo -a $+($!+,$chr(40),$regsubex($1-,/(.)/g,$+($!chr,$chr(40),$asc(\1),$chr(41),$chr(44))),$chr(41))
 Respond  
Jonesy44   -  Jun 10, 2009

1.Why declare the %data variable? It's not used :)
2.No real need for the %length variable, you could just use the data: while (%i <= $len($1-)), since it is a constant

Nice script though :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.