From 61643203d3b5137dc0253886b43f099d50748eb2 Mon Sep 17 00:00:00 2001 From: PersonGuyGit Date: Sun, 14 Apr 2024 12:07:59 -0600 Subject: [PATCH] Created a defualt name scheme for Character Sheets --- .../bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd | 9 ++++++++- .../bcirpg_game_mvp_2024_0204A/Screens/Character_Load.gd | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd index 6802acf..315edfa 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd @@ -46,6 +46,7 @@ func _prep_PlayerCharacter_Template(): func save_data_to_csv(data: Array, file_path: String): var file = File.new() + if file.open(file_path, File.WRITE) == OK: for row in data: file.store_string(format_row(row)) @@ -69,7 +70,13 @@ func _on_But_SaveChar_pressed(): _prep_PlayerCharacter_Template() - var file_path = "user://character_data.csv" + var file_path = "" + + if pSingleton.name != "": + file_path = "user://" + pSingleton.name + "_data.csv" + + else: + file_path = "user://character_data.csv" # To Do. Format data into the correct table. diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Load.gd b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Load.gd index 47c5a24..14efa2d 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Load.gd +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Load.gd @@ -28,8 +28,6 @@ func _prep_PlayerCharacter_Template(loadedCSVData): pSingleton.armor = loadedCSVData[6] pSingleton.quote = loadedCSVData[7] - print("P Singleton") - print(pSingleton) func load_csv_data(path):