mIRC Homepage

Control Highlights feedback from scripts

Posted By: BhaaL

Control Highlights feedback from scripts - 04/10/15 11:52 AM

As of mIRC 7.43, the only highlight-related script identifiers are related to whether highlighting is enabled or not, and which words are added to the highlight list.

There is no way of finding out if a channel is in a highlight state (or particularly, which one; such as Message or Highlight), and there is also no way of re/setting that state.

My current use case looks like this:
I'm on a channel with certain chatty bots that should not trigger a highlight, regardless of whats going on. But as soon as someone else talks, I want the switchbar light up as usual. Note this assumes "Always highlight on message" is on.
Ignoring the bots is not an option, since they still tend to convey information at times (which is handled by other scripts etc.); but the channel constantly being highlighted in red makes it a bit cumbersome to filter out actual activity from the bot-related ones.

Suggestion 1: on HIGHLIGHT
on ^*:HIGHLIGHT:#: {
  ; don't highlight on channel messages from OperServ
  if ($nick == OperServ) { haltdef }

haltdef acts similar to the other events and allows the highlighting to be skipped. This does not clear the highlight state, but simply prevents it from changing as result of the current highlight.
This event might benefit from a message filter too (like on TEXT), but technically I don't need that for my specific use case.

Suggestion 2: extend /ignore
/ignore -h OperServ!services@my.personal.network

-h specifies that highlights from the given nick/address should be ignored.

Suggestion 3: $chan(N/channel).highlight or $chan(N/channel).hlstatus; along with /highlight channel new-status (or something similar)
on *:TEXT:*:#: {
  ; .highlight might return "none", "message" or "highlight", depending on highlight type
  if ($chan($chan).highlight == none) {
    ; /highlight changes the current highlight type
    /highlight $chan none

This one is a bit more cumbersome to use, although it was my original suggestion. Adding an identifier to retrieve the current highlight status probably makes sense, but using it like without knowing which happens first (the text event being triggered, or the highlight state being set) might lead to odd behavior. Also, using $chan for retrieval but /highlight for changing it feels a bit off, since both are related to the highlight state of a channel.

Your thoughts?
Posted By: Loki12583

Re: Control Highlights feedback from scripts - 04/10/15 01:11 PM

$window(#).sbcolor and /window -gN # can be used to get and set highlight state
Posted By: BhaaL

Re: Control Highlights feedback from scripts - 05/10/15 04:12 PM

Wow, looks like I missed the obvious. Only looked at channel related commands, but not window related ones. Thanks! smile

Edit: Hm, that leaves me with the problem of keeping track of channel state, since on TEXT is too late (sbcolor has already changed to message by then) - but at least something I can work with
© 2020 mIRC Discussion Forums