danya02 / undertale-clone

An attempt to replicate Undertale with Pygame.
GNU General Public License v3.0
11 stars 9 forks source link

cant load the game after copying save file #3

Closed 3EGaming closed 4 years ago

3EGaming commented 4 years ago

i copied file0 file9 and undertale.ini to the same directory as the scripts but i just get this error: pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html Load FAILED because: Traceback (most recent call last):

File "frisk.py", line 219, in load self.flags[j] = int(k)

ValueError: invalid literal for int() with base 10: '0.08 '

is there somthing wrong with the scripts or my save file?

thanks in advance.

danya02 commented 4 years ago

This probably means that I haven't researched the game files thoroughly enough. My understanding was that the file0 file (the only one I'm currently looking at) has only a single non-integer value -- the character name -- somewhere near the top, and the rest of the file is integers. This error means that I was wrong, and there are float values in there as well.

Since I haven't done much with the project beyond basic object interactions (that don't really work either), the file0 contents are mostly ignored. As I've mentioned in #2, you can just create a new save file with all zeros, and it would work just as well. Alternatively, you can edit file0 in Notepad or similar, and replace any lines with dots in them (like this 0.08 that my program barfs on) with an arbitrary integer.

3EGaming commented 4 years ago

I have gone through the save file and found 3 lines that have -1 in them. the lines are 87 and 394 and 395. i changed these but now the console window shows 65536 32768 128 and the pygame window freezes. thanks.

danya02 commented 4 years ago

I remember that happening in my testing too, on Windows. It's probably because I'm not using pygame.event.pump(). I'm working on Linux, so I didn't need it, but Windows's detection of when a program has frozen probably depends on these internal events. See https://www.pygame.org/docs/ref/event.html#pygame.event.pump

danya02 commented 4 years ago

(The 65536 32768 128 line is a list of all so-called "layers" currently visible on screen. I made a staggering amount of questionable design decisions here, but adding a list of layers to draw and a compositor seems to be one of the good ones.)