mIRC Homepage
Posted By: learn3r convertion to $chr - 13/02/07 02:42 PM
How to do this

When i'll type :

/convert hi

it'll return

$chr(104),$chr(105)
Posted By: Mpdreamz Re: convertion to $chr - 13/02/07 03:48 PM
Code:
alias convert echo $gettok($regsubex($1-,/(.)/g,$!chr( $+ $asc(\t) $+ ) $+ $chr(44)),1-,44)
Posted By: learn3r Re: convertion to $chr - 14/02/07 02:07 AM
Not working
Posted By: DJ_Sol Re: convertion to $chr - 14/02/07 03:21 AM
Ok this isn't set up to work for additional words. It handles all characters in one word with no spaces. It wouldnt be difficult and I'd prefer it if it were seperate words. I'm not happy doing the dual while loop through 255 characters, but whatever ...

This returns the character code seperated by a comma.

EX: /echo -a $conv_chr(hi)
Script:$chr(72),$chr(104)

Code:
alias conv_chr {
  var %n = $len($1), %ni = 1, %t = 255, %i = 1, %fin
  while (%ni <= %n) {
    while (%i <= %t) {
      if ($left($1,%ni) == $chr(%i)) %fin = $addtok(%fin,$!chr( $+ %i $+ ),44)
      inc %i
    }
    inc %ni | if (%ni > %n) return %fin
  }
}


Wish there was an identifier that returned the $chr code for an ascii character.
Posted By: landonsandor Re: convertion to $chr - 14/02/07 03:21 AM
have you tried $asc() ? Example: /echo $asc(?)
Posted By: DJ_Sol Re: convertion to $chr - 14/02/07 03:24 AM
Doesnt work for $chr(44)


Code:
alias conv_chr {
  var %r = $remove($1-,$chr(32)), %n = $len(%r), %ni = 1, %fin
  while (%ni <= %n) {
    if ($asc($left(%r,%ni)) { %fin = $addtok(%fin,$!chr( $+ $ifmatch $+ ),44) | inc %ni | $iif(%ni > %n,return %fin,continue) }
var %t = 255, %i = 1
    while (%i <= %t) {
      if ($left(%r,%ni) == $chr(%i)) %fin = $addtok(%fin,$!chr( $+ %i $+ ),44)
      inc %i
    }
    inc %ni | if (%ni > %n) return %fin
  }
}



Ok should not matter how you put the data in, it will make it all one string and seperate the characters with commas.
Posted By: Kurdish_Assass1n Re: convertion to $chr - 14/02/07 03:24 AM
I hope This is what you're looking for, this was mentioned a couple of days ago, You can use spaces for this one and it will return a response in spaces
Posted By: landonsandor Re: convertion to $chr - 14/02/07 03:26 AM
yeah, I remember that one now lol my brain is just soo fried these days lol Im glad I disclaimer my code with "untested" LOL
Posted By: schaefer31 Re: convertion to $chr - 14/02/07 04:48 AM
Originally Posted By: learn3r
Not working


It works just fine. Be sure you're using mIRC 6.21 or later and have put the code in remotes (alt + r).
Posted By: learn3r Re: convertion to $chr - 14/02/07 08:26 PM
sorry my mistake


works perfectly...
Posted By: learn3r Re: convertion to $chr - 14/02/07 08:29 PM
working
© mIRC Discussion Forums