def lsave():
path = input("Welcome Back! Path to your save file?\n\n [SAVE] ")
sfile = open(path, "r")
save = sfile.read()
sfile.close()
return(parse(save))
# Save List Syntax:
# name, zone, map, location, equipped items, all items, path/to/file
def parse(save):
lists = save.rstrip().rsplit("\n")
final = []
final.append(lists[9].split(";")[0])
final.append(lists[0].split(" ")[1])
final.append([])
for i in range(1, 8):
final[-1].append(lists[i].split("|"))
final.append(lists[9][-4:].split(", "))
final.append([lists[11].split(", ")[0][16:]])
for i in lists[11].split(", ")[1:]:
final[-1].append(i)
final.append([lists[13].split(", ")[0][11:]])
for i in lists[13].split(", ")[1:]:
final[-1].append(i)
final.append(lists[-1])
final[1:]
return(final)
def csave():
print("Name your character!\n")
name = input(" [SAVE] ").split(" ")
if not "CSWrath" in name:
print(f"\n\nWelcome, {" ".join(name)}! I probably could have named a better character.\n")
else:
print("\n\nWell, that's something.\n")
print("Define the path to your save file.\n")
path = input(" [SAVE] ")
defaultSave = f"""Map: Forest
P|X|X|X|X|X|X
X|X|X|X|X|X|X
X|X|X|X|X|X|X
X|X|X|X|X|X|X
X|X|X|X|X|X|X
X|X|X|X|X|X|X
X|X|X|X|X|X|X
{"|".join(name)}; 0, 0
Equipped Items: Rag, Simple Blade, 3, Empty
All Items: Rag, Simple Blade
{path}
"""
print("\n\nThanks! Creating File Now.")
sfile = open(path, "w")
sfile.write(defaultSave)
return(parse(defaultSave))
def getsave():
print("Welcome to the Twisted Forest!\n\n ! Choose \"Load Save\" or \"Create Save\" !")
valid = False
while valid == False:
action = input("\n [SAVE] ")
print("\n\nThank you! Redirecting now.\n")
if action.rstrip().lower() == "load save":
return(lsave())
if action.rstrip().lower() == "create save":
return(csave())
print("Incorrect Input. Try spelling.\n")
def save(s):
superstring = "Map: "
superstring += s[1]
superstring += "\n"
for i in s[2]:
for j in i:
superstring += j
superstring += "|"
superstring += "\n"
superstring += "\n"
superstring += f"{s[0]}; {s[3][0]}, {s[3][1]}\n\nEqquiped Items: "
for i in s[4]:
superstring += f"{i}, "
superstring = superstring[:-2]
superstring += "\n\nAll Items: "
for i in s[5]:
superstring += f"{i}, "
superstring = superstring[:-2]
superstring += f"\n{s[-1]}\n"
A saving system I made. I think I got all the bugs, but if I didn't...
yall know what bugs actually are?
features