Turn text into ascii

By juhapuha on May 12, 2008

This snippet will turn text to ascii marks like this:

I use leet as an example and this is a result:

$+($chr(108),$chr(101),$chr(101),$chr(116))

This script might help scripters. :)

Ah and the usage is: $ascii(text)

alias ascii {
  var %i = 1
  while (%i <= $len($1-)) {
    var %k = $+(%k,$eval($chr,0),$chr(40),$asc($mid($1-,%i,1)),$chr(41),$chr(44))
    inc %i
  }
  return $+($eval($+,0),$chr(40),$left(%k,-1),$chr(41))
}

Comments

Sign in to comment.
dma   -  May 30, 2019

how do you use it???

 Respond  
ksolt21   -  Jan 25, 2011

cool dont under stand any of it but its cool

 Respond  
Jethro   -  Jan 25, 2011

ksolt21, you install the code in your mirc remote. The return command used in the script is for you to utilize it as an identifier to call from it. You can add an echo command like this:> alias ascii {
var %i = 1
while (%i <= $len($1-)) {
var %k = $+(%k,$eval($chr,0),$chr(40),$asc($mid($1-,%i,1)),$chr(41),$chr(44))
inc %i
}
$iif($isid,return,echo -a) $+($eval($+,0),$chr(40),$left(%k,-1),$chr(41))
}/now you can enter the command as: /ascii

Then the code will print out mirc character numbers of the characters you've entered.

 Respond  
ksolt21   -  Jan 25, 2011

how do u use it

 Respond  
baseballer790   -  Mar 09, 2009

What is it?

 Respond  
juhapuha   -  May 12, 2008

Yeah :) but atleast that\'s good for my use because it returns those ascii values like $+($chr(number),$chr(number)) :)

 Respond  
foobar   -  May 12, 2008

Pretty good, I made an alternative using binvars:

alias ascii { 
  bset $iif(!$prop,-t) &ascii 1 $1-
  return $bvar(&ascii,1,$bvar(&ascii,0)) [ $+ [ $iif($prop,.text) ] ]
}

Also, a little pointer: $eval(,0) (in your script) can be $!. So: $eval($chr,0) can be $!chr and $eval($+,0) can be $!+.

Perhaps try adding a way to do the opposite and convert asc values to actual characters? As I did in mine.

 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.