# bf_connect_player(CONN, PLAYER) --> *FTP!!*

Jefferson M. Dubrule (Jefferson.M.Dubrule@dartmouth.edu)
Fri, 2 Aug 1996 10:01:52 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    --- 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