Using get_key() to input a string

new topic     » topic index » view thread      » older message » newer message

Yes, there is an easier way to input a string, but the use of the
get_key allows me to implement real time in a multi-user rpg I'm
developing.  The problem I have is this: discluding the use of ports.e
for getting remote strings, in order to get a local string (so someone
can play locally) the game loop constantly checks the kb buffer for
characters, loads them into a sequence and grabs the entire string on a
carriage return.  I then send the string to a parser to break the string
down into verbs, nouns etc.
Anyway, with get_key, you have to manually echo the character back to
the screen, but there is not good way to implement the backspace key
(8).  Yes, it works fine for actually deleting the character sent
(through some commands) but what about erasing the character on screen?
If I put

  if char=8 and index>0 then   -- index keeps track of sequence
positioning
    buffer=buffer[1..length(buffer)-1]
    printf(1,"%s",{char})
  end if

The above is how I somewhat handle echoing of the other characters

  elsif char>=32 and char<=122
    buffer=buffer&char
    printf(1,"%s",{char})
  end if

All of the input characters work fine, but trying to use backspace
displays the ascii representation of 8, which is a rectangle with a
diamond (or circle?) cut out of the middle.  In C (ack!) I could use %c
and 8 and it would work fine (I'm assuming, used C code as example).

Any clues?

Thanks!
Kevin

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu