CHR<>ASC converter dialog

By IllogicTC on Mar 26, 2011

Screenshots

A simple, small dialog I came up with after watching a discussion on doing $chr() and $asc() conversions.

You can open it with the command /chr_asc, or use one of the menu shortcuts (Look for CHR<>ASC when you right-click a channel, a status window, or under Commands on your mIRC menubar).

Once open, select what type of conversion you want to do, and enter the appropriate data in the editbox below, and the dialog will display the results of the conversion.

Example:

Setting: CHR to ASC
Input: !
Result: 33

Setting: ASC to CHR
Input: 44
Result: ,

Also included is an "Identifier/Variable Test Area". Rather than doing /echos when trying your identifier, just type it in the top box and see the results in the bottom box. Also, you can return results of your variables by typing them in the box.

Example:
Input: $me
Output: IllogicTC
Input: $lp_nlist ( A Custom Identifier )
Output: sample.txt
Input: %variable1
Output: Hello World!

Happy scripting.

Note: Updated. Before with the identifier testing, while typing in an identifier that has parantheses it will nag your status window about $evalnext not working. Now it makes sure you have opening and closing parantheses, if applicable, before performing the operation.

;CHR<>ASC Converter by Illogic v1.1

dialog chr_asc {
  title "CHR<>ASC"
  size -1 -1 61 87
  option dbu
  radio "CHR to ASC", 1, 9 2 41 10, group
  radio "ASC to CHR", 2, 9 12 41 10
  edit "", 3, 20 24 20 10
  edit "", 4, 20 37 20 10, read
  box "Ident/Var Testing", 5, 1 49 59 35
  edit "", 6, 3 57 55 10, autohs
  edit "", 7, 3 70 55 10, read autohs
}

on *:dialog:chr_asc:init:*: did -c $dname 1
on *:dialog:chr_asc:edit:3: {
  if ($did($dname,1).state == 1) did -ra $dname 4 $asc($did($dname,3))
  else did -ra $dname 4 $chr($did($dname,3))
}
on *:dialog:chr_asc:edit:6: if ($count($did($dname,6),$chr(40)) == $count($did($dname,6),$chr(41))) did -ra $dname 7 $eval($did($dname,6),2)

alias chr_asc { dialog -m chr_asc chr_asc }

menu channel,status,menubar {
  .CHR<>ASC:chr_asc
}

Comments

Sign in to comment.
IllogicTC   -  Dec 02, 2011

@WorldDMT, many months too late I know:

I tested this situation you describe. When I input 444 on CHR to ASC mode, I just receive the code for the first digit (52), which would be the $asc(4) result.

When I input 444 in ASC to CHR mode, I receive Ƽ. Look real close, it looks like a five but it's different. I believe it's because of mIRC's support for Unicode, starting with v7.1.

 Respond  
Dani_l11   -  Apr 06, 2011

You should add multiply CHR to ASC

$!+( $+ $left($regsubex($1-,/(.)/g,$ $+ chr( $+ $asc(\1) $+ ) $+ $chr(44)),-1) $+ )

use that.

 Respond  
WorldDMT   -  Apr 05, 2011

if i put 444 will give oly 44 if id 1 is cheked or 4 if asc is cheked

444 will be $chr(444) or $asc(444)

so do u thing 444 = chr 52 or asc "," !!??

 Respond  
IllogicTC   -  Mar 30, 2011

I could, but it seems to have no effect. With all my tests, it seems to just look at whatever the first character is. However for the sake of completeness, I will work on adding this.

 Respond  
WorldDMT   -  Mar 29, 2011

hi
u have to limit id 3 to 1 when asc to chr is checked

 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.