Add custom error messages to search and have drop use them.
This commit is contained in:
parent
7fb35f4ef4
commit
7e7cd9211f
2 changed files with 11 additions and 10 deletions
|
|
@ -266,6 +266,7 @@ class CmdDrop(MuxCommand):
|
||||||
|
|
||||||
key = "drop"
|
key = "drop"
|
||||||
locks = "cmd:all()"
|
locks = "cmd:all()"
|
||||||
|
arg_regex = r"\s|$"
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"Implement command"
|
"Implement command"
|
||||||
|
|
@ -277,11 +278,7 @@ class CmdDrop(MuxCommand):
|
||||||
|
|
||||||
# Because the DROP command by definition looks for items
|
# Because the DROP command by definition looks for items
|
||||||
# in inventory, call the search function using location = caller
|
# in inventory, call the search function using location = caller
|
||||||
results = caller.search(self.args, location=caller, quiet=True)
|
obj = caller.search(self.args, location=caller,
|
||||||
|
|
||||||
# now we send it into the error handler (this will output consistent
|
|
||||||
# error messages if there are problems).
|
|
||||||
obj = AT_SEARCH_RESULT(caller, self.args, results, False,
|
|
||||||
nofound_string="You aren't carrying %s." % self.args,
|
nofound_string="You aren't carrying %s." % self.args,
|
||||||
multimatch_string="You carry more than one %s:" % self.args)
|
multimatch_string="You carry more than one %s:" % self.args)
|
||||||
if not obj:
|
if not obj:
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,9 @@ class DefaultObject(ObjectDB):
|
||||||
attribute_name=None,
|
attribute_name=None,
|
||||||
quiet=False,
|
quiet=False,
|
||||||
exact=False,
|
exact=False,
|
||||||
candidates=None):
|
candidates=None,
|
||||||
|
nofound_string=None,
|
||||||
|
multimatch_string=None):
|
||||||
"""
|
"""
|
||||||
Returns the typeclass of an Object matching a search string/condition
|
Returns the typeclass of an Object matching a search string/condition
|
||||||
|
|
||||||
|
|
@ -367,6 +369,8 @@ class DefaultObject(ObjectDB):
|
||||||
is given. If not set, this list will automatically be defined
|
is given. If not set, this list will automatically be defined
|
||||||
to include the location, the contents of location and the
|
to include the location, the contents of location and the
|
||||||
caller's contents (inventory).
|
caller's contents (inventory).
|
||||||
|
nofound_string - optional custom string for not-found error message.
|
||||||
|
multimatch_string - optional custom string for multimatch error header
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
quiet=False (default):
|
quiet=False (default):
|
||||||
|
|
@ -425,7 +429,7 @@ class DefaultObject(ObjectDB):
|
||||||
exact=exact)
|
exact=exact)
|
||||||
if quiet:
|
if quiet:
|
||||||
return results
|
return results
|
||||||
return _AT_SEARCH_RESULT(self, searchdata, results, global_search)
|
return _AT_SEARCH_RESULT(self, searchdata, results, global_search, nofound_string, multimatch_string)
|
||||||
|
|
||||||
def search_player(self, searchdata, quiet=False):
|
def search_player(self, searchdata, quiet=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue