Many apologies for what must be a really obvious thing, but new to Gdevelop and cannot work out the syntax for including a variable in a text input name in the conditions section. I want to create an iteration loop to repeat 16 times using a local variable, but to do so I would need to iterate the text input name on each repeat. So I want to do something like "InstTxt_[variable here] set to etc.
Looking through forum posts, I have seen that you would need to convert a number variable to a string to make this work, something like:
but unfortunately all combinations Iâve so far tried havenât worked. I have attached a screenshot for clarity (where I have so far had to manually put the iterations in 16 times for now!)
Hi ZeroX4, thank you very much for replying. Apologies, but I may be misunderstanding the solution you are suggestting, do you mean replace the text input object name in the action to the name of a child of an array variable? I have tried this quickly (and may be setting it up incorrectly) but just got an error. The text itself will always be the same in this case (âNot Enteredâ) but to make the code repeat and need to change the name of the âtext inputâ object dynamically with a variable. This is what I did try, am I on the right path thanks?
You canât reference objects with a dynamic string, unfortunately. You could give each object an instance variable, set it to the InstText number, and search on that. But to update all the InstText in one go do the following.
Put all your text objects into an object group, and then set the text referencing the group name. One action and all text objects get set:
Thanks very much MrMen for providing this solution (and the visual example is very helpful too). A group for the text input objects looks like the perfect solution for my needs thanks (must use the groups more as they look very powerful in Gdevelop!). I will also try the instance variable method you referred to for practice as that also sounds like it would be very useful further down the line!
I am very impressed with the support on this forum too, being new to it and all!