*** This script selects or deselects vertices using a number of connected walls as a threshold. The script must be executed in VERTEX selecting mode.

// Parameter list begins
mov r96 0 // Consider rightside-connected unpaired walls
mov r97 1 // 0 - deselect, 1 - select
mov r98 0 // 0 - equal, 1 - more than, 2 - less than, 3 - not equal
mov r99 2 // Target complexity
// Parameter list ends
~~~ Default parameters:
~~~ mov r96 0 // Consider rightside-connected unpaired walls
~~~ mov r97 1 // 0 - deselect, 1 - select
~~~ mov r98 0 // 0 - equal, 1 - more than, 2 - less than, 3 - not equal
~~~ mov r99 2 // Target complexity
and r98 65535
mov r00 -1
for each nonignored wall r00
  findmovwalls r00
  mov r01 -1
  mov r03 0
  for each wall r01
    getwallmovestate r01 r02
    if r02 == 3  inc r03  endif
    if r96 != 0
      if r02 == 2
        getwall r01 nextwall r04
        if r04 == -1
          inc r03 
        endif
      endif
    endif
    if r02 == 1  inc r03  endif
  continue
  if r98 == 0
    if r03 == r99
      selectvertex r00 r97
    endif
  else  if r98 == 1
    if r03 > r99
      selectvertex r00 r97
    endif
  else  if r98 == 2
    if r03 < r99
      selectvertex r00 r97
    endif
  else
    if r03 != r99
      selectvertex r00 r97
    endif
  endif  endif  endif
continue