mIRC Homepage

color problem in theme.

Posted By: sparta

color problem in theme. - 23/09/11 09:05 PM

i using this alias to get a underlined url with a different color then the other text, and now i trying to solve how i can make it keep showing the color of the text that was entered befor the url. if i see a url like this if posted to a channel/query.

CTRL+K4 test www.testing.com test again.
I get the default color after the url, i know that i added the $oclr at the end of the alias and it will give me the color i echo non colored text with, but i using this untill i can get help with solving the problem, any "easy" way to solve this problem

usage: $urlc($1-)
alias urlc {
  return $regsubex($1-,/((?:(?:unreal|ftp|https?):\/\/|www\.)\S+)/gi,$+($clr($urlco),$chr(31),\t,$chr(31),$clr,$oclr))

$clr return the CTRL+K chr.
$urlco return the color i want to see the urls in. (14)
$oclr return the text color i using.(15) (this part i want to change to any color that was used infront of the url)
I hope you understand what i trying to do here.

;---- edit

Spoted a error from my side, fixed now. but the problem remain.. smirk
Posted By: Riamus2

Re: color problem in theme. - 24/09/11 12:17 AM

Well, I'm still learning regex, so I'm certain this can be improved greatly. But it works...

alias urlc {
  noop $regex($1-,/((\d{1,2})|)(?!.*(\d{1,2}|).*(?:((?:(?:unreal|ftp|https?):\/\/|www\.)\S+))).*(?:((?:(?:unreal|ftp|https?):\/\/|www\.)\S+))/gi)
  var %c = $regml(1)
  return $regsubex($1-,/((?:(?:unreal|ftp|https?):\/\/|www\.)\S+)/gi,$+($clr($urlco),$chr(31),\t,$chr(31),%c))

This should work fine regardless how many colors are used or where they are used (before or after the URL). It also works if Ctrl-O is used. *However*, it doesn't handle multiple URLs if there is a color change between them (it does work if there isn't a color change anywhere between the URLs). It will also not work if Ctrl-K is used by itself instead of using Ctrl-O, or if background colors are used with Ctrl-K.

I'm sure this can be improved and those issues included. I'm just already beyond what I really understand, so this is as far as I can get.
Posted By: sparta

Re: color problem in theme. - 24/09/11 08:52 AM

working.. thank you..
Posted By: sparta

Re: color problem in theme. - 25/09/11 06:43 PM

Noticed a problem, i echo the topic to me when i change the topic, and if the topic contain a url it still show the "url" color to the topic text behind it. and i send the topic true the urlc with the command:
on ^*:topic:#: {
var %line = $urlc($1-)

any idea on this one to?
Posted By: Riamus2

Re: color problem in theme. - 25/09/11 08:27 PM

Add this line right above the RETURN line:

  if (%c == $null) { var %c =  }
© 2022 mIRC Discussion Forums