[Inform] Function keys


Thu, 30 Nov 1995 02:39:24 +0100

This time I want to use the function keys. I read in SZM 0.2:
...the game may provide a ``terminating characters table'' by giving its
byte address in the word at |$2e| in the header.

I thought aha! that's my man. But then I remembered Andrew Plotkin's words
about setting bits'n'bytes in the header and how it'd have to be done with a
directive which Inform hasn't yet got.

So, thought I, is there a workaround? Hmm...

#REPLACEing Keyboard() I chopped and changed the relevant parts, came up with
something satisfactory and compiled it. Here's my amended code (it's only
for V5+):
...
L__M(##Prompt);
AfterPrompt();
temp_global=0;
for (i=1: i<=120: i++) a_buffer->i=0; ! clear text buffer as it's no
do ! longer automatic
{ @read_char 1 input;
switch (input)
{ 129 to 154: ! function keys
FunctionKey(input); ! sound on/off, etc
32 to 126, 155 to 251: ! ascii and
a_buffer->1=(a_buffer->1)+1; ! accented characters
a_buffer->((a_buffer->1)+1)=input;
@print_char input;
}
} until (input==10 or 13); ! doesn't do anything besides end loop
new_line; ! hence this line
@tokenise a_buffer a_table;
DrawStatusLine();
nw=a_table->1;
...

I can't get delete to work properly (well, at all really). I guess the code
might be something like this:
if (a_buffer->1>0)
{ a_buffer->1=(a_buffer->1)-1;
a_buffer->(a_buffer->1)=0;
for (i=2: i<=(a_buffer->1)+1: i++) @print_char a_buffer->i;
}

But what value should `input' return to trigger this code? The SZM says
interpreters normally handle delete, so can I be sure of the relevant value?

Function keys work fine though. Am I on the right track?

-- 
Jools Arnold                                          jools@arnod.demon.co.uk