mIRC Home    About    Download    Register    News    Help

Print Thread
#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
Joined: Apr 2004
Posts: 759
M
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
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
Joined: Jan 2007
Posts: 1,156
D
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.

Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
have you tried $asc() ? Example: /echo $asc(?)


Those who fail history are doomed to repeat it
Joined: Jan 2007
Posts: 1,156
D
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.

Joined: Apr 2006
Posts: 400
K
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
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
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
Joined: Aug 2005
Posts: 525
S
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).

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
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

Link Copied to Clipboard