String Type Object Variable does not come up right in Events Sheet

Hello. I’m currently working on a project and I was assigning a text variable of an object to a global variable if the player came in contact with said object. The issue I ran into was when I assigned the objects variable, the editor in the event sheet added a “To String” since it said it would otherwise return a number. In the screen shot below, the bottom action is what GDevelop automatically put out after I clicked on my object and its string variable. That already seemed strange, since its a string, I don’t understand why it is saying it would return a number.

What I ended up doing is manually adding the “VariableString” post mark instead of it simply being “Variable”. The top example in the screenshot is what I wrote out myself and that one worked as intended.

Keep in mind, I made sure to click the “change the text” and not “change the value” so I’m not sure why it wrote it out as a regular variable and converted it to a text after the fact. I’m sure I missed something obvious but let me know.

Screenshot 2022-08-29 162917

To recreate, simply have a text object and try to change the text to that of an object’s string variable. In that order too, not the other way around. It always writes out the “To string” despite it not being a number variable to begin with

Hi CTXB,

Your variable is automatically being converted toString due to the Text Object ONLY accepting a string result.
In the past people had to manually add this, a recent updated has made this an automatic feature.

image

Right, but its already a string. The variable i have is a string type to begin with. And yet the only option it gives me, that does not require me to type, is that it sets it as a number variable converted to string. When i let it do “to string” it sets the string to 0 (zero). It obviously didnt return the string the object had. So i have to type VariableString so it doesnt need to be converted. But should it not do that already, and recognize that its already a text variable? Why does it pull it up as a number and then “convert” it to a string?

If i didnt make it clear, both variables are strings. But when i set one text value to another, it pulls it as a number variable.

@CTXB This was discovered previously in [Solved] Object variables don't have value/string versions...? and then fixed in String and number object variables both have same name · Issue #4223 · 4ian/GDevelop · GitHub

2 Likes

Ah okay. Thank you for letting me know! When i was searching around to see if this was a known issue, this went right under my radar.

1 Like