mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2010
Posts: 3
J
Jaxel Offline OP
Self-satisified door
OP Offline
Self-satisified door
J
Joined: Sep 2010
Posts: 3
Okay, I am new to mIRC and know nothing... lets get into this.

I have users with different modes in my channel: ~, @, & and +

I would like it so that on MY SCREEN ONLY, users are forced colors for their messages based on their mode. I have already figured out how to change the color of their nicknames (using the address book), but it doesn't change the color of their messages as well. So my chat screen is nothing but black and white and its hard to read. How would I do something like this?

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You would need a script to do this.
Here's a simple example:
Code:
on ^*:text:*:#:{
  haltdef
  color $chan $nick $1-
}
alias -l color {
  var %color = $left($nick($1,$2).pnick,1)
  %color = $replace(%color,~,4,&,3,@,2,+,1)
  if %color !isnum {    %color = $color(normal)  }
  echo %color $2 $3-
}

I set this up so that you should be able to easily see how it works, and be able to work with notices and actions, as well as text.
Note: It is channel only.

I used the top 5 usermodes and the first 5 colors, since you didn't specify what colors you wanted to use.

Code edited for characters and colors specified by the OP. Also included default coloring for anyone that doesn't have one of the specified usermodes.

Last edited by RusselB; 08/09/10 04:56 AM.
Joined: Sep 2010
Posts: 3
J
Jaxel Offline OP
Self-satisified door
OP Offline
Self-satisified door
J
Joined: Sep 2010
Posts: 3
Okay... where do I put that code? and how do I activate it?

I want the following colors:

~ Red
& Green
@ Blue
+ Black

I want it to be on messages only, not notices or actions.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Put the code in your remotes.
Alt + R
If the page that shows isn't blank, then click File -> New
When you have a blank page in front of you, then you can copy & paste the code.
Clicking OK at the bottom of the screen will automatically save the script in a loaded format and close the window.

See the original post, which I have edited for the new script.

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: RusselB
Code:
on ^*:text:*:#:{
  haltdef
  color $chan $nick $1-
}
alias -l color {
  var %color = $left($nick($1,$2).pnick,1)
  %color = $replace(%color,~,4,&,3,@,2,+,1)
  if %color !isnum {    %color = $color(normal)  }
  echo %color $2 $3-
}


You're using your own alias $color, and you are using mIRC's default $color identifier, or at least trying to. Sounds like asking for problems. Why not make use of the address book?

Code:
on $^&*:text:/(.*)/:#: {
  echo $nick($chan, $nick).color -bfilmt $chan $+(<, $left($remove($nick($chan, $nick).pnick, $nick), 1), $nick, >) $regml(1)
  haltdef
}


That applies the color of the nickname from the address book to the entire line. So if you gave @, +, etc, individual colors in the address book, then all their lines will have those colors. Does not apply to your own text, but you can specify your own color with Alt-K.

EDIT: It will eat spaces, though. If you want to keep something that looks like spaces, replace "$regml($1)" by:
Code:
$+($replace($left($regml($1), 1), $chr(32), $chr(160)), $replace($right($regml($1), -1), $+($chr(32), $chr(32)) $+($chr(160), $chr(32))))

Last edited by Thels; 08/09/10 11:24 AM.

Learning something new every day.
Joined: Sep 2010
Posts: 3
J
Jaxel Offline OP
Self-satisified door
OP Offline
Self-satisified door
J
Joined: Sep 2010
Posts: 3
RusselB's code broke my chat window. Messages started going to the server console screen, instead of the room screen.

Thels' code worked great... Didn't even need to look at the second part. There were no issues with spaces.

Thanks.

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: Jaxel
RusselB's code broke my chat window. Messages started going to the server console screen, instead of the room screen.

Thels' code worked great... Didn't even need to look at the second part. There were no issues with spaces.

Thanks.


Try entering two adjacent spaces, or spaces before the first word/after the last word. You'll notice those spaces will disappear. If that's not an issue, then you don't need to worry about that last bit of code.


Learning something new every day.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I wasn't asking for trouble, I just made a typo entering the code modifications.
I used $color(normal) instead of $!color(normal) so that mIRC would use it's own internal color identifier rather than my color alias.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
My apologies. In addition to the typo regarding $color, after reviewing the code I gave you, I realized that I also made a typo in the echo line.
That line should've read
Code:
echo %color $1 $+(<,$2,>) $3-


In any case, I'm glad to hear you got a code that works.

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
you can take advantage of the Highlight option for this since incoming lines that match an entry in the list can be fully colored. this approach overcomes problems such as the one Thels mentioned involving spaces since mIRC will handle the display of the line itself; all you have to do is handle the detection.

unfortunately, you can't amend the highlight list through a command as you can with Nick Colors and /cnick. this means that adding people to the list automatically is not feasible. however, you can store a custom $identifier as a highlight entry which will be called each time a message is received.

here's how you should set up your highlight list:



your main entries should be at the top, followed by those $color* entries in descending order of channel rank.

each $color* entry should be configured like so:



Change 'Match on:' to 'Nickname' and select the desired color.

now you can use the following script to detect matching nicknames:

Code:
on ^*:text:*:#:{
  if (!$highlight($1-)) || ($1- isnum) {
    set %tmpInfo $nick $chan
    .timer 1 0 window -g1 $chan
  }
}

alias color~ return $checkColor(~)
alias color& return $checkColor(&)
alias color@ return $checkColor(@)
alias color+ return $checkColor(+)

alias -l checkColor {
  tokenize 32 %tmpInfo $1
  if ($nick($2, $1, $3)) {
    unset %tmpInfo
    return $1
  }
}


you shouldn't need to change any of this unless you wish to add a new mode (such as %) in which case the modifications would be self explanatory.


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde

Link Copied to Clipboard