View/Edit #29:match_player

Switch to edit mode.

Name(s): match_player
1:  "match_player(name,name,...)      => {obj,obj,...}"
2:  "match_player(name[,meobj])       => obj"
3:  "match_player({name,...}[,meobj]) => {obj,...}"
4:  "objs returned are either players, $failed_match, $ambiguous_match, or $nothing in the case of an empty string."
5:  "meobj (what to return for instances of `me') defaults to player; if given and isn't actually a player, `me' => $failed_match"
6:  {@strings, me} = typeof(args[$]) == $OBJ ? args | {@args, player}
7:  retobj = typeof(strings[1]) == $STR && length(strings) == 1
8:  strings = typeof(strings[1]) == $LIST ? strings[1] | strings
9:  found = {}
10: for astr in (strings)
11:   if (!astr)
12:     aobj = $nothing
13:   elseif (astr in $msg.me)
14:     aobj = me
15:   elseif (astr[1] == "~")
16:     aobj = $player_db:find(astr[2..$])
17:   elseif (valid(aobj = $string_utils:literal_object(astr)) && (aobj:isa($accountable) || aobj:isa($webber)))
18:     "astr is a valid literal object number of some player, so we are done."
19:   else
20:     aobj = $player_db:find(astr)
21:   endif
22:   found = {@found, aobj}
23: endfor
24: return retobj ? found[1] | found
25: "Last modified by Dax (#789) on Tue May  3 14:03:25 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]