Returning ArrayLength? (Sarven Shepherd)

In the Sarven Shepherd level, you are asked to differentiate orcs from yaks across a wave of attacks. It seems like the best way to make the while work is if you were able to know the number of items (enemies) in the array when you create it with self.findEnemies().

I know that in Python that you are able to return ArrayLength. Is there any way to do this in the game?

Alternatively, is there a way in the game to check if the array returned a null entry?

have you tried


just a guess. not a python expert.


will return 0 if no enemies are present and otherwise, as one would expect, the number of enemies.

That was the answer. Which makes the entire script run nicely.

It would be great if an introduction to the “len” command was included in the tutorial (or had that already been covered in an earlier level).

This also works:


I believe it was used in an earlier level, though maybe not emphasized enough for people to remember.

1 Like

I suspect it might have been used on one of the “premium/subscriptions” levels – I need to register for those.

I’ve made a note to clarify that better throughout the sample code and guide.