How to remove the "0" Value return from structure?

Happy new year everyone,
I have a question:
I am making a card system for my roguelike game, everything is ok but now I want to add new line for my specific cards, it will show the new line (UpgradeOption2) for my card but the other card will show “0”
How can I remove or hide the line with value “0”?
Thank in advance!


Screenshot 2025-01-01 182759

If I understand you, you don’t want all the info shown for all the cards. If I’m making the wrong assumptions. You might need to add more info.

GD handles empty strings strangely. Unless you set the value with an action like set a to “” an empty string is read as a zero.

If each item has the child but you don’t want display certain children then you could add the text in different events instead of all at once.

Set text to name or whatever

If child variable ≠ “0” then add text to bbtext

Notice that the first line uses set while the 2nd uses add. This will append the text.

If the child doesn’t exist then you could use a similar approach but use the condition that checks if the child exists.

Set text to name or whatever

If child kp exists then add text to bbtext

I wouldn’t depend on the empty string technique bc there could come a time when GD fixed it so an empty string returns null or nothing.

For consistency, each structure should have the same children. It will make life easier since you won’t need to check for the existence of the children each time. Remember, if a child doesn’t exist GD will create it if you try to read it.

Instead, maybe set unused children to something like na (not applicable)

Set text to name or whatever

If child variable ≠ “na” then add text to bbtext

Another approach would be to add a type child. Then cards could be displayed depending on their type.

If type = “power” add the text of all children
If type = “upgrade” add different text

A similar approach would be to add an upgraded boolean

Set text to name or whatever

If card.Upgraded equals true then add text to bbtext

1 Like

Wow, Sorry. I deleted my cmt

1 Like

Hi, I created a same structure named UpgradeOption2, then tried to change some variable of childs to “na” and the result:
I think i do somewhere wrong, what should I change?




I think I was imagining it in the other direction. I was thinking it was a structure of structures. Where you might have items then the item and then the upgrade or other children.

Item.Sheild.Upgrade1
Item.Sheild.Upgrade2

Your way is obviously good. We all see things from a different perspective or do things for a different reason.

Anyway, you need to look up the item in the UpgradeOption2. You could build the variable name dynamically like in the other events.

UpgradeOption2[AllSkill.Animation:Name()] ≠ “na” then add the text.

With your method, if some objects can’t be upgrade then it might be just as easy to only include the items that can be upgraded to 2. You could then use the condition

If child AllSkill.Animation:Name()
Exists in UpgradeOption2 then add the text.

It would be best to put the event as a subevent of the other for each instance. Otherwise you would need to link the text objects or use some other method to pick the text object that’s associated with the other object. You may need to link them for other reasons. IDK. Otherwise, when you try to change or read the text GD won’t know which text goes with which AllSkill.

1 Like

Hi, I think I found a temporary solution to remove the “0” text, that I will leave the unused child to structure and it wont show “0” anymore.
I will also test your solution because mine is temporary. I wish GD Dev will fix this soon.

I’ve also tried your solution, I think it works, I need to test more to be sure :smile: thanks for help, again
Edit: Well, both solution work very well with two lines but when I add third line, both solutions seem glitch, my solution will add (Structure) word between line 1 and line 3 if line 2 missing. In your solution, there will be space between them


Space between line 1 and line 3 if line 2 is missing

If I wont add the second NewLine() for UpgradeOption3, it will show only UpgradeOption3 and remove UpgradeOption2 entirely

UpgradeOption2 and 3 Var

Edit2: I think my brain is rotten :joy:, the solution is very simple. Just invert the condition

I hope it works. In my vision, the other text was added to the original bbtext object using a subevent of the original for each object. I can understand if that doesn’t work for your situation.

This is my concept. If you need separate bbtext objects that’s fine. Include your events to add the objects on the subevents.

My simple test variables

I don’t know what if anything is going to be done with the bbtext objects it might help to link everything if you need to modify the text later.

This version uses linking. I split the events just to demonstrate linking and repicking. This is just in case you’re new to linking. IDK if you do.

1 Like

I will test your approach, I think yours is easier to add Line than mine.

1 Like