Code:
alias slap_manager_cb {
  if $2 == sclick {
    if $3 == 6 {
      xdid -t $1 6 Slap $iif($xdid($1,6).state,Checked,All)
    }
    elseif $3 == 1 {
      .scon $4
      echo -a $1-
 [color:red]      if !$5 {
        var %a = 1, %b = $chan(0)
        while %a <= %b {
          xdid -a $1 1 $+($4 %a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%a),$chr(9),)
          inc %a
        }
      }
      else {
        var %path = $xdid($1,1).selpath
        var %chan = $xdid($1,1,%path)
        echo 4 -a %path %chan
      } [/color] 
    }
  }
  elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
    echo $color(info) -s */ slap_manager_cb: $1-
  }
} 

The above code works fine, when $5 (as marked in red) is null, however, for some reason, that same section of code also runs when $5 isn't null.

While some of the commands that are done are DCX based (and I know this isn't the DCX forum), I don't think that the problem lies with those commands, as it's the if/else combination regarding $5 that seems to be failing.

When run (with the full code), and $5 returning $null, $1- returns slap_manager sclick 1 1

When $5 isn't $null, then $1- returns slap_manager sclick 1 1 1

This is really confusing to me, since it appears to be running the same code, whether $5 is null or not.