This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

how can i load all save file if it exist then fill it in array

save file name
var save_data_name = ["save_1","save_2","save_3","save_4","save_5","save_6","save_7"]
slot that need to fill var player_dict = [{},{},{},{},{},{},{}]

example if save_1 and save_3 exist,
if will fill like this var player_dict = [{dict_1},{},{dict_2},{},{},{},{}]

in Engine by (429 points)

1 Answer

0 votes

i will write a way which came to my mind:

var player_dict = []
for name  in save_data_name:
      player_dict.append({"dict_" + str(name[-1]) :   name) 

# name[-1] will give last character of name, 1, 2 etc..
#after this will append that name to array as dictionary.
Example if you have save1 and save4, then player_dict will be like this:

{dict1 : "save1",dict4 : "save4"}

i hope it will help you.

by (72 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.