Updated the game template to match changes from previous commit.
This commit is contained in:
parent
2743f98fb0
commit
9478177e55
1 changed files with 22 additions and 59 deletions
|
|
@ -18,73 +18,36 @@ search functionality:
|
|||
indicating that the 1st or 2nd match for "ball" should be
|
||||
used.
|
||||
|
||||
This module is not called by default. To overload the defaults, add
|
||||
one or both of the following lines to your settings.py file:
|
||||
This module is not called by default, to use it, add the following
|
||||
line to your settings file:
|
||||
|
||||
SEARCH_AT_RESULT = "server.conf.at_search.at_search_result"
|
||||
SEARCH_AT_MULTIMATCH_INPUT = "server.conf.at_search.at_multimatch_input"
|
||||
|
||||
"""
|
||||
|
||||
def at_search_result(msg_obj, ostring, results, global_search=False,
|
||||
nofound_string=None, multimatch_string=None, quiet=False):
|
||||
def at_search_result(matches, caller, query="", quiet=False, **kwargs):
|
||||
"""
|
||||
Called by search methods after a result of any type has been found.
|
||||
This is a generic hook for handling all processing of a search
|
||||
result, including error reporting.
|
||||
|
||||
Takes a search result (a list) and
|
||||
formats eventual errors.
|
||||
Args:
|
||||
matches (list): This is a list of 0, 1 or more typeclass instances,
|
||||
the matched result of the search. If 0, a nomatch error should
|
||||
be echoed, and if >1, multimatch errors should be given. Only
|
||||
if a single match should the result pass through.
|
||||
caller (Object): The object performing the search and/or which should
|
||||
receive error messages.
|
||||
query (str, optional): The search query used to produce `matches`.
|
||||
quiet (bool, optional): If `True`, no messages will be echoed to caller
|
||||
on errors.
|
||||
|
||||
msg_obj - object to receive feedback.
|
||||
ostring - original search string
|
||||
results - list of found matches (0, 1 or more)
|
||||
global_search - if this was a global_search or not
|
||||
(if it is, there might be an idea of supplying
|
||||
dbrefs instead of only numbers)
|
||||
nofound_string - optional custom string for not-found error message.
|
||||
multimatch_string - optional custom string for multimatch error header
|
||||
quiet - work normally, but don't echo to caller, just return the
|
||||
results.
|
||||
Kwargs:
|
||||
nofound_string (str): Replacement string to echo on a notfound error.
|
||||
multimatch_string (str): Replacement string to echo on a multimatch error.
|
||||
|
||||
Multiple matches are returned to the searching object
|
||||
as a list of results ["1-object", "2-object","3-object",...]
|
||||
A single match is returned on its own.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def at_multimatch_input(ostring):
|
||||
"""
|
||||
This parser will be called by the engine when a user supplies
|
||||
a search term. The search term must be analyzed to determine
|
||||
if the user wants to differentiate between multiple matches
|
||||
(usually found during a previous search).
|
||||
|
||||
This method should separate out any identifiers from the search
|
||||
string used to differentiate between same-named objects. The
|
||||
result should be a tuple (index, search_string) where the index
|
||||
gives which match among multiple matches should be used (1 being
|
||||
the lowest number, rather than 0 as in Python).
|
||||
|
||||
The default parser will intercept input on the following form:
|
||||
|
||||
2-object
|
||||
|
||||
This will be parsed to (2, "object") and, if applicable, will tell
|
||||
the engine to pick the second from a list of same-named matches of
|
||||
objects called "object".
|
||||
|
||||
Ex for use in a game session:
|
||||
|
||||
> look
|
||||
You see: ball, ball, ball and ball.
|
||||
> get ball
|
||||
There where multiple matches for ball:
|
||||
1-ball
|
||||
2-ball
|
||||
3-ball
|
||||
4-ball
|
||||
> get 3-ball
|
||||
You get the ball.
|
||||
Returns:
|
||||
processed_result (Object or None): This is always a single result
|
||||
or `None`. If `None`, any error reporting/handling should
|
||||
already have happened.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue