mIRC Homepage
Posted By: xDeXx [Twitch] Rainbow nickname - 07/02/21 10:35 AM
How do I create a script that will change my nickname color rainbow-like back and forth after every message I send? (with Turbo/Prime)
Should go like: FF1F1F FF9A1F F8FF1F 44FF1F 1FECFF 1F75FF 401FFF FF1FFF FFFFFC and then from the last color to the first.
Posted By: maroon Re: [Twitch] Rainbow nickname - 07/02/21 02:28 PM
You mean attach the ever-changing colored nick to the end of your message sentence? If not, give an example of what you want.

You can't change nick to be a 24-bit color, the best you'll be able to do is use one of the color index numbers in the alt+K window. Note that 16-98 would either be those colors or would be color(normal) for older clients not supporting that. But index 0-15 can be changed by anyone to match their own background.

Choosing colors to send inside a channel text message is difficult, because unless you specify a background color for that line, there's very few colors that work well against both black/white backgrounds. i.e. try the default blue with a black background or default yellow with a white background.
Posted By: xDeXx Re: [Twitch] Rainbow nickname - 07/02/21 04:34 PM
This is pretty much what I need *click*, except that I don't need my colors randomized, I need them as I said in my first message
Posted By: maroon Re: [Twitch] Rainbow nickname - 07/02/21 10:51 PM
For anyone else reading this, if you're wanting help with twitch, please say so up front, because that's not a real IRC network, and things that work everywhere else won't always work there, and things that work there won't work on any other IRC network. So my confusion was based on the assumption you were asking to have mIRC itself creating these colors, which it can't do.

It needs to be a mix of both kinds of code, because the correct method to use is FroggieDaFrog's usage of ON INPUT, because ON TEXT does not trigger for yourself making a message in a channel. Also, instead of choosing a random color from the list, it would need to create a local variable that keeps track of the last color, so it can use the next one.

I've rarely been on twitch, so this using of .color in a message is news to me, so I'm scripting this based on the assumption that the msg .color command actually works at twitch, though it works nowhere else that I'm aware of.

My warning in my original post still applies. These colors look like they're designed to work against a black background, with the 7th of 9 colors being marginally readible. However if you have people using a white background, they're going to get irritated with this very pronto because the yellow and white text can't be seen, and the orange is a shade that's marginal.

If twitch supports a color command to force the background for your line of text to be black, that could allow people with white background to at least read your text, though they won't like it when there's a black stripe each time you make a message. Hopefully twitch either has something like that, or has something automatically to change the background color to contrast with the foreground color.

Not sure how this script will work with other people using mIRC, because I don't know if mIRC recognizes the 24-bit color index to use that to change the default color for your text. You'd need to test with mIRC running twice, because otherwise you might be seeing your outbound text instead of what the server sends back to you.

Code
on *:INPUT:#:{
  ;; if ctrl+enter was NOT used
  ;; the text isn't being pasted in
  ;; the text doesn't start with /
  ;; the text doesn't start with a user defined command character
  if (!$ctrlenter && !$inpaste && /* !iswm $1 && $comchar $+ * !iswm $1) {

  ; Hardcoded list of N colors
  var %hex FF1F1F FF9A1F F8FF1F 44FF1F 1FECFF 1F75FF 401FFF FF1FFF FFFFFC
  ; bump the index +1 resulting in the range being 1 through N
  set %color.index $calc( (%color.index % $numtok(%hex,32)) +1 )
  ; send the magic color change command
  msg $chan .color $chr(35) $+ $gettok(%hex,%color.index,32)
  }
}
Posted By: xDeXx Re: [Twitch] Rainbow nickname - 10/02/21 07:49 AM
There's literally [Twitch] in the title grin
I changed the script a little bit and it works just as I needed, but without your help I wouldn't be able to do that at all, so thank you very much!
© mIRC Discussion Forums