This is a rather unusual request, but I want to be able to find out how many actors there are in my game project using scripting, so I don't have to update the number every time I want to add another actor.
I tried using $gameActors.length(), but this did not work, I think in part due to the fact that the .json file for Game Actors essentially uses an array of arrays.
Any ideas?
$gameActors refers to the party in the current game, and if there are several saved games, they might each have different content in $gameActors.
$dataActors is what you've got in your database.
What are you doing that you need to find out this number via a script, and specifically the number of actors in the project/database rather than the number of actors in the party?
But the number of actors in the database is not going to change as you play the game, is it? Unless you have a plugin that creates more actors.
The number of actors in the party will change, but not the number in the database.
I know the number of actors in the database isn't going to change over the course of the game, but it will over the course of development, so doing it this way means that I never have to go in and update the specific number of actors I want it to run through, as it will automatically run through the number of actors that are, and no more than that, meaning that the code is optimized for the fewest iterations without me needing to ever change the number that it measures.