Description for variables

Hi mates I was working and just wondering if there is a way to integrate something like this for variables
maybe with a tooltip


Look in C2 how is done when you add a new variable you have a box for input the description

This is how you later check what was written as a variable description

2 Likes

In fact add a description shouldn’t be usful if use use a good name.
I agree is the variable are called “myvarosigezorghoergh” you will get trouble to reminder what it for.

There will be integrated in the near future? Simply no.
Because the rule in programming is to give an understandable name to the variables.
A description shouldn’t be required to understand what it does. If you need a description you use a bad variable name.

If a description have to be explain, you must add it in the event sheet as a comment or a group.

2 Likes

It is true self describing variables is a good and the recommended practice but sometime when you are working on complex mechanics, it is not that easy to come up with an obvious name, and also often you just want to throw something in for temporary/local use so then you can just move on with your life. In such cases, it is helpful to use comments at least to explain what is the purpose of a variable and so being able to place comments in variable editors indeed would be useful in my opinion.

Otherwise, In general, what I like to do and what I recommend is to use something called a “variable dictionary” at the very top of each event sheet to explain the use case of each variable in the events. It is basically a giant comment with text including a list of all variables in the format

Player variables:
weaponsCollected - number of weapons collected by the player
dynamitesCollected - number of dynamites collected by the player

Dynamites:
explosionTime - the amount of time before the dynamite explode
explosionRange - the range of the explosion when the dynamite explode
…etc

Even if you think something is obvious like NumberOfLollipopsInPlayerInventory, just save the trouble and include it in a variable dictionary (comment) and explain even the obvious at the very top somewhere, so then if you ask someone to work on your project, it is save them time and also when your memory begin to deteriorate it is going to be a lifesaver. :+1:

2 Likes

This is one of the cases I’m talking all the globals starts with g_ so it’s easy for me to remember that if starts with g_ is a global variable but is just for me not a standard so even if I change the naming to camelCase.
I think is impossible for any other person to understand for what is each one of those variables unless I explain into the events, when with a simple tooltip into the variable definition can be explained in 2 lines.

That’s way I asked if is possible to have this feature, if is not possible or easy to integrate then no problem. I use comments as you say.