raccoon commented on a Page, NextInLine for mIRC (hop to channel with unread messages)  -  Jan 10, 2015

What ordering are you using to determine the next channel to hop to?

Yawhatnever  -  Jan 10, 2015

It looks like it goes to the channel with the oldest unseen message.

raccoon  -  Jan 10, 2015

This version doesn't keep track of any hash tables. It merely looks for windows with a message or highlight switchbar color, and compares their idle times for the highest value. Highlights take priority. It works across multiple server connections for windows of all types: channels, queries, chats, and then any other window-type that has an /echo -m color. It keeps 2 temporary global variables that expire after 2 seconds.

F4 { unset %_f4.* | scon -a _F4 | if (%_f4.wid) window -a $v1 }
_F4 { ; by Raccoon 2015
  var %i = 1
  while ($window(*,%i)) {
    var %win = $v1, %wid = @ $+ $window(%win).wid
    if ($chan(%win).idle) || ($query(%win).idle) $&
      || $calc($chat(%win).idle) { var %idle = $v1 }
    if ($window(%wid).sbcolor == highlight) { 
      set -eu2 %_f4.wid %wid | set -eu2 %_f4.idle 999999
      break 
    }
    if ($v1 == message) && ((!%_f4.wid) || (%idle > %_f4.idle)) {
      set -eu2 %_f4.wid %wid | set -eu2 %_f4.idle %idle
    }
    inc %i
} }
Tritonio  -  Jan 11, 2015

If you join the version with the highest idle, and you take your time between calls of the script, your cycle over the windows might miss some for a loooong time if they are getting a lot of messages very fast.

If you join the lowest idle time, you might miss windows that have messages in them in favour of those that are getting a lot of new messages right now. Unless of course you call your script fast enough, which you won't if you have many channels open.

If you use the ticks of the oldest unread message, you are guaranteed to cycle over all windows with unread messages regardless of how often you call your script.

But I didn't know about the .idle before yesterday when you showed me that other script of your. hehe. Thanks Racoon.

biase  -  Feb 16, 2015

nice idea

raccoon  -  Apr 13, 2015

I would say a better way is to create a single variable with a tokenized list of channel @wids that are $addtok'd with On Text. As $addtok won't add a duplicate, the list should only build as new unread messages come in, and you can pop them off the beginning of the list On Active. It wouldn't be a stand-alone alias, but would only require those two events.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.