MOO-cows Mailing List Archive
[firstname.lastname@example.org: Re: Modifying player properties based entering any command]
------- Start of forwarded message -------
Content-Type: text/plain; charset="us-ascii"
Date: Wed, 19 Mar 1997 23:34:44 PST
From: Jeff Dubrule <email@example.com>
Subject: Re: Modifying player properties based entering any command
To: MOO-cows wizards list <firstname.lastname@example.org>
X-Filter: mailagent [version 3.0 PL44] for email@example.com
Resent-From: clue-cows <firstname.lastname@example.org>
Errors-To: clue-cows <email@example.com>
At 11:07 PM -0800 3/19/97, Christopher Unkel wrote:
>On Wed, 19 Mar 1997, Kipp the Kidd wrote:
>> At 05:27 PM 3/19/97 PST, Scott Robinson wrote:
>> >Ok, you will have to set your connection to "binary".
>> >(set_connection_option(player,"binary",1);) and have your :do_command
>> >understand the "binary" representations in-Server (encode_binary,
>> >decode_binary) because your server will error up with a "binary"
>> >connection. I'll send in example code in a bit. =)
>> I don't think Henry was looking for this... he said anything a player types,
>> and players can't "type" binary. The <CR> is really just enter, which makes
>> $do_command()'s argstr to "". Also, this eliminates any chances of using
>> default parsing, if do_command wants to use it. I can't imagine why you
>> would want this done on the main login port.
>Yes, putting an incoming connection into binary mode has unpleasant side
>But if you want the server to respond to empty lines -- that is, just a
>CR, it is necessary. The server ignores "blank" lines, so $do_command
>will *not* be called with an argstr of "" when a CR by itself is entered.
>Try it -- program $do_command with something like "notify(player,
>"$do_command); return 0;" and try some blank lines, either just a CR or
>some spaces and then a CR. You won't get any output.
I've managed to solve this problem by stripping off the lines, then
force_input()ing them to be the next command processed, and then letting
them pass through. I checked to see whether the entire text was a blank
line and, if so, shoved "CRLF" into the buffer instead.
Here's the code for anyone interested:
if (caller != #-1)
elseif (!connection_option(player, "binary"))
set_connection_option(player, "binary", 1);
force_input(player, argstr, 1);
elseif (length(decode_binary(argstr)) == 1)
"parse it normally";
while (i = min(index(argstr, "~0A~0D") || index(argstr, "~0D~0A"),
index(argstr, "~0D~0A") || index(argstr, "~0A~0D")))
if (i == 1)
argstr[0..6] = "";
force_input(player, strsub(argstr[1..i - 1], "~7E", "~"));
argstr[0..i + 5] = "";
suspend(0); /* suspend OK here because we won't be passing this on
------- End of forwarded message -------
Subject Index |