[Solved] Access structure string and express correctly

Hello,

i got another problem with the correct expression of variables.
in this case i got two structures with string child variables.

at first i want to set one structure string child to be like the other one.
in the next step i want to change a text object by the structure string child.

it returns zero.

i tried different ways to express it correct, but something is still wrong and i dont find a solution.

would be very happy if someone takes a closer look…

That “0” text would suggest that “Gegner[10].Name” has not been defined.

BTW, this expression image can be simplified to image

This is how i made the structure. Gegner[10].Name is defined. I still dont get what i did wrong.

Is it a structure or an array. Arrays use children name with numbers while structures use children names that are strings.

Player[1] would be an array
Player[“1”] or Player.1 would be a structure.

It would be better and less confusing to either use an array or use a structure where the child names are alphanumerical with a letter as the first character.

Gegner.P1
Gegner[“P1”]
Gegner[“P” + ToString(NumberVariable)]

Whichever way you do it. Just make sure it’s consistent and not vague. A single number can easily be misinterpreted by you and Gdevelop as an array instead of a structure.

Hi Keith, Hi MrMen,

In case it is a structure whos childs are structures with numbers.

It got it. I was wondering and came up to error postings by search… confusing

exactly it is in my case:
Gegner.0.Name

Thank you very much, SOLVED !!!

1 Like