ASCII valuer

By Trikloa on Aug 08, 2008

So, this is just a little snippet where, if you type !ascii (symbol) it will give you the ASCII value of that symbol. And, if you !char (number) it will give you the symbol for the given value.
I used the /goto command because I fail at /while's ;x
the purpose for making it is because I use $gettok a lot, and I have to devise the $chr(?) thing.

on *:text:!ascii*:#:{
  if (!$2) { msg # Nothing doesn't have an ASCII value, $nick $+ . }
  elseif ($len( $2 ) > 1) { msg # I can only find the ASCII of one symbol at a time, not $len( $2 ) symbols. }
  else {
    :asciistart
    inc %ascii#
    set %symbol $chr( %ascii# )
    if (%symbol == $2) { msg # The ASCII of the symbol " $+ $2 $+ " is %ascii# | unset %ascii# , unset %symbol | halt }
        if (%symbol != $2) { goto asciistart }
  }
}
on *:text:!char*:#:{
  if (!$2) { msg # I can't give you the ASCII result of nothing }
  elseif ($2 !isnum) { msg # Give me a number. }
  else { msg # $chr( $2 ) }
}

Comments

Sign in to comment.
Eugenio   -  Aug 08, 2008

/me rates 6
since I have seen so many of these and have so many in my directory which are better than this one.

 Respond  
guest598594   -  Aug 08, 2008
\" $+ $2 $+ \"

You can use:

$qt($2)
 Respond  
EL   -  Aug 08, 2008

Hmm a 3.I disagree its usefull for ppl who don\'t waht to look it up themselves and it \'\'does\'\' work well.\"Rate it or Hate it?\"...7/10.`-.-´

 Respond  
napa182   -  Aug 08, 2008

you dont need the goto or a while loop you can just do

msg # $+($chr(36),chr,$chr(40),$asc( $2 ),$chr(41))

also on the !$2 part maybe have it msg back $chr(32) for space

 Respond  
Soulkeeper   -  Aug 08, 2008

Laziness in a bucket. ;<

 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.