Created a defualt name scheme for Character Sheets

This commit is contained in:
PersonGuyGit 2024-04-14 12:07:59 -06:00
parent 4ada3391eb
commit 61643203d3
2 changed files with 8 additions and 3 deletions

View File

@ -46,6 +46,7 @@ func _prep_PlayerCharacter_Template():
func save_data_to_csv(data: Array, file_path: String): func save_data_to_csv(data: Array, file_path: String):
var file = File.new() var file = File.new()
if file.open(file_path, File.WRITE) == OK: if file.open(file_path, File.WRITE) == OK:
for row in data: for row in data:
file.store_string(format_row(row)) file.store_string(format_row(row))
@ -69,7 +70,13 @@ func _on_But_SaveChar_pressed():
_prep_PlayerCharacter_Template() _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. # To Do. Format data into the correct table.

View File

@ -28,8 +28,6 @@ func _prep_PlayerCharacter_Template(loadedCSVData):
pSingleton.armor = loadedCSVData[6] pSingleton.armor = loadedCSVData[6]
pSingleton.quote = loadedCSVData[7] pSingleton.quote = loadedCSVData[7]
print("P Singleton")
print(pSingleton)
func load_csv_data(path): func load_csv_data(path):