mIRC Home    About    Download    Register    News    Help

Print Thread
#209988 28/02/09 11:11 PM
Joined: Feb 2006
Posts: 97
O
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
Was hoping anyone can help me out.

I was trying to modify mirc that when an certain script is called it would reply in different color and maybe just a selection of colors.

for example:
1e time script reply's color is red
2e time color is green
3e time color is yellow
4e time color is red again

any suggestions on how to do that or where to look for more help to figure it out myself?

ots654685 #209989 28/02/09 11:35 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In your script, press Ctrl+K then the number for the colour you want, then the text that you want coloured.

You can also put the colour number into a variable (%colour in the folowing example) and then use something like
Code:
msg $chan $+($chr(3),%colour) text
$chr(3) is the equivalent of pressing Ctrl+k in mIRC

Thus a script might look like
Code:
on *:text:Hi*:#:{
  if $me isin $2- {
    var %colour = $r(0,16)
    %colour = $iif(%colour == 16,99,%colour)
    .msg $chan $+($chr(3),%colour) Hi $nick
  }
}

As mIRC has 16 colours in it's colour pallette (numbered 0 to 15), I add an extra number (16) then check to see if the random colour number matches 16, and if it does, I set it to 99, which always returns the system default colour.

Note that some people might not be able to see/read the reply easily, as there's a chance that your reply colour matches their background colour or that it is very close (eg: yellow on white is hard to read for most people)

RusselB #209990 28/02/09 11:40 PM
Joined: Feb 2006
Posts: 97
O
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
Thanks for the reply but will this loop?

In your example it will pick all colors available but with some modification i can make it to pick only 2 5 8 as color at almost the same way?

ots654685 #209997 01/03/09 01:18 AM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Something like
Code:
alias lcol {

  ; set the colors you want to loop here, separated by space
  var %colors = 7 4 10 3

  $iif((%lcol.current >= $numtok(%colors,32)),set,inc) %lcol.current 1 
  return $chr(3) $+ $base($gettok(%colors,%lcol.current,32),10,10,2)
}
Simply put "$lcol" instead of the control-k<colornumber> in your script. Every time you call "lcol" the color is changed.

Example:
//echo -a $lcol Test
//echo -a $lcol Test
//echo -a $lcol Test

To remove the additional space, use "$lcol $+". Example:
Code:
//say $lcol $+ Hi, $lcol $+ This is a $lcol $+ test!

(you don't need the "//" in your script, they are only needed for tests with the editbox)

ots654685 #209998 01/03/09 01:18 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's a re-write using just the colours you specified, and having them loop in sequence, rather than being chosen randomly
Code:
on *:text:Hi*:#:{
  if $me isin $2- {
    inc %colour
    %colour = $iif(%colour > 3,1,%colour)
    .msg $chan $+($chr(3),$gettok(2 5 8,%colour,32)) Hi $nick
  }
}



Link Copied to Clipboard