Subject: Player name _vs_ number

From: [email-masked] (Billy Chambless)
Date: Sat, 11 Sep 1993 12:48:52 -0700

First off-- sorry about the empty message I sent..need more sleep.

I've created a verb that takes a players name as an argument, and works
fine if the player is logged on. If the player is NOT logged on, the
verb will only work if called with the player's number; if I use the name
I get an "invalid indirection" error message. Isw there a function that
will return the player number, given the name?
-- 
* In Real Life: Billy Chambless		    University of Southern Mississippi 
* "Blast it, Jim, I'm a programmer, not an electrician!!"
* =============================================================================

---

From: [email-masked] (Erik Ostrom)
Date: Sat, 11 Sep 1993 08:01:51 -0700

> will return the player number, given the name?

I think what's really happening is that it's working if and only if
the player given as an argument is _in the same room as_ the player
typing in the command.  The server then automatically matches dobj to
the object in the room.  When the player isn't logged on, e probably
has been vanished to limbo, and so the server doesn't match eir name.

The verb you want is $string_utils:match_player(), probably as

dobj = $string_utils:match_player(dobjstr);
if ($command_utils:player_match_failed(dobj, dobjstr))
  return E_INVARG;
endif

:player_match_failed checks to see if your match failed (makes sense,
eh?) and prints a message if so.  Then it returns 1 if failed, so you
can gracefully exit from the verb.

I'm assuming you want the player as direct object; if you want
indirect object, it's a simple transformation.  If you want to get
trickier, well, you're welcome to, I suppose.

--Erik/JF