Change the Color of undeclared child variable "error"

Please make sure to follow the forum’s rules before posting.
:cross_mark: Posts that do not follow the rules will be ignored, closed and archived.

[this seems to be an intentional change, and not an bug, thats why i’ve putted here]

I don’t have to much to say about it, just that this in the way it is, could lead to confuse the user, specially in complicated logics;

for example:
this logic works:

though, it shows up as an error,

my idea is that this situation should be treated different with an speciffic color like gray, or something in the middle of good or bad.

red is just TOO BAD, an BIG WARN of THIS WON’T WORK CHANGE NOW, which is not true for Arrays and Structures

Considering how they were forcing to take away from us using NOT declared vars
I wish next thing will not making them not work

Is the variable you haven’t declared declared player.inventory.unique?
Have you considered declaring it?

So, was the change intentional but completely undeclared in the patch notes?

It’s part of the patch notes:

With the option enabled “Block preview and export when diagnostic errors are found” I got 168 errors. I use a JSON file with 6000+ lines. What are your recommendations on this matter? Declaring 6000 variables? GDevelop no longer suitable for big data projects?

All my events are red now. I can’t use this version, went back to 5.6.280

I don’t know the content of your json, but usually json files repeat the same kind of attributes. So, I guess you only need to declare a few children.

It’s a bit of work, but it comes with some perks. Declaring variables allows to:

  • get auto-completion for variable names
  • avoid to select the variable type at every usage
  • avoid mistakes in the variable name
  • allow to rename a variable and have it automatically changed in all the events

Quick example.
JSON structure:

  • interface.translation.hundredsOfUniqueKeywords
  • gameData.hundredsOfItems
  • manyOtherFlatDictionaries

May be for dynamic access this is fine. But I often need direct access to the data (always for translations):

  • MyJSONfile.interface.translation.buttonName
  • MyJSONfile.interface.translation.windowTitle
  • MyJSONfile.gameData.oneItemOutOfHundreds.name

The benefits that declared variables provide are good. But this requires copying most of the JSON file keys into variables and maintaining two copies manually.

Translation is a bit specific since you often only use it in one place. You can use a dynamic access but with a string directly instead of a variable, like this: Translations["ButtonName"].
I guess that you could declare some translations that are used a lot of times to get auto-completion for them, for instance Translations.Cancel.

[i was equivocated on first edits of this message]

even though i think my central point still something to be considered.
the avarage user experience with structures is that they will be leaned to use the common way that is
myStructure.dynamicChild rather than myStructure[“dynamicChild“]
still turning “myStructure.dynamicChild way” (something that works) into an error (even if it is just in the UI) is confusing for the users

if it works, it shouldn’t be considered as an error. atleast in my vision.

fight-win

In a moment idiots will start coming here
Trying to act smart where in reality they are stupid
And turn this into circus
And worst part about it will be it won’t be circus ran by me yet it will still have idiots
I simply cannot allow this

So how about you guys start asking Davy what kind of change/compromise could be achieved to make every1 happy
Instead of proving to him something is THIS or THAT
Cause as far as i remember i proved to Davy many things and never it got me anywhere
Yet somehow trying to find common ground did

Soooooo
bei

BUT before i go

HAHHAAHAHHA

sorry, i didn’t get the point of your comment

Change was made for a reason
You will get nowhere just proving something here
Same story we had when they took away undeclared variables from us
And in the long run even so i hated that change i do see WAAAAAAAY less ppl now having issues with variable name mistakes
Still i see from time to time ppl use Variable() GlobalVariable() ObjectName.Variable()
And from that comes most of their name mistakes
But i will give credit to gdevelop team for solving 99% of problems related to variable name mistakes with this one harsh update

Same as that update this update was made for a reason
And not to be reverted
So
I would ask for something that would make everyone happy
Instead of showing that THIS now don’t work
Color change is cool idea but does not fix the issue

Or better idea would be to ask Davy what could be done
Let’s agree that new change stays
And i gonna make it clear I HATE DECLARING VARIABLES!!!
But whatever you run with dogs you get fleas
Something for something like always

