MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: bf_connect_player(CONN, PLAYER) --> *FTP!!*
--- Colin McCormick wrote:
>Go ahead and try this -- set up a listening object on some port, give it
>the following :do_login_command() verb:
>
>count = 0;
>while (read(player, 0) != "LOG ME IN")
> count = count + 1;
>endwhile
>notify(player, tostr("You typed ", count, " lines before logging in."));
>return #XX;
>
>where #XX is some valid player. Connect to the port, type a few lines
>and then "LOG ME IN". You won't be logged in.
Why not this instead:
if (argstr == "LOG ME IN")
notify(player, tostr("You typed ", $list_utils:assoc(player,
this.counts)[2], " lines before logging in."));
return #2;
else
x = $list_utils:iassoc(player, this.counts);
if (x)
this.counts[x][2] = this.counts[x][2] + 1;
else
this.counts[$..$+1] = {{player, 0}};
endif
endif
This produces:
hello
there
LOG ME IN
You typed 2 lines before logging in.
@who
Player name Connected Idle time Location
----------- --------- --------- --------
manta (#2) 19 seconds 0 seconds The First Room
Total: 1 player, who has been active recently.
I don't see the problem . . .
-manta
Home |
Subject Index |
Thread Index