# How can I test if a counter exists?

**URL:** <https://forum.vassalengine.org/t/how-can-i-test-if-a-counter-exists/79528>\
**Category:** Module Design\
**Created:** [May 1, 2024, 4:38pm UTC](https://forum.vassalengine.org/t/how-can-i-test-if-a-counter-exists/79528 "2024-05-01T16:38:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steenkh](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/steenkh/32/9815_2.png) [@steenkh](https://forum.vassalengine.org/u/steenkh)\
**Post date:** [May 1, 2024, 4:38pm UTC](https://forum.vassalengine.org/t/how-can-i-test-if-a-counter-exists/79528/1 "2024-05-01T16:38:00Z")

</div>

In The Burning Blue, there is a clock with counters for the two clock hands. I find their positions, and report the correct time of day, or if they are not set correctly, I report an error.

However, I have just realized that the counters may not yet exist, i.e. the player has not used a pre-defined scenario, and is setting up the game manually. In this case, my code crashes miserably.  
How can I test for the existence of the counters before I find their location?

---

<div class="post-metadata">

**Author:** ![JoelCFC25](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/joelcfc25/32/2687_2.png) [@JoelCFC25](https://forum.vassalengine.org/u/JoelCFC25)\
**Post date:** [May 1, 2024, 4:51pm UTC](https://forum.vassalengine.org/t/how-can-i-test-if-a-counter-exists/79528/2 "2024-05-01T16:51:38Z")

</div>

Could you just define the counters in an At-Start stack so they exist regardless of whether or not a predefined setup was chosen, and then make them incapable of being deleted (no Delete trait)?

Failing that, you could initiate your sequence with a Trigger and use the [sum and count functions](https://vassalengine.org/doc/latest/ReferenceManual/ExpressionSumCount.html#top) in the property match expression to avoid doing any of it if the requisite number of clock hand counters is wrong.

---

<div class="post-metadata">

**Author:** ![steenkh](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/steenkh/32/9815_2.png) [@steenkh](https://forum.vassalengine.org/u/steenkh)\
**Post date:** [May 1, 2024, 9:22pm UTC](https://forum.vassalengine.org/t/how-can-i-test-if-a-counter-exists/79528/3 "2024-05-01T21:22:07Z")

</div>

You could say that it would be silly not to have clock hands on the map with the clock, but the “Design Your Own” scenario was intended to be a scenario with no counters anywhere, so in order to maintain the full manual experience I went for the second solution: SumZone()

It works beautifully, thanks!