NOW
I would love to hear some ideas how to get back that functionality without reverting update
Maybe we could sell our souls for new type of variables which could be undeclared?
Well on other hand we can still use Variable() GlobalVariable() and ObjectName.Variable()

Maybe we could ask for some new syntax to not make undeclared child vars work and not show error?

I DO NOT KNOW
I have no better idea than what i seen here so far
For sure giving ideas would be better option here than proving something
When just declaring variables would solve most issues i seen here so far

i’m not against the change, i disagree on the approach.
i see where this change come from but the way it was implemented caused confusion, people thought they logic stopped working, and other users will think the same.
i think this case is way different than the rework on the variables mentioning/declaring. is just an UI functionality. and it doesn’t require an step back just an change on the approach.

the new variable system makes sense and work simlarly to the Javascript, and also seems more optmized (my impression).
this UI update only affects UX and could be changed at any time in the GDevelop 5 (if no Childs Rework happen, but doesn’t seem that it will have one).

also, reverse changes or, in this case, “change the changes” its normal in any software with an good amount of users, just need an good reason, and avoid users confusion seems to me an good reason to change the color.
i just want to make it clear, this change is WELCOME, just need an improvement.

I guess the main issue is that contrary to undeclared variables:

Undeclared child-variables error messages don’t surface to the UI:

This is because variable fields work a bit differently. For instance, you don’t get auto-completion when you do more complicated expressions:

Some work has to be done on this field to improve discoverability, but I guess newcomers can already discover child-variables thanks to the variable editor and the existing auto-completion or looking at existing events in templates.

Ow i did not imply you are against the change
No one can argue that change that prevent ppl from making mistakes is bad

I meant more like
Instead of proving why it can cause problems
How about proving what would make it better?
BRAINSTORM would be key word here
The more ideas ppl with throw the better chance we get something reasonable

Looking at Davy screenshot above this message

I can clearly see that undeclared child var still have variable icon and not red X
But that is cause it try to read it as object var
WHATEVA
But maybe removing that wave underline would be possible and would help?

Actually let me apply my own suggestion and show how it could be better

Well it do actually looks better

And now this looks cool

BUT is not so visible
At the same time
IDK how it would transition to light theme

That is why i am saying again
I would love some other ppl ideas
Cause i don’t have any really good idea
And just saying that how its now is just wrong will not get us anywhere

Honestly, I don’t really understand what the problem is here…

We already have to declare 90% of our variables anyway (and i’m not happy to it..but..whatever…:man_shrugging: ). These are just the ones that were missing, so why not make them declarable and have them look and behave the same as the ones we already have?

Also, regarding autocomplete: I’m used to Custom Objects, where there’s no autocomplete at all. If you have an object variable, you just use it in the Custom Object without autocomplete, it simply isn’t there. Why? I don’t know, I didn’t design it. What matters to me is that it works. If it autocompletes, great, but I’ve never really paid much attention to it or relied on it.

..I mean if it would even looks like this:


and works without issues..i’m perfectly fine with it…i’m simple man…i guess

I had same mindset as you
Until i realized i am not only person here and just cause i don’t use something or use in very different way than others
That does not mean it should be as i see it

I still don’t get why we have anchor behavior
When i can set something to camera borders position with some offset via simple action
And have better control over it
But some ppl do use it
WHY? IDK but they do
And seems they are pretty ok with it
I am not

I like to not need to declare child vars cause i don’t need declare everything
Most of things i do here in this community is prove random users something is possible or how to do it
I just need one declared structure variable called Z

And now i can make action to change variable Z.HP
Or Z.Ammo
WITHOUT decrlaring HP or Ammo
And prove to someone my logic works or show how to do that kind of logic
YET now i gonna show someone screenshot/video with variables that looks like error (variables that don’t exist)
And so many new users will be like
Ow so red color on variable name does not make it not work
And such user will declare ammo variable
In condition/action he will write Ammo
And will wonder why in my events sheet it worked even so it was red but in his it did not

Heck even better
He won’t declare it cause he seen it works for me with red error

Change was made and since we all sit in this
Why not ask for to make it better?

That’s okay. I’m just saying that at this point, it’s better to choose one method and stick to it