mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
I tried the built in highlighting for a while and didn't care for it. Because it removes all control codes and colors the whole line. That does make it easy to spot, but I'd like something less intrusive.

My suggestion is to have an option to only highlight the nick. While leaving all other control codes intact. This is very tricky and a huge pain to do in a script.

a simple example
mirc built in highlight does this:
Hello pball, how are you?
My suggestion is to do this:
Hello pball, how are you?


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
While it is not a bad idea, doing this with a script isn't a pain, it's pretty easy.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
I'd love to make some snide remarks about you saying this is easy. But I'll just say make one and then tell me it's easy. Unless there is something I'm missing this isn't as easy as you think it is.

I thought I had it figured out but more and more things are breaking the script i've made.


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Depending on what exactly you want to do with the highlighting, it can be as easy as using $replace.

In an on text event, halt the normal text and echo out an updated version that include $replace($1-,pball,pball) -- Needs the control code there... I can't do control codes from work. And if you want it to highlight when you type as well, you can do the same with an on input event.

Now, you can improve that by adding dialogs that let you set up highlighting without having to manually edit the script each time. You could also take and make it less likely to highlight incorrectly by having it check the tokens (words) and make sure that it matches the entire word (not counting punctuation).

For example: Hello, pball.
But not: Let's play opball.

Doing that just requires looping through the words and checking for a match while ignoring punctuation.

However you do it, that's really not too much work. Setting up a dialog to handle it so you don't have to manually edit the script anytime you want to add more highlights would be the most work... the rest would go pretty quickly. You might even add in traytip popups for highlighted text if you wanted to.

If you've already started trying to make it work, you might want to post what you've got and explain what isn't working right and someone can help you fix it. Easier than asking someone here to write the whole thing from scratch.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
on $^*:text:$($+(/\b,$me,\b/i)):#:{ 

  ; Change this line if you wanna change the colour:
  var %c = 4

  echo -bfilmrt # $regsubex($1-,$+(/\b,$me,\b/i),$+($chr(3),%c,$me,$chr(3))) 
  haltdef
}


Not tested but I think this should work.

Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
@ hixxy
Sorry but that fails at the basic concept of what I want

original line:
hello pballz how?

your snippet:
hello pballz how?

anything after the nick returns to the default color, which is exactly what I don't want

@ Riamus2
You also miss the problem that turns this from a simple replace into a painful script. If you replace the nick with the nick and color codes around it you mess up the colors after the nick, like in the example of what hixxy's script does.

My current script loops through the whole sentence and grabs the last codes before the nick then places that after the nick to preserve the color after the nick has been colored. It also counts bold, underline, and reverse characters. It also picks up the control code strip character.

I don't need help making a script really, I'm just trying to suggest what I feel is a good idea, but it seems no one else understands the problem since they can't see the difficultly in a solution script wise.

P.S.
I actually though adding a new option to the $replace identifier would be nice. Make it so that any control codes before the item being replaced would be automatically continued after the replaced item.

Example
(lets say k is ctrl+k the color character and the .cc on $replace is the proposed addition to that command)
set -l %phrase k4Hello pball how are you?
echo -a $replace(%phrase,pball,k9pball).cc

result: k4Hello k9pballk4 how are you?

it'd take the k4 that's active before the replaced text and apply it after replaced text, this would make everyone's simple idea of just replacing work, while keeping all other control codes intact.

Last edited by pball; 16/03/10 01:41 AM.

http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
on $^*:text:$($+(/\b,$me,\b/i)):#:{ 

  ; Change this line if you wanna change the colour:
  var %c = 4

  echo -bfilmrt # $nhighlight($1-,%c)
  haltdef
}

alias nhighlight {
  var %c = $2
  return $regsubex($1,$+(/,$chr(3),(\d{1,2})(.*?)\Q,$replacecs($me,\E,\E\\E\Q),\E/gi),$+($chr(3),\1\2,$chr(3),%c,$me,$chr(3),\1))
}


Simples.

Doesn't take background colours into account, let me know if you need that adding.

Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
@ hixxy

did you not read what I said every time? All control codes includes bg color, underline, bold, reverse, and the strip control code character.

works better that the last one but to busy to try and break it now, i'll try it more later


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Dec 2002
Posts: 483
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
I use this one.

Code:
on ^*:text:*:#: {
  if ($me isin $1-) { echo -lt $chan < $+ 5 $+ $nick $+  $+ > $1- | haltdef }
  if ($ip isin $1-) { echo -lt $chan < $+ 5 $+ $nick $+  $+ > $1- | haltdef }
  else return
}

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
@pball: Please don't act like a dick to people who are trying to help you. This is not how you get what you want. For something as easily scriptable and non-requested as this, I don't think mIRC is going to support this natively, so your best option here is to be nice to the people helping you, otherwise you're basically going to have to script it on your own. Perhaps you should think about that before putting on that aggressive tone of yours.

On a related note, I don't see anything wrong with hixxy's code. Given that you haven't tried it for very long, what exactly can you tell us is wrong with it?

edit: a regex more like the following would work better, by the way:

Code:
  alias rquote return $+(\Q,$replacecs($1,\E,\E\\E\Q),\E)
  alias nhighlight {
    return $regsubex($1,/(\x03(\d{1,2}(?:,\d{1,2})?).*?)?( $+ $rquote($me) $+ )/g, $+(\1,$chr(3),$iif($2,$2,4),\3,$chr(3),\2))
  }


You can then replace the nhighlight alias with the above.

Last edited by argv0; 18/03/10 08:26 PM.

- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You might already be aware of this, I'm not sure, but you can escape a block of characters by using \Q...\E. This means your $rquote alias could simply be:

Code:
alias rquote return $+(\Q,$replacecs($1,\E,\E\\E\Q),\E)


Your way is of course valid too, just seems more complex!

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Fixed.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
sorry if i seemed offensive but I get that way when people misunderstand what I've clearly said multiple times.

multiple people pasted examples or talked about methods that wouldn't keep all control codes intact.

also in hixxy's method is it possible to apply background colors, underline, bold, reverse to the nick?

edit:
I'm sitting down to work out the bug or two in my highlight script so I can post something that will show you what I'm looking for, since words and simple examples don't seem to get what I want across.

edit of edit:
well my script is looking good with only one little bug i need to fix. I just need a method to replace stuff to fix it.

http://img85.imageshack.us/img85/3226/image2um.png

http://pball.pastebin.com/Tnp60V1T

picture of input/outputs and the script with all the examples used and explanation of the action text bug

Last edited by pball; 23/03/10 07:16 PM.

http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
Sorry for the double post, but there isn't an edit button on any of my posts in this thread any more. Is there some sort of limit for editing posts?

Anyways I fixed the only bug in that script so it displays actions correctly. I'm not gonna post it unless someone shows interest. Also I'd like to someone else make a simpler script than mine since everyone says it's such an easy thing to do.

well the FAQs came in handy, 360 min window to edit posts.

Last edited by pball; 25/03/10 04:31 PM.

http://scripting.pball.win
My personal site with some scripts I've released.

Link Copied to Clipboard