Converting to JSON for save/load with auto created temp variable

Could converting to json the one we use when loading from storage we previously saved when we use in save/load system?

I mena this
image

Auto generate this temp var?
Like is there any reason we need to make temp var for it?
Couldn’t it be automated?

2 Likes

Sometimes loading a text from storage is just text. I suppose we could have 3 actions, Load a Number, Load a Text, Load a JSON String and Convert it immediately to this variable.

They would still need to keep the action Convert JSON string ThisJSONString and store it into variable WhereIWantIt because half the time people use that, it’s not after a load from storage action.

None of that explains why we need to create that temp variable manually

I get its some kind of container
BUT its container we we can’t do anything with
And serves only as container

Unless there is some other reason to it?
I only used it for loading so i may lack knowledge here

You lost me. I probably didn’t understand something. Anyway I’m not saying they can’t make the feature request you want I was just pointing out to the devs that they can’t get rid of those 2 actions as they are because they will still be needed.

I am not asking to take away any action
I am asking for us NOT to need to create temp variable that serves only as container
Actually that is also my question is there a reason we need to have that temp var and it cannot be done automatically?

Guess i’ve asked something like this before…
love to have a simple action like

condition-----save game in slot “” , load game from slot"",

…if variable are “really” needed to be specified then even removing the temps steps would be fine

i guess it shouldn’t be a problem to recognize if it’s a string or a number

I actually tested it when making save/load tutorial
You can set temp var to number or text
And it will work the same
I bet it would also work with bool structure/array
Cause its just container

It does not check if value is proper but just take it
Cause again it acts just as container

So if it can do that we need to create it manually?
I ask could it be done behind the scene without our input

Unless there is some reason/use case for that temp var
Like i said i only used it for save/load and maybe i don’t know everything
But for now it looks to me like its one additional step that could be automated

Ok this confusion from me seems to be because there is nowhere that says I can’t Load MyGroup from storage MyStorage and store as text in PermanentVar! Aha! And furthermore, never convert JSON string PermanentVar because it is not in JSON format but is just a string.

So if you ask why do we have to use a temp var here it makes no sense to me. You can use a temp var if that is what your situation calls for, but you can also just put it in your permanent var and not touch it again or worry about converting it because it’s not JSON. Not all things in storage are JSON. But all I say is how does GDevelop know if we want what we are loading in a temp var or permanent var and what is the var name unless we tell it?

It seems to me instead you want to automate some sort of combination relating to a specific situation in which you are loading a JSON string from storage and putting it into a temporary variable and then converting it from that variable into a permanent variable. So you want like Load MyJSON from MyStorage and put it into PermanentVariable as converted and formatted already. Which is what I suggested in my first reply. Make a LOAD JSON action that does all that but then, devs pls don’t get rid of these other actions because a LOAD JSON doesn’t fit every situation where you might need to load something from storage or convert something from JSON.

EDIT Basically just a plea not to nerf the system even more. Thanks.

1 Like

Maybe problem here is we look on it in a different way
You look at it as flexible system that allows you to do A or B (convert or just load cause there is nothing that should be converted)
And i get that
I would not argue over nerfing anything here so you get me wrong

However i am into streamlining so we as users have as simple system as possible even if it means bringing minor changes just to get rid of extra step which could confuse a lot users
I made save/load tutorial so i don’t need to repeat myself over and over
I made it as simple as humanly possible so any1 can step by step look how its done
And ppl are still asking me why THIS don’t work
Issue is ppl tend to make mistakes hell i am 1st one here that does
Look how i write look how many times i write wrong word cause i think i wrote something correct and even so you as human can deduce what i meant
Engine will simply not and will not do in this case what i wanted
That is what i get with dyslexia
So i really believe that taking away from users any option that leaves space for mistakes is crucial

So check this out

What i marked in red is optional
We don’t need to use it (put anything there) but we can
We have option if we need/want to

So how about action
Load MyGroup from MyStorage ( OPTIONALLY ) convert what is loaded as JSON string ) And store it into PermamentVar

Wouldn’t that be best of two worlds?
Again i am not asking to nerf here anything neither do i want to take away some option from users
I just wanna simplify usage
We just get rid of one action
Now we have 1 action for saving and 1 for loading
Where loading have option we can tick to convert json string and store it into that permanent var
And if so if we choose optional converting that converting will be done in temp var we don’t create
Its just container created on the fly
Where if we did not tick that optional option
This action in terms of functionality would not change at all

So in other words we removed 1 place where someone could try to store wrong values
I even seen ppl type there (i mean in field for temp var) storage/group name instead of variable
Where ppl also try to put there that permanent variable

2 Likes

Hmm, you make a compelling argument. And I don’t want to be the bad guy saying, “No we must keep everything difficult and confusing for beginners!” So I have to agree with you.

My only concern is that if they remove the separate action “Convert JSON string” because that is necessary by itself. But your idea in itself is not bad.

1 Like

I would never opt in for something that will take away something form any1

I don’t understand what you mean here

Wouldn’t my solution keep functionality while streamlining it and just narrow it down to one action?

Explain it cause if what i propose would harm any user i would be more than happy to remove this request

1 Like

No what you propose would not harm any user. It is a very sensible suggestion to have the optional tick box to let the user express that the information they are loading from storage is JSON and that they want it converted into their prime variable.

But I meant only, the devs keep a separate action to “Convert JSON string” to a variable or object variable. This is still useful by itself. For one example, I like to use arrays of JSON strings of object information, and then I need an action that can convert them from JSON later. So imagine I have a JSON string and when loaded from storage, it is then converted to an array called GameObjects. But all the children of that array are just JSON strings themselves. They aren’t converted when I convert the parent array of course, nor would it be good to do so. Because I don’t mean them to be converted until I want them to be. Otherwise I want them stored as JSON strings inside that array. I don’t think this would confuse beginners because I don’t think they would be storing game information like that anyway. So if they never need to use a “Convert JSON string” action then they won’t be confused about it.

1 Like

To combat what you describe that action i proposed above would need to have allow loading from storage or not being optional
So it can either be used to load from storage and then convert json then store in var or not convert json and just store in var what is loaded

Where not specifying storage and group would simply not load from storage anything but would just convert json string

But that would feel like complicating stuff just to get rid of 1 action
Now i get why it would be wise to keep separate convert json action

Maybe someone will come here with better idea than mine which would make both of us happy

1 Like