To simplify things (I hope) I've included the details of what I've got working and what I'm needing help with as remarks in the code
Any details that I thought might be necessary are also included as remarks. I had a sequence that looked like it was working, but it failed upon testing with multiple networks, so I haven't included that code.

Code:
alias stateclick {
  var %path = $xdid($1,1).mouseitem, %state = $iif($xdid($1,1,%path).state != 2,2,1), %a = 1, %b = $xdid($1,1,%path).num
  ;ID 1 is a treeview list, which has been re-created as three check boxed lists
  ;first box is ID 17 and contains the network names
  ;second box is ID 18 and contains a list of active channels
  ;third box is ID 19 and contains a list of all nicks
  ; ID 18 & 19 may contain duplicates
  ;places/removes check for the network level correctly
  did $iif(%state == 2,-s,$iif(%path == $gettok(%path,1,32),-l)) $1 17 $gettok(%path,1,32)
  ;%path is a numeric list that is space delimited and contains one of three options
  ;1) network level only, so checks have to go in all channels for that network
  ;2) network & channel , so check has to go in the correct channel and 
  ;3) network, channel & nick, so check has to go in the correct channel
  ;eg) 2nd network, 4th channel, 6th nick would be in %path as 2 4 6
  while %a <= %b {
    ;loops through the channels for the selected network
    ;need to place/remove check in ID 18 beside correct channel
    xdid -k $1 1 %state %path %a
    var %c = 1, %d = $xdid($1,1,%path %a).num
    while %c <= %d {
      ;loops through the nicks for the related channel and checks them
      ;nick list is in ID 19
      xdid -k $1 1 %state %path %a %c
      inc %c
    }
    inc %a
  }
  slap_manager_cb $1 stateclick 1 $iif($xdid($1,1,%path).state != 2,2,1
}