Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I7 - Array Error

1 view
Skip to first unread message

Purple Dragon

unread,
Nov 13, 2009, 4:07:45 AM11/13/09
to
Greetings all. I’m having a bit of a problem. I found one other
mention of this same problem, but unfortunately there was no solution
given so I’ll go over it again. When I try to compile my game I get
this:

Translating the source – Problem

and the actual error that is showing up is this:

auto.inf(32942): Error: An array must have between 1 and 32767
entries
> Array Blk_Heap -> MEMORY_HEAP_SIZE + 16;

I know what I added to make this error show up, but I’m not sure how
to fix it. Briefly, what I am trying to do is to have different text
printed in the status line at different points in the game. I have
broken the status line into three lines, some or all of which might
have text at any given point. The text comes from a series of tables
that look like this:

Table 1
line1 (indexed text) line2 (indexed text) line3 (indexed text)
"" "" ""
"" "" ""
"" "" ""
"" "" ""
"" "" ""

There is obviously other code that put that text into the status line,
but that part all works fine. The problem is that at one point in the
game I want a random row from this table to be displayed, but as the
game progresses, I want to draw from a different set of text. No
problem. I just added another table and switched to that one and it
works great. Same with the third table, but when I add a fourth one I
get the message above.

I’m compiling with Z8, so I tried it with Glulx and got a different
message, this one saying that the MAX_STATIC_DATA had been exceeded.
I raised that value and got it to compile to Glulx, but it still won’t
work in Z8. Now, I could just use Glulx instead, and that is what
I’ll do if I have just hit a wall with Z8, but I thought I would give
you learned ladies and gentlemen a chance to set me right as to the
error of my ways. Plus I’m just sort of curious as to why exactly
this is happing in the first place. I think I have some idea, but I
won’t mention my half-baked ideas, so as not to embarrass myself too
much if I’m wrong. :)

Any help would be much appreciated.

Andrew Plotkin

unread,
Nov 13, 2009, 11:42:47 AM11/13/09
to
Here, Purple Dragon <purpledr...@gmail.com> wrote:
> Greetings all. I?m having a bit of a problem. I found one other

> mention of this same problem, but unfortunately there was no solution
> given so I?ll go over it again. When I try to compile my game I get
> this:
>
> Translating the source ? Problem

>
> and the actual error that is showing up is this:
>
> auto.inf(32942): Error: An array must have between 1 and 32767
> entries
> > Array Blk_Heap -> MEMORY_HEAP_SIZE + 16;
>
> I know what I added to make this error show up, but I?m not sure how

> to fix it. Briefly, what I am trying to do is to have different text
> printed in the status line at different points in the game. I have
> broken the status line into three lines, some or all of which might
> have text at any given point. The text comes from a series of tables
> that look like this:
>
> Table 1
> line1 (indexed text) line2 (indexed text) line3 (indexed text)
> "" "" ""
> "" "" ""
> "" "" ""
> "" "" ""
> "" "" ""

Indexed text is expensive. The compiler insists on reserving a
reasonable amount of heap memory for every indexed-text object
(because they all *might* be used). A quick experiment shows that this
Table 1 reserves about 4K of memory. The heap is implemented as an I6
array, which counts again MAX_STATIC_SIZE, so there you are.

If you want to cut that down, you'll have to look at alternatives.
Non-indexed text is the obvious choice. If you need the variability,
you might be able to create a simple object with a few properties and
a customized printed name. Or, depending on how your code is
structured, you could get rid of the tables and have a function
(phrase) that prints one of several options based on a global
variable.

--Z

--
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*

Purple Dragon

unread,
Nov 13, 2009, 3:35:39 PM11/13/09
to
On Nov 13, 8:42 am, Andrew Plotkin <erkyr...@eblong.com> wrote:

That's pretty much what I was thinking. I knew that using indexed
text would take up more memory, but I had no idea how much more.
Right now this game has one room, a half dozen objects, and one other
character. Except for basic descriptions for those things there is
almost nothing other than the text to be printed to the status bar.
It's amazing how fast something like this can spin out of control.
Well, amazing to me, but then again I'm not really much of a
programmer. I can think of a couple of other ways to do it, but they
would require some pretty complicated if...then type sections, and
using the tables is just soooo much easier.

Obviously, using non-indexed text would be a good solution, but I
don't think I can do that in this case. I did try that initially, but
the problem is that the status line changes based on input from the
player. Actually, all they are doing is pushing a button, but when
they do that the text changes. If I just wanted the text to print
like normal I could use 'say' commands and it would work fine, but
when I tried to change the status line I got a message saying that no
row in the table had been chosen. I took this to mean that the when
the text is printed to the status line, it is already beyond the scope
of the rule so the program doesn't know where to look. The only way I
could figure to make it last long enough was to use indexed text.

Andrew Plotkin

unread,
Nov 13, 2009, 3:41:35 PM11/13/09
to
Here, Purple Dragon <purpledr...@gmail.com> wrote:
>
> Obviously, using non-indexed text would be a good solution, but I
> don't think I can do that in this case. I did try that initially, but
> the problem is that the status line changes based on input from the
> player. Actually, all they are doing is pushing a button, but when
> they do that the text changes. If I just wanted the text to print
> like normal I could use 'say' commands and it would work fine, but
> when I tried to change the status line I got a message saying that no
> row in the table had been chosen. I took this to mean that the when
> the text is printed to the status line, it is already beyond the scope
> of the rule so the program doesn't know where to look. The only way I
> could figure to make it last long enough was to use indexed text.

Regular text can be made to work here.

"[if ...]Lights On[otherwise]Lights Off[end if]"

This is a valid text, which can go in a table; and it has nothing to
do with choosing rows, as long as the condition ... is not based on a
temporary variable. It could refer to a global variable, or a property
of some object, or a "decide whether" phrase.

Erik Temple

unread,
Nov 13, 2009, 3:56:05 PM11/13/09
to
On Fri, 13 Nov 2009 14:35:39 -0600, Purple Dragon
<purpledr...@gmail.com> wrote:

> If I just wanted the text to print
> like normal I could use 'say' commands and it would work fine
>

> [snip]


I assume you're using Basic Screen Effects' Table of Fancy Status to set
up the status line. It sounds to me like you don't really need indexed
text. So, you should be able to cut things down to one table and use
(plain) text variables:

<code>
L1 is a text variable. L1 is "customize me!"
C1 is a text variable. C1 is "your ad here".
R1 is a text variable. R1 is "call now!".

Table of Fancy Status
left central right
"[L1]" "[C1]" "[R1]"
</code>

When you want to change the text in the table, you just change the
appropriate global variable:

change L1 to "Eat at Joe's";

Will that work for you?

--Erik

Erik Temple

unread,
Nov 13, 2009, 4:06:02 PM11/13/09
to
On Fri, 13 Nov 2009 14:56:05 -0600, Erik Temple <ek.t...@gmail.com>
wrote:

> I assume you're using Basic Screen Effects' Table of Fancy Status to set
> up the status line. It sounds to me like you don't really need indexed
> text. So, you should be able to cut things down to one table and use
> (plain) text variables:
>
> <code>
> L1 is a text variable. L1 is "customize me!"
> C1 is a text variable. C1 is "your ad here".
> R1 is a text variable. R1 is "call now!".
>
> Table of Fancy Status
> left central right
> "[L1]" "[C1]" "[R1]"
> </code>
>
> When you want to change the text in the table, you just change the
> appropriate global variable:
>
> change L1 to "Eat at Joe's";
>
> Will that work for you?


By the way, if you really do need indexed text (i.e., you need to put
indexed text substitutions within the text variables), then this method
will still result in something like 75% improvement over the method of
switching between four different tables of indexed texts, because you can
do it all with a single table.

--Erik

Purple Dragon

unread,
Nov 13, 2009, 11:51:04 PM11/13/09
to
Okay, this is a bit embarrassing. I am using text substitutions,
which is why I went to indexed text to begin with, but the way I had
it set up I was doubling up everything. Basically, I had the tables
set up as indexed text, then was reading that text and making it an
indexed text (yes, I know it already was) so that I could add a
different substitution withing the text itself. So basically, all I
did was to make all the tables regular text and it all works and
compiles fine, even after adding in the other tables I wanted to
(total of eight).

Thank you all very much for the help. I'll learn one of these days.

PD

0 new messages