I’m porting an existing project to Vorple and have run into a problem with how it handles external files. A line like
read File of Story Progress into Table of Story Progress;
yields the error
*** Run-time problem P36: File being read is not a previously saved table: table ‘Table of Story Progress’.
What does this mean?
This problem doesn’t show up in Quixe or the IDE interpreter, so I believe it has to do with Vorple’s handling of the virtual filesystem. (I don’t understand large swaths of that article, but I’m guessing it might be relevant.)
I’m using my external file to automatically save parts of the game state, like this:
"Balls"
Include Vorple by Juhana Leinonen.
Release along with the "Vorple" interpreter.
Ball Pit is a room.
The file of Ball Counting (owned by another project) is called "ballcounting".
I believe the language about what project owns the file is important here, but I’m not clear on how.
When I specify (owned by another project)
:
- Vorple ends up giving me problem P36
- Quixe has no problem with it
When I specify (owned by project "VORPLE")
:
- Vorple ends up giving me problem P36
- Quixe gives me problem P48:
*** Error on file ‘ballcounting’: tried to open a file owned by another project ***
*** Run-time problem P48: Error handling external file.
but I’m led to understand this is expected.
When I don’t specify what project owns the file:
- Vorple gives me problem P48 instead (which makes sense I think?)
- Quixe is fine with it
Moving on:
When play begins:
if File of Ball Counting exists:
read File of Ball Counting into Table of Ball Counting;
choose row 1 in Table of Ball Counting;
now ballcount is datum entry;
otherwise:
write File of Ball Counting from Table of Ball Counting.
Table of Ball Counting
datum
0
Some balls are in Ball Pit. Understand "ball" as the balls.
Ballcount is initially 0.
Instead of taking the balls:
increment ballcount;
say "You take a ball. You have [ballcount] balls!";
choose row 1 in Table of Ball Counting;
now datum entry is ballcount;
write File of Ball Counting from Table of Ball Counting;
Instead of taking inventory:
say "You have [ballcount] balls!"
The first time this game is loaded, the “File of Story Progress” doesn’t exist, and the line write File of Ball Counting from Table of Ball Counting.
seems to run just fine.
When the game is restarted or the page is refreshed, the line read File of Ball Counting into Table of Ball Counting;
triggers instead, and run-time problem P36 appears:
*** Run-time problem P36: File being read is not a previously saved table: table ‘Table of Ball Counting’.
The file fails to be read into the table, so no ball-collecting progress is restored.
I understand this virtual filesystem stuff just enough to know(?) that all the files of this type created by Vorple games end up in the same “inform” directory of localStorage, so I keep wondering if this is a namespace issue. In reproducing the problem I’ve been careful to use unique file names (and projects with unique IFIDs, in case that somehow matters) but I continue to see problem P36 no matter what names I use.