Delete game pieces

I have ‘many’ ‘some’ game pieces that are no longer used in my modules. Trouble is that their original definitions preclude traits such as delete and select if ALT or whatever.
They keep cropping up as errors.
Can Vassal refresh counters also (be made to) delete all game pieces that no longer have a png/bmp /etc file within the module?
Hey, some things I did with my initial vassal modules are no longer relevant and have been replaced by the more powerful recent Vasal iterations.

What’s precluding a delete trait ? I sometimes include clean up like this in a startup routine, where the number of scenarios makes one off updates too onerous, but that relies on being able to identify the counters and the counters all having a delete trait on them.

Refresh Counters can delete stuff that doesn’t have a map - but I’ve never found a use for that (I assume it is not for normal use).

Preclude, as in does not include.

From what I understand so far, you will need to add a delete trait to the pieces to be deleted, refresh your scenarios and add a startup gkc to remove the pieces.

If the pieces are no longer in a palette but have the same name as ones that are then there is a refresh counters option that will deal with that. You could temporarily add in some pieces just to get the refresh done- put them in a hidden palette if you want to keep them around for maintenance. To display the names of the old pieces, define a temporary mouseover, as it doesn’t require anything to be refreshed. You also need this info to use in the next step, as you have to distinguish the existing from the old counter. If your old pieces already share names with pieces that you need to keep, then you will need PieceId rather than BasicName for the delete step, next.

Next part is to delete the old counters…. Use a startupGkc that searches for your obsolete counters (worst case, a Regex that lists all the basicnames or pieceids to be deleted).

Hopefully, at least the pieceids of the obsolete counters are unique. If you have somehow managed to reuse them, then you have a bigger challenge likely requiring some manual processing of each predefined scenario file.

Hope this outline gives you enough to give it a go.