mIRC Homepage
Posted By: SteveMagic Color Change help? - 27/02/23 08:12 PM
Hey all, several years a go obtained/learned coding to change my twitch name with every chat entry.
Code worked no problem for a while.
Now it looks like its working in mirc but isnt working in Twitch
MIRC look - [img]https://prnt.sc/2ec90VSL4eSv[/img]
Twitch look - [img]https://prnt.sc/QGT653_jl9T0[/img]

and heres the code i am using
Code
on *:text:*:#: {
  if ( $nick = $me ) {
    if (!%color) {
      set %color 1
    }
    if (%color = 18) {
      set %color 1
      msg $chan /color green
    }
    else {
      if (%color = 1) { TimerColor 1 0 msg $chan /color #8b2500 }
      if (%color = 2) { TimerColor 1 0 msg $chan /color #00ff00 }
      if (%color = 3) { TimerColor 1 0 msg $chan /color #ff3300 }
      if (%color = 4) { TimerColor 1 0 msg $chan /color #ff0014 }
      if (%color = 5) { TimerColor 1 0 msg $chan /color #808080 }
      if (%color = 6) { TimerColor 1 0 msg $chan /color #00ccff }
      if (%color = 7) { TimerColor 1 0 msg $chan /color #ffffcc }
      if (%color = 8) { TimerColor 1 0 msg $chan /color #ff0000 }
      if (%color = 9) { TimerColor 1 0 msg $chan /color #ffff00 }
      if (%color = 10) { TimerColor 1 0 msg $chan /color #002030 }
      if (%color = 11) { TimerColor 1 0 msg $chan /color #ffffff }
      if (%color = 12) { TimerColor 1 0 msg $chan /color #2EFF00 } 
      if (%color = 13) { TimerColor 1 0 msg $chan /color #C900FF } 
      if (%color = 14) { TimerColor 1 0 msg $chan /color #0000ff }
      if (%color = 15) { TimerColor 1 0 msg $chan /color #ed2dae }
      if (%color = 16) { TimerColor 1 0 msg $chan /color #ff0000 }
      if (%color = 17) { TimerColor 1 0 msg $chan /color #66ccff }
      if (%color = 18) { TimerColor 1 0 msg $chan /color #00cc66 }
      inc %color

    }
  }
}
Any help would be great, im still a noob at this so, explain it to me like im 5
And again, this code was working for years, now its being difficult
Posted By: maroon Re: Color Change help? - 27/02/23 10:26 PM
For those of us who don't use twitch, it can be hard to give advice because of how twitch violates the rules of the IRC protocol, which means things can work there that don't work elsewhere, and vice-versa.
For example, you say it's working in mIRC, but according to the "real" irc rules, it should not be. The ON TEXT event is for received text, not for text you create, so the only time where it would trigger against your own text is when you open a query window against yourself and see the incoming text from yourself. Well, maybe if the server is sending your own messages back to yourself.
At "real" irc networks, instead of the ON TEXT, we'd use ON INPUT which triggers each time you input. And the 1st line would change

from:
on *:text:*:#: {
to:
ON *:INPUT:*:{ if (/* iswm $1) return | if (!$chan) return

This is checking for input that's a /command that doesn't get messaged to channel, and also skips input that's not in a channel window

Whenever I went on twitch, i could never find any channels with anyone in it, that looks like this. The /list command to find channels didn't work
Posted By: SteveMagic Re: Color Change help? - 27/02/23 11:19 PM
Quote
ON *:INPUT:*:{ if (/* iswm $1) return | if (!$chan) return

So I should change the first line to that?

this code was working last week too, I just dont understand why it suddenly doesnt
Posted By: maroon Re: Color Change help? - 27/02/23 11:22 PM
Free shrugs to everyone
I said what works in the REAL irc protocol, i have no clue why ON TEXT would react to your own messages, without being inside a twitch channel where all this stuff is happening, to see what chatter the server is sending to you
Posted By: SteveMagic Re: Color Change help? - 28/02/23 01:38 PM
Im talking in the twitch chat though, im showing that Mirc is saying the color change is working but my color isnt changing

And suddenly the code isnt working at all
Posted By: maroon Re: Color Change help? - 28/02/23 03:41 PM
If you PM me here I can try to come in there and test what is going wrong. From googling how Twitch does things, it seems that this should work.

There is 1 hole in your script, that might possibly be the problem. If the %color variable is ever set to a number greater than 18, your script will keep incrementing the number without ever changing the color. See if this fixes the problem, typing in any editbox:

/set %color 5

edit:

This is a rewrite of your script to make it spend less time creating the color, and to fix some logic failures. If you look at how your script works, the only time that color #8b2500 is used is at the very beginning when %color does not exist, when it's then set to 1. Also, your script never executes the command to set color to #00cc66 because color=18 is instead setting the color to 'green'.

Something you probably want to fix: Your list of #hexcolors includes #ff0000 (red) twice, which is fine if you want that to happen.

The list of colors has 18 items, you can choose to add more of them by simply adding more colors to the 3 rows of #hexcolors, then changing the '18' to however many colors are in your new list.

If you don't want to see the message showing that the timer is being set, you can put the dot in front to silence it.

old:
TimerColor
new:
.TimerColor

You can also do the same thing to not see the color command, by changing msg to .msg

Code
ON *:TEXT:*:#: {
  if ( $nick != $me ) return
  set %color $calc( %color % 18 + 1)
  TimerColor 1 0 msg $chan $gettok( $&
    #8b2500 #00ff00 #ff3300 #ff0014 #808080 #00ccff $&
    #ffffcc #ff0000 #ffff00 #002030 #ffffff #2EFF00 $&
    #C900FF #0000ff #ed2dae #ff0000 #66ccff #00cc66 $&
    )
}
Posted By: SteveMagic Re: Color Change help? - 04/03/23 01:41 AM
PM Sent
Posted By: maroon Re: Color Change help? - 04/03/23 01:45 AM
Not seeing any PM's here
© mIRC Discussion Forums