mIRC Home    About    Download    Register    News    Help

Print Thread
mIRC Color Code finder #244652 17/03/14 12:10 AM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Hello,

How can i parse the currently color codes that are in one text with an alias.

alias: $get_code(this is test)
result: 03 04 12

- Thanks!

Re: mIRC Color Code finder [Re: westor] #244653 17/03/14 12:17 AM
Joined: Jul 2006
Posts: 3,617
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,617
Loop through the text and whenever you find a $chr(3), check if you have a number etc, how do you want it to work exactly if there is a background color?


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: mIRC Color Code finder [Re: Wims] #244654 17/03/14 12:27 AM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
if there is an background color then i want only the foreground color.

Re: mIRC Color Code finder [Re: westor] #244655 17/03/14 12:53 AM
Joined: Jul 2006
Posts: 3,617
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,617
Code:
alias get_colorindex {
  var %pattern,%a 1
  if ($prop == noback) %pattern = /\x03(\d{1,2})/g
  else %pattern =  /\x03(\d{1,2}(?:,\d{1,2})?)/g
  noop $regex($1-,%pattern)
  while ($regml(%a)) var %r %r $v1,%a %a + 1
  return %r
}
Use $get_colorindex(text).noback if you only want the foreground color.

Last edited by Wims; 17/03/14 12:57 AM. Reason: typo

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: mIRC Color Code finder [Re: Wims] #244656 17/03/14 12:57 AM
Joined: Dec 2008
Posts: 1,511
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Thanks a lot mate!