I was working on a cupboard that opens and closes automatically, with two tables: One that tells if the cupboard door is open (and what it contains) , and the other checking the probability of the door opening. However, it tells me (in Windows Frotz) that the “store is out of dynamic memory”, and in Gargoyle it states that I am attempting to “read to write-only address”.
How do I fix these? And what do the different tables (TABLE, PTABLE, LTABLE, PLTABLE, & ITABLE), when should I use them (ting a value, etc.) and what are their limitations?
I don’t know ZIL, but I know a thing or two about the Z-machine.
Tables can be placed anywhere in the first 64 KB of the story file. However, only the first x bytes of this is dynamic memory, i.e. memory that the program is allowed to change during execution (the value x is held in bytes 14 and 15 of the story file).
If your program tries to store a value in a table outside dynamic memory, you can expect to get an error message from the interpreter like “Store outside dynamic memory.”
I would think there is either a keyword you can use to say a table should be stored in dynamic memory and you need to use it here, or there’s a keyword to say a table should be stored in static memory and you’re currently using it but need to omit it.
A bit more on ITABLE. There’s some alternate syntaxes and also an additional flag, LEXV with special meaning (used when storing the result of parsing the user input). You usually also assign the TABLE to a GLOBAL so it can be referenced inside the routines. Hopefully the following table illustrates the possibilities.