The easiest way to do this is to keep a tokenized list of the channels you're on. When there is "activity" (however you choose to describe that) in any non-active channel, put that channel at the front of the list and delete it from wherever it was previously. Then, use one of the function keys, such as F5, that you're not currently using for something else instead of Alt-A (one key press instead of one combination of two keys presses).

; Uncomment (remove the colon from the beginning of the line for) the events you wish to consist of "activity"
; in the channel, and add any other events, following this pattern, that might apply.
;

; on *:OP:#: Update.List
; on *:DEOP:#: Update.List
; on *:VOICE:#: Update.List
; on *:DEVOICE:#: Update.List
; on *:BAN:#: Update.List
; on *:UNBAN:#: Update.List
; on *:JOIN:#: Update.List
; on *:PART:#: Update.List
; ctcp *:*:#: Update.List
on *:TEXT:*:#: Update.List
on *:ACTION:*:#: Update.List
on *:NOTICE:*:#: Update.List

; Set the [color:#B00000]%chans variable with a list of CID#chan pairs: %chans = 3,#mIRC 1,#HelpDesk 1,#mIRC 2,#mIRC
;[/color]
alias -l Update.List {
  • ; If the active window is the channel triggering the event, simply return, since we're in it and can see it.
    ;

    if $active == $chan { return }

    ; Unset the current list pointer, since it's now invalid after more channel activity.
    ;

    unset %Current.List.Item

    ; Reset the %chans variable to reflect the new order. Prepend the current CID#chan
    ; pair to the front of the list, removing the pair from anywhere in the list it's currently found.
    ;

    set %chans $+($CID,$chr(44),$chan) $remtok(%chans,$+($CID,$chr(44),$chan),1,32)
}

; Cycle through the most recent activity channel windows in 'most recent activity' order.
;

alias F5 {
  • ; Increment the list pointer. If there isn't one, it gets created and set to 1; if there is, it is simply incremented.
    ;

    inc %Current.List.Item

    ; Decide whether to use the first token (most recent activity) or the next one down the list.
    ;

    if (%Current.List.Item <= $numtok(%chans, 32)) var %CID#chan = $gettok(%chans, %Current.List.Item, 32)
    else var %CID#chan = $gettok(%chans, 1, 32)

    ; The first part of this value is the Connection ID (CID) of the channel that had activity.
    ;

    var %CID = $gettok(%CID#chan, 1, 44)

    ; The second part of this value is the channel name.
    ;

    var %chan = $gettok(%CID#chan, 2, 44)

    ; This optional portion can be uncommented to minimize the current window before switching to the new window.
    ;
    ;
    window -n $active

    ; Now switch to the channel with the last activity.
    ;

    scid %CID window -a %chan
}

I have tried to make it easy for you to follow the aliases used and (hopefully) made it easier to follow the variables used as well.

Update.List is called by any events that are uncommented and therefore "count" as activity in a channel.
F5 allows you to cycle backwards through the "most recent activity" channel list.

%chans hold the list of CID/channel pairs.
%Current.List.Item holds the pointer to the current one you've switched to.
%cid#chan holds the pair pointed to by %Current.List.Item variable.
%cid is the CID portion of %cid#chan variable.
%chan is the channel portion of the %cid#chan variable.

I think this is what you had in mind, at any rate.

EDIT: fixed the #.wefoi#wefoij problem.
EDIT: fixed the !channel problem.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C