Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to check when loading a game save fails? #38

Closed
TheSkyOne opened this issue Oct 10, 2024 · 11 comments
Closed

Is there a way to check when loading a game save fails? #38

TheSkyOne opened this issue Oct 10, 2024 · 11 comments

Comments

@TheSkyOne
Copy link

i have connected the game_loaded signal to a function that will take the snapshot and process its info.
but it seems that when there is no save to be loaded, that function i connected simply doesnt get run (i presume the game_loaded signal isnt being fired?)
is there a way for me to run some code for when there is no save to be loaded?

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 10, 2024

Hi! Yes, right now the signal is not triggered if there's no game to be loaded. I could just return send the signal with a null object in that case, I think it makes sense in case you want to react to that scenario. Let me check if I can implement this change and I will let you know!

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 10, 2024

Hi! Try the new release, it's now sending a null in the game_loaded signal. Remember also that you can set to true the second parameter of the load_game method when loading a game. That will create the Snapshot if it doesn't exist.

@TheSkyOne
Copy link
Author

so to be clear on the usage, in my function that is connected to game_loaded i can now check

if snapshot:
    #code when snapshot is found
else:
    #code when no snapshot was found

also, for installing this new release, is it ok for me to not transfer the autoloads folder and keep using the old one? or are there changes in there too that i need? because i have a change that i find i keep having to transfer between releases. because you defined a class called Player in the PlayerClient but as common with many games i already have a player class so i keep having to change the one in the plugin to PlayerInfo 😅
and another thing, i notice in the cfg file version is 1.8.2 but in the release its 1.8.3. im assuming its ok for me to change it manually?

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 11, 2024

That code snipet is correct, yes!

To install the version you can only install the changed files + the bin folder. You can check what files changed in the commit, but it's basically the snapshots_client.gd and the json_marshaller.gd. About the issue with the Player, I feel so dumb! 🙈 I might release a new version fixing that, I wonder how no one told me before to change it! Thanks for letting me know!!

And one last thing, the version in the cfg file is updated now, just download the addons.zip file again.

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 11, 2024

Hi again! I just created a new major version renaming all Player related classes to PlayGamesPlayer. Hope that helps in the future! Check the release note for a more detailed explanation of the changes!

@TheSkyOne
Copy link
Author

im not super well-versed with using github yet so im struggling to find how to access the commit to see the changes 😅
tho since this is a compatibility breaking release and since you have changed the name of the Player class (which was the main thing i changed for my own, thank you for doing that 😄), i decided to delete the entire plugin and reinstall all of it.
tho now i am getting this issue
Screenshot 2024-10-11 150034
when trying to enable the plugin in the project settings.
by the way, what is the JSON marshaller for? i dont think i need it since i use only logging-in and snapshots, but i dont want to delete it without understanding what it does.

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 11, 2024

So, if you're going to use version 2.0.0 you have to install the whole plugin, which I understand is what you did already. That error appears sometimes the first time you install the plugin, have you retried closing the project and reopening? I thought I solved it but maybe not, or maybe it's just something completely different.

About the Json marshaller it is indeed needed, it's what converts the json data from the plugin to the gdscript classes. You actually need all the files in the plugin.

@TheSkyOne
Copy link
Author

TheSkyOne commented Oct 11, 2024

yeah i have tried restarting the project. still it gives the same error when trying to enable it.

well thats good to know.

You actually need all the files in the plugin.

does that mean that even if i dont plan to use some of the clients such as the achievements clients i should still keep the script around and just disable it in the globals tab?

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 11, 2024

Maybe you don't need all the files, but some of them have dependencies between them, that's why I wouldn't recommend deleting any files, unles you know exactly what you are doing. I'll also try not disabling anything until you're sure everything works. Then you can try disabling the autoloads that you don't need and check if everything still works fine.

About the error you mentioned, there's any other error message? The editor usually shows more messages in the output tab in the bottom dock.

@TheSkyOne
Copy link
Author

im sorry, that was totally my mistake. i forgot i removed the marshaller even before i asked you the question and that caused the issue.
i am also seeing now that i am getting null for when there is not snapshot, so that seems to work as well!
thanks for adding this and all the support for the plugin 😄

@Iakobs
Copy link
Collaborator

Iakobs commented Oct 11, 2024

nice! I'm glad you're progressing!! As always, I'll close the issue now but feel free to ask anything!

@Iakobs Iakobs closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants