Word limit of 20 words in player's command: bug?

It seems like the player’s command gets truncated after 20 words (yet the character count can go much higher). Is this a bug?

"Word Limit" by MattD

Test is a room.

After reading a command:
	say "player's command ([number of characters in player's command] characters, [number of words in player's command] words) is:-[line break]'[player's command]'."

test me with "w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20 w21 w22 w23".

Output:

code

[1] w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20 w21 w22 w23
player’s command (70 characters, 20 words) is:-
“w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20”.
That’s not a verb I recognise.

[/code]

Matt

I’ve had a look into the I6 templates (specifically Glulx.i6t), and it is the constant MAX_BUFFER_WORDS that sets the limit to 20 words. I’m not sure of the the relationship between INPUT_BUFFER_LEN, MAX_BUFFER_WORDS and PARSE_BUFFER_LEN, but if I double each of these, then this allows more words to be present in the player’s command:

[code]“Word Limit” by MattD

Include (-
Array gg_event → 4;
Array gg_arguments buffer 28;
Global gg_mainwin = 0;
Global gg_statuswin = 0;
Global gg_quotewin = 0;
Global gg_scriptfref = 0;
Global gg_scriptstr = 0;
Global gg_savestr = 0;
Global gg_commandstr = 0;
Global gg_command_reading = 0; ! true if gg_commandstr is being replayed
Global gg_foregroundchan = 0;
Global gg_backgroundchan = 0;

Constant GLK_NULL 0;

Constant INPUT_BUFFER_LEN = 520; ! was 260 ! No extra byte necessary
Constant MAX_BUFFER_WORDS = 40; ! was 20
Constant PARSE_BUFFER_LEN = 122; ! was 61

Array buffer buffer INPUT_BUFFER_LEN;
Array buffer2 buffer INPUT_BUFFER_LEN;
Array buffer3 buffer INPUT_BUFFER_LEN;
Array parse → PARSE_BUFFER_LEN;
Array parse2 → PARSE_BUFFER_LEN;
-) instead of “Variables and Arrays” in “Glulx.i6t”.

Test is a room.

After reading a command:
say “player’s command ([number of characters in player’s command] characters, [number of words in player’s command] words) is:-[line break]‘[player’s command]’.”

test me with “w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20 w21 w22 w23”.
[/code]

Output:

code

[1] w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20 w21 w22 w23
player’s command (82 characters, 23 words) is:-
“w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 w20 w21 w22 w23”.
That’s not a verb I recognise.
[/code]

But is there a tidier way to modify this, without hacking the I6 templates?

MattD

I believe you can “use MAX_BUFFER_WORDS of at least 20” to set it in I7.

I believe you’re wrong, and, sadly, Inform agrees with me on this point.

Template-hacking is the only option.

INPUT_BUFFER_LEN is in characters. MAX_BUFFER_WORDS must be less than 1/3 of PARSE_BUFFER_LEN. (We could knock out one of those constants out of the template by using a bit of math, but it’s never come up.)

Thanks for the clarification, Zarf.

Is it allowed to declared constants in I6 as expressions?

For example:

Constant MAX_BUFFER_WORDS = 20; Constant PARSE_BUFFER_LEN = ((MAX_BUFFER_WORDS * 3) + 1);

and similarly in I7:

MyConstant1 is always 10; MyConstant2 is always (MyConstant1 * 8);

If not, is a basic preprocesser for I6 and/or I7 planned?