mIRC Home    About    Download    Register    News    Help

Print Thread
convertion to $chr #170730 13/02/07 02:42 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
How to do this

When i'll type :

/convert hi

it'll return

$chr(104),$chr(105)


learn learn learn
Re: convertion to $chr [Re: learn3r] #170731 13/02/07 03:48 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Code:
alias convert echo $gettok($regsubex($1-,/(.)/g,$!chr( $+ $asc(\t) $+ ) $+ $chr(44)),1-,44)


$maybe
Re: convertion to $chr [Re: Mpdreamz] #170756 14/02/07 02:07 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
Not working


learn learn learn
Re: convertion to $chr [Re: learn3r] #170759 14/02/07 03:21 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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.

Re: convertion to $chr [Re: DJ_Sol] #170761 14/02/07 03:21 AM
Joined: Dec 2002
Posts: 1,528
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,528
have you tried $asc() ? Example: /echo $asc(?)


Those who fail history are doomed to repeat it
Re: convertion to $chr [Re: landonsandor] #170762 14/02/07 03:24 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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.

Re: convertion to $chr [Re: landonsandor] #170763 14/02/07 03:24 AM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
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


-Kurdish_Assass1n
Re: convertion to $chr [Re: Kurdish_Assass1n] #170765 14/02/07 03:26 AM
Joined: Dec 2002
Posts: 1,528
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,528
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


Those who fail history are doomed to repeat it
Re: convertion to $chr [Re: learn3r] #170766 14/02/07 04:48 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
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).

Re: convertion to $chr [Re: schaefer31] #170801 14/02/07 08:26 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
sorry my mistake


works perfectly...

Last edited by learn3r; 14/02/07 08:46 PM.

learn learn learn
Re: convertion to $chr [Re: DJ_Sol] #170802 14/02/07 08:29 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
working

Last edited by learn3r; 14/02/07 08:46 PM.

learn learn learn