Fix look of default command.py example in search beginner tutorial. Resolve #3555

This commit is contained in:
Griatch 2024-06-27 17:22:28 +02:00
parent d6de25f4ca
commit a49b61a509
2 changed files with 7 additions and 5 deletions

View file

@ -3,8 +3,7 @@
In this lesson we'll learn how to create our own Evennia [Commands](../../../Components/Commands.md) If you are new to Python you'll also learn some more basics about how to manipulate strings and get information out of Evennia.
A Command is something that handles the input from a user and causes a result to happen.
An example is `look`, which examines your current location and tells you what it looks like and
what is in it.
An example is `look`, which examines your current location and tells you what it looks like and what is in it.
```{sidebar} Commands are not typeclassed
@ -20,7 +19,7 @@ Command-Sets are then associated with objects, for example with your Character.
## Creating a custom command
Open `mygame/commands/command.py`:
Open `mygame/commands/command.py`. This file already has stuff filled in for you.
```python
"""

View file

@ -23,12 +23,15 @@ On the `DefaultObject` is a `.search` method which we have already tried out whe
- It will always return exactly one match. If it found zero or more than one match, the return is `None`. This is different from `evennia.search` (see below), which always returns a list.
- On a no-match or multimatch, `.search` will automatically send an error message to `obj`. So you don't have to worry about reporting messages if the result is `None`.
In other words, this method handles error messaging for you. A very common way to use it is in commands:
In other words, this method handles error messaging for you. A very common way to use it is in commands. You can put your command anywhere, but let's try the pre-filled-in `mygame/commands/command.py`.
```python
# in for example mygame/commands/command.py
from evennia import Command
from evennia import Command as BaseCommand
class Command(BaseCommand):
# ...
class CmdQuickFind(Command):
"""