So I'm creating a basic text-based RPG styled game. It utilises Rock-Paper-Scissors match-ups and level-based progression.
Because this game is so grindy to get anywhere, and to aid in my black box testing I would like to create a save & load system. So I could save and quit the program and before it quit it would give me a code of all important details. And then when I returned to the program I could re-enter this code and return to where I was at.
In my mind I imagine it to be similar to the system used in Lego games when creating characters, where there is a code accompanied with the character so that you can save the code and re-enter it to get the same character appearance back. However I'm relatively new to programming and am not sure if there's a better way to do this or how I would go about doing this.
Here's my attempt at saving the code:
if TrainTimes == 5483:
print("Sorry to see you leave!")
print("Here's your code to sign-in later:")
code= name,power,rivalname,level,AP,limit,ExpGain,TotalExp,attack,defense,speed,evasiveness,health
print(code)
break
And here's an example after I played through and got to this point:
('Oliver', 'dark', 'Jim', 8, 3, 25, 14, 0, 5, 1, 1, 5, 10)
I'm not sure how I would then load this though, I can imagine I should use something like:
while SaveLoaded == False:
(FUNCTION)
for the code that would normally play without a save-file, and that I'd need to change SaveLoaded to True if I loaded a save. But how would I get the program to identify and load in the code?
Thanks in advance!