Hi,
I am reading a saved array and would like to count only the children that have content, or only the empty ones.
But how?
The function VariableChildCount(variable) counts all of them.
Thank you.
Hi,
I am reading a saved array and would like to count only the children that have content, or only the empty ones.
But how?
The function VariableChildCount(variable) counts all of them.
Thank you.
You could use for each child to go through the array and then either check a value or the existence of a child if the array held structures.
Just be careful because just trying to read a variable can create it if it doesn’t exist.
What is the array used for?
Why are some indexes empty or null. Maybe you can change your method so empty indexes weren’t created.
Hi Keith,
part of the game is a wheel of fortune.
Players can use existing wheels or create and save their own wheels.
Players can save 6 of their own wheels and decide for themselves in which position.
The higher the position (1st place), the more valuable it is in the game.
Therefore, there may be positions that are not occupied.
When the player leaves the editing scene, the name of the wheel is stored in an array at the selected position.
In another scene, the player can see their own wheels in an overview and select one.
This overview should, of course, only display existing wheels (graphics and name) and arrange them dynamically.
For this arrangement, I need the number of occupied positions or the non-empty children of the array.
At the moment, I am solving the problem indirectly:
With the counter “countercustomwheels” and if the condition is true, I use another counter to count what I need.
How are you setting it up. Are you using the index as the value or the value in the array? A larger screenshot of the events would help.
An array of structures might be the easiest way to do it. There wouldn’t be any empty indexes and you could use for each could to go through the array. IDK if you’re using fixed size spaces but you could save the start and end angle in a structure along with a color and value. You could then draw the slices on a shape painter. A bit like a pie chart.
Hi Keith,
sorry for delay.
Was on vacation…without my laptop…slowing down.
Here is a screenshot of the event showing the wheels to the player.
In this scene, the player is shown the wheels to choose from.
The wheel then spins in the next scene.
This works perfectly.
I’m still unsure. What do you want to accomplish. Are you trying to improve the events you just posted or are there other events that have issues?
Hi Keith,
I don’t want to cause any confusion.
I understood your last post to mean that you want to see what I do with the event.
My main concern was whether there is a simple function that can count non-empty children of an array.
If that works then it seems fine. If there was a way to only save the valid wheels then you could use repeat # of wheels or for each child but if you only have 6 wheels then this seems fine.