How would you use data stored on a savefile? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How would you use data stored on a savefile?

In an RPG you would have your data saved and written to a text file but my question is how would you properly reopen that text file, read it's data and use it so that you can continue where you left off in the RPG

30th Mar 2017, 2:06 AM
Earl Chukwu
Earl Chukwu - avatar
7 Answers
+ 1
you can write one option per one line (like HP -- the 1st line, AP -- the second etc) and then read it line by line getting the values. Not sure if you can do this in a loop, but if you have 10--12 variables it's not difficult to write 10--12 lines of code to get all the lines from the file and assign them to variables
30th Mar 2017, 11:02 PM
Gleb Yeremeyev
Gleb Yeremeyev - avatar
+ 5
@Gleb I could just use encapsulation plus file encryption after I study file IO to make it tougher to mess with
31st Mar 2017, 10:41 AM
Earl Chukwu
Earl Chukwu - avatar
+ 2
@Gleb I actually believe a loop would work for that maybe I'll look more into file IO in Java thanks for the advice
30th Mar 2017, 11:08 PM
Earl Chukwu
Earl Chukwu - avatar
+ 2
@Gleb true but I'm just going to try to program this for fun at some point so I'm not overly concerned with that
30th Mar 2017, 11:17 PM
Earl Chukwu
Earl Chukwu - avatar
+ 1
but you should understand that player can just open this file and get himself 1000000hp or just break the game. can't really advise something here
30th Mar 2017, 11:09 PM
Gleb Yeremeyev
Gleb Yeremeyev - avatar
+ 1
yeah, I got that) but trying to find a way to make good protection may be a good challenge. good luck
31st Mar 2017, 8:17 AM
Gleb Yeremeyev
Gleb Yeremeyev - avatar
0
As it is saved on your program, open up is wired fairly just configure in the other platform you want to reprogram and send it entirely.
2nd Apr 2017, 11:25 AM
Chikwelu Gabriel
Chikwelu Gabriel - avatar