Re: processing input

From: Daniel A. Koepke (
Date: 06/30/01

On Sat, 30 Jun 2001, Kras Kresh wrote:

> The stuff they type is sent while they type rite?

No.  CircleMUD, like most servers that operate over telnet (but aren't
necessarily telnet-compliant servers), is line-oriented because the
overhead of sending a single character, plus TCP headers, is generally too
steep.  The client can send whenever it wants, of course, and CircleMUD
tries to not be too picky about that.  Most clients send when you press
ENTER.  The buffering until a newline is done because packets can be split
up, so you're not guaranteed to read the newline on the first call to
read() (but are guaranteed that it's somewhere in there).

> then that gets stored in a buffer.. thats how u get kicked for typing
> too much rite?

No.  You press ENTER after you type too much.  It tries to read and buffer
until it gets a newline.  If it doesn't get a newline from read() before
you fill up the space, it truncates.

> i'm doing this thing where anything they send does nothing cuz someone
> else has taken over their body. they just get a message that says
> "your commands are invalid" or something like that but cant do that in
> command_interpreter cuz the person that took over will be entering
> commands for them

You need to place a copy of the descriptor that was taken over somewhere.
You can use this as a flag that the character was taken over (if, say,
old_desc != NULL, then they're possessed).  You need to go after a line
was peeled off the line buffer (get_from_q()) and see if their input
should be processed.

This is done in comm.c.  We have:

  if (!get_from_q(&d->input, comm, &aliased))

we might consider adding

  else if (d->old_desc) /* Possessed, so throw away the input. */

Or, if we replace the original get_from_q() check with

  if (d->old_desc || !get_from_q(&d->input, comm, &aliased))

then the input is queued until old_desc is cleared, at which point it'll
be processed one at a time, in FIFO order (First In, First Out).


Please avoid using common Internet abbreviations for English words ("2"
for "to", "b4" for "before", etc.) since it makes things more difficult
for non-native speakers of the English language (by either confusing them
directly or breaking automated translation services).


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST