External file weirdness

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Ice Cream Jonsey
Posts: 28921
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

External file weirdness

Post by Ice Cream Jonsey »

I have the following happening:

1) A player can create a character.
2) A player can export that character to a file. In this, I am exporting values like the character's name, strength, intelligence, etc.
3) That file can be read successfully
4) The values for the character are populated successfully

So that's RPG stuff, no prob there.

What I think is happening is this: if I declare an array in the game and recompile, suddenly the character info being read contains lots of garbage strings.

So I've got:

- version 0.40 of the game (or whatever) reading and writing characters to disk OK.
- In version 0.41 I declare an array of FatChicks[10] and set it to zero.
- I recompile
- I start the game up, version 0.41
- I can now no longer read the previously-written-to-disk characters.

This seems a little weird to me. But I don't know how it writes those files. I mean, I know what *I* put in them, but is it storing memory addresses as well? Would that explain how things got screwed up?

If I go and create a new character with version 0.41, the newly-created characters import fine.

This isn't a blocker or anything. I anticipated making tens of thousands of characters while developing this game. I am just curious if this seems like reasonable behavior.
the dark and gritty...Ice Cream Jonsey!

Roody_Yogurt
Posts: 2180
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Ok, I'm not sure I'm entirely understanding you. You're saying, you have .40 writing one thing to file, then .41 adding one more thing (even though it's just set to 0) and it's ruining the values of everything?

If so, I've also noticed some inconsistencies in behavior if I have made any changes to what is being written. I think in such cases, you really ought to delete your external files and start anew. Once you get to a point where what is being written doesn't change, you should be fine, though.

I guess Kent should take this one.

Roody_Yogurt
Posts: 2180
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Ok, reading it again, I think I get what you're saying. The mere existence of a new array is messing up the memory map or whatever.

If possible, I'd try declaring all new stuff after the stuff being written to file; maybe that'd help preserve pointer locations over more revisions.

Post Reply