Create variables (or text objects) automatically


I’m trying to figure it out a way to create variables, or just to store information and then display it somewhere else.

I recently post a video both here and in the gdevelop subreddit, where you can see that everytime I catch a fish, it display its seed number. This is the link for the video: 2021-10-08-17-12-32 GIF | Gfycat

However, at this stage of the game, the player can only see the seed (and the fish) at the time he catch it. It does not storage in anywhere.

Can anyone help me with this? So it would be something like this: 1) when the player catches a fish, it changes to another scene, where it generates the fish based on the current noise seed (already implemented and exposed on the video) 2) the seed has to be storage in a variable so, further, you can 3) check your inventory in a different scene where it displays every seed (in a text expression) and the fish generated by this seed.

The thing is, if I had a small number of fish (like 15, for exemple), I could simply create those 15 variables, the 15 text objects and do it manually. But the point is that I want to use the maximum amounts of patterns (the perlin noise allows up to 65.536 if i’m not mistaken, but I would limit it to less) and, to do that, I would have to come up with an expression or something to automatically storage and than show it, otherwise I would have to manually create thousands of variables and text objects.

Ideally, I think it would be something like this.

i) Catching fish and storing their patterns:
If - caught a fish//
Do - generate the seed (randominrange(1, 1000), let’s say) and create the object (fish); also Create a new variable and storage the currentseed on it;

ii) Showing your fish inventory
Repeat for each number of the variables creates on i) step. Do - create a new text object at a given position and modify the text to show the seed.

Is this possible to do with the built in tools in gdevelop? Thanks!!

Hi. To create variables dynamically, I suppose you should use arrays (look at the Array Tools extension - Array tools [GDevelop wiki]), or write JavaScript (JavaScript Code events [GDevelop wiki]).