I’m currently trying to make the structures more list like.
To be precise I’m adding an expression to access children of a structure by index so that it is possible to for example pick the first, last or a random child item. With an additional “remove child by id” action it would be possible to use them as queues.
But since we have global and scene variables with value and string return type each (+ the whole thing on object variables), adding expressions in the variables treeview branch creates multiple entries that look almost the same and are beginning to create a mess.
I have thought about creating a new group called “structure” but since you can access subitems from a structure the same way as normal variables it wouldn’t make much sense to split them up.
To be honest I don’t really have an idea how to properly organize the expressions.
What are your thoughts on this issue?
Not sure, what utility would have? Which class of queues are we talking about? ![:slight_smile: :slight_smile:](https://forum.gdevelop.io/images/emoji/apple/slight_smile.png?v=12)
I’ve some ideas, but almost all of them can be replicated (with more or less event bloating) with the current structures.
Of cause you can circumvent thouse issues but only by using a lot of code bricks for a relatively simple task.
The idea came when I started working on a vocabulary trainer game. In order to pick a random item from a structures subitems you need to give the first dimension an integer name/key to use the random expression. But removing an item from the improvised “list” causes a gap so you need to keep track of the items already picked. Which creates a lot of logic.
With an expression like “getKeyFromIndex” you could pick any item from the structure, read out its value and remove it afterwards. If you try to access the next random item just pick a random value between 0 and “VariableChildCount” (new expression in trunk) since the number of items in the structure dynamically decreases.
My first thought was something like getRandomSubItem but the more general approach creates more use cases and in combination with a math->random expression one can get the same functionality.
Some other usecases than vocabulary trainer would be a “pairs” clone, card games, quizzes and the like.