MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Amiguous Matches



At 10:20 AM 3/3/96 PST, you wrote:
>Now this would be great I've seen it used on an LPMOO before and its very 
>helpful... that and it cuts down on alot of the "I don't know which 
><blank> you mean.. so if you get it fixed let me know please I'm dong and 
>RPG MOO and its gettingto be a pain wen I have several items of the same 
>name in the same room...
>
>egoff@vespucci.iquest.com
>

OK, Remind me not to post here at 4:00 in the morning :)
I did in fact have the basic idea, but a forgotten piece of the puzzle,
$last_huh, which has a get,drop,give,etc set of verbs on it was the problem.
I just re-arranged the $cu:do_huh a bit, like so...

@program #56:do_huh
":do_huh(verb,args)  what :huh should do by default.";
set_task_perms(cp = caller_perms());
verb = args[1];
args = args[2];
notify = $perm_utils:controls(cp, player) ? "notify" | "tell";
if (player:my_huh(verb, args))
  "... the player found something funky to do ...";
elseif (caller:here_huh(verb, args))
  "... the room found something funky to do ...";
elseif (dobj == $ambiguous_match)
  dobj = player:select_target(dobjstr);
  if (iobj == $ambiguous_match)
    player:(notify)(tostr("I don't understand that (\"", dobjstr, "\" and
\"", iobjstr, "\" are both ambiguous names)."));
  else
    if(valid(dobj))
      if($object_utils:has_callable_verb(dobj,verb))
        dobj:(verb)(args);
      elseif(valid(iobj) && $object_utils:has_callable_verb(iobj,verb))
        iobj:(verb)(args);
      endif
    else
      player:(notify)(tostr("I don't understand that (\"", dobjstr, "\" is
an ambiguous name)."));
    endif
  endif
elseif (iobj == $ambiguous_match)
    iobj = player:select_target(iobjstr);
    if(valid(dobj))
      if($object_utils:has_callable_verb(dobj,verb))
        dobj:(verb)(args);
      elseif(valid(iobj) && $object_utils:has_callable_verb(iobj,verb))
        iobj:(verb)(args);
      endif
    else
      player:(notify)(tostr("I don't understand that (\"", iobjstr, "\" is
an ambiguous name)."));
    endif
elseif (player:last_huh(verb, args))
  "... player's second round found something to do ...";
else
  player:(notify)("I don't understand that.");
  player:my_explain_syntax(caller, verb, args) ||
(caller:here_explain_syntax(caller, verb, args) ||
this:explain_syntax(caller, verb, args));
endif
.

Note a couple of things...
1) If both iobj & dobj are ambiguous, it stills falls through.
2) This code could use some cleaning up :)
3) $player:select_target is a verb on players that gives them a list of all
items that match the iobjstr or dobjstr, allowing them to pick from the
list, returning $ambiguous again if the match is invalid, player picks a
non-menu item, etc..
4) If anyone sees something I screwed up with here, let me know, but it
seems to work fine.  One last point, of course your verbs need to be +x...




Home | Subject Index | Thread Index