comparing counters to numbers

I’m working on my project again after a long break, and immediately ran into an issue with a counter.

I’m trying to make an object vanish when its counter hits 0, with some warning text as it gets closer to 0. Unfortunately, I can’t work out how to actually compare the counter with a number. Using ‘greater than’ and ‘less than’ just gives me errors.

Relevant bits of code:

A mote is a kind of thing. A mote is always lit. A mote has a number called MoteCounter. The MoteCounter is usually 0.
There are 31 motes.

[cut out code that moves motes into play and starts a Mote Time scene when they first show up, this part works fine]

[this part does not work fine]
Every turn during Mote Time (this is the mote of light timer rule):
	repeat with N running through on-stage motes:
		If the MoteCounter is greater than 0:
			decrement the MoteCounter;
			If N is in the location:
				If the MoteCounter less than 5:
					say "The mote of light dims and flickers.";
		Otherwise:
			If N is in the location:
				say "The mote of light winks out of existance.";
			remove N from play.

I’ve got code that moves motes into play and starts a Mote Time scene when they first show up, all of that works fine. It’s just the timer that is not working.

My error:

Problem. In the sentence 'If the MoteCounter is greater than 0 begin'  , it looks as if you intend 'MoteCounter is greater than 0' to be a condition, but that would mean comparing two kinds of value which cannot mix - a numbers valued property and a number - so this must be incorrect.

 See the manual: 14.2 > Numbers

I was trying to match this phrase:

if (motecounter is greater than 0 - a condition): 

This was what I found out:

MoteCounter is greater than 0 = a condition

I get an identical error for ‘less than’. The 14.2 section of the manual tells me all about multiplying and dividing and other fancy things I can do with numbers, and nothing about comparing them.
Chapter 11.8 does list ways to compare things using ifchecks, and it uses ‘greater than’/‘less than’, so it looks like my syntax is right. I’m not sure what the problem is.

You have 31 motes so you need to specify which one you’re talking about (if the MoteCounter of N is greater than 0: …).

Agh, so simple. I added some 'of N’s and it compiles great now. Thanks for the help!