mIRC Home    About    Download    Register    News    Help

Print Thread
#244652 17/03/14 12:10 AM
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
if there is an background color then i want only the foreground color.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Thanks a lot mate!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard