mIRC Home    About    Download    Register    News    Help

Print Thread
color problem in theme. #233917 23/09/11 09:05 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
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.
(Red)
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

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

Last edited by sparta; 23/09/11 09:21 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: color problem in theme. [Re: sparta] #233920 24/09/11 12:17 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, I'm still learning regex, so I'm certain this can be improved greatly. But it works...

Code:
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.

Last edited by Riamus2; 24/09/11 12:28 AM.

Invision Support
#Invision on irc.irchighway.net
Re: color problem in theme. [Re: Riamus2] #233922 24/09/11 08:52 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
working.. thank you..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: color problem in theme. [Re: Riamus2] #233942 25/09/11 06:43 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
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:
Code:
on ^*:topic:#: {
var %line = $urlc($1-)
}

any idea on this one to?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: color problem in theme. [Re: sparta] #233947 25/09/11 08:27 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Add this line right above the RETURN line:

Code:
  if (%c == $null) { var %c =  }


Invision Support
#Invision on irc.irchighway.net