More doc updates

This commit is contained in:
Griatch 2022-09-17 19:31:29 +02:00
parent e8d08ad597
commit cdc1b83331
17 changed files with 75 additions and 19 deletions

View file

@ -2,7 +2,7 @@
Now that we have learned a little about how to find things in the Evennia library, let's use it. Now that we have learned a little about how to find things in the Evennia library, let's use it.
In the [Python classes and objects](./Python-classes-and-objects.md) lesson we created the dragons Fluffy, Cuddly In the [Python classes and objects](./Beginner-Tutorial-Python-classes-and-objects.md) lesson we created the dragons Fluffy, Cuddly
and Smaug and made them fly and breathe fire. So far our dragons are short-lived - whenever we `restart` and Smaug and made them fly and breathe fire. So far our dragons are short-lived - whenever we `restart`
the server or `quit()` out of python mode they are gone. the server or `quit()` out of python mode they are gone.

View file

@ -1,7 +1,7 @@
# Player Characters # Player Characters
In the [previous lesson about rules and dice rolling](Beginner-Gutorial-Rules) we made some assumptions In the [previous lesson about rules and dice rolling](./Beginner-Tutorial-Rules.md) we made some
about the "Player Character" entity: assumptions about the "Player Character" entity:
- It should store Abilities on itself as `character.strength`, `character.constitution` etc. - It should store Abilities on itself as `character.strength`, `character.constitution` etc.
- It should have a `.heal(amount)` method. - It should have a `.heal(amount)` method.
@ -237,7 +237,8 @@ Remember that `self` is the Character instance here. So `self.location.msg_conte
message to everything inside my current location". In other words, send a message to everyone message to everything inside my current location". In other words, send a message to everyone
in the same place as the character. in the same place as the character.
The `$You() $conj(collapse)` are [Funcparser inlines](Funcparser). These are functions that execute The `$You() $conj(collapse)` are [FuncParser inlines](../../../Components/FuncParser.md). These are functions that
execute
in the string. The resulting string may look different for different audiences. The `$You()` inline in the string. The resulting string may look different for different audiences. The `$You()` inline
function will use `from_obj` to figure out who 'you' are and either show your name or 'You'. function will use `from_obj` to figure out who 'you' are and either show your name or 'You'.
The `$conj()` (verb conjugator) will tweak the (English) verb to match. The `$conj()` (verb conjugator) will tweak the (English) verb to match.

View file

@ -123,8 +123,8 @@ keep in here.
## Storing state of the menu ## Storing state of the menu
```{sidebar} ```{sidebar}
There is a full implementation of the chargen in [evennia/contrib/tutorials/evadventure/chargen. There is a full implementation of the chargen in
py](evennia.contrib.tutorials.evadventure.chargen). [evennia/contrib/tutorials/evadventure/chargen.py](evennia.contrib.tutorials.evadventure.chargen).
``` ```
> create a new module `mygame/evadventure/chargen.py`. > create a new module `mygame/evadventure/chargen.py`.

View file

@ -0,0 +1,5 @@
# In-game Commands
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -0,0 +1,5 @@
# Dynamically generated Dungeon
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -0,0 +1,5 @@
# Non-Player-Characters (NPCs)
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -1,5 +1,11 @@
# Part 3: How we get there # Part 3: How we get there
```{warning}
The tutorial game is under development and is not yet complete, nor tested. Use the existing
lessons as inspiration and to help get you going, but don't expect out-of-the-box perfection
from it at this time.
```
```{eval-rst} ```{eval-rst}
.. sidebar:: Beginner Tutorial Parts .. sidebar:: Beginner Tutorial Parts
@ -36,6 +42,7 @@ Fully coded examples of all code we make in this part can be found in the
## Lessons ## Lessons
```{toctree} ```{toctree}
:maxdepth: 1 :maxdepth: 1

View file

@ -0,0 +1,5 @@
# Game Quests
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -0,0 +1,5 @@
# In-game Shops
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -0,0 +1,5 @@
# Turn-based combat
```{warning}
This part of the Beginner tutorial is still being developed.
```

View file

@ -233,7 +233,8 @@ You should get back a nice string about yourself! If that works, great! But you'
doing that test when you change this code later. doing that test when you change this code later.
```{sidebar} ```{sidebar}
In [evennia/contrib/evadventure/tests/test_utils.py](evennia.contrib.evadventure.tests.test_utils) In [evennia/contrib/tutorials/evadventure/tests/test_utils.py](evennia.contrib.tutorials.
evadventure.tests.test_utils)
is an example of the testing module. To dive deeper into unit testing in Evennia, see the is an example of the testing module. To dive deeper into unit testing in Evennia, see the
[Unit testing](../../../Coding/Unit-Testing.md) documentation. [Unit testing](../../../Coding/Unit-Testing.md) documentation.
``` ```

View file

@ -56,6 +56,7 @@ Tutorial-Vehicles.md
```{toctree} ```{toctree}
:maxdepth: 1 :maxdepth: 1
Tutorial-Persistent-Handler.md
Gametime-Tutorial.md Gametime-Tutorial.md
Help-System-Tutorial.md Help-System-Tutorial.md
Mass-and-weight-for-objects.md Mass-and-weight-for-objects.md
@ -88,4 +89,18 @@ Evennia-for-roleplaying-sessions.md
Evennia-for-Diku-Users.md Evennia-for-Diku-Users.md
Evennia-for-MUSH-Users.md Evennia-for-MUSH-Users.md
Tutorial-for-basic-MUSH-like-game.md Tutorial-for-basic-MUSH-like-game.md
``` ```
## Old tutorials
These will be replaced by the Beginner Tutorial, but remain here until that is complete.
```{toctree}
:maxdepth: 1
Implementing-a-game-rule-system.md
Turn-based-Combat-System.md
A-Sittable-Object.md
```

View file

@ -231,5 +231,5 @@ character.quests.check_progress()
and be sure that quest data is not lost between reloads. and be sure that quest data is not lost between reloads.
You can find a full-fledged quest-handler example as [EvAdventure You can find a full-fledged quest-handler example as [EvAdventure
quests](evennia.contribs.tutorials.evadventure.quests) contrib in the Evennia quests](evennia.contrib.tutorials.evadventure.quests) contrib in the Evennia
repository. repository.

View file

@ -46,19 +46,19 @@ The `FuncParser` also accepts a direct dict mapping of `{'name': callable, ...}`
import dataclasses import dataclasses
import inspect import inspect
import random import random
from django.conf import settings from django.conf import settings
from evennia.utils import logger from evennia.utils import logger, search
from evennia.utils.utils import ( from evennia.utils.utils import (
make_iter,
callables_from_module, callables_from_module,
variable_from_module,
pad,
crop, crop,
int2str,
justify, justify,
make_iter,
pad,
safe_convert_to_types, safe_convert_to_types,
int2str variable_from_module,
) )
from evennia.utils import search
from evennia.utils.verb_conjugation.conjugate import verb_actor_stance_components from evennia.utils.verb_conjugation.conjugate import verb_actor_stance_components
from evennia.utils.verb_conjugation.pronouns import pronoun_to_viewpoints from evennia.utils.verb_conjugation.pronouns import pronoun_to_viewpoints
@ -243,7 +243,7 @@ class FuncParser:
if raise_errors: if raise_errors:
available = ", ".join(f"'{key}'" for key in self.callables) available = ", ".join(f"'{key}'" for key in self.callables)
raise ParsingError( raise ParsingError(
f"Unknown parsed function '{str(parsedfunc)}' " f"(available: {available})" f"Unknown parsed function '{str(parsedfunc)}' (available: {available})"
) )
return str(parsedfunc) return str(parsedfunc)
@ -679,6 +679,7 @@ def funcparser_callable_toint(*args, **kwargs):
except TypeError: except TypeError:
return inp return inp
def funcparser_callable_int2str(*args, **kwargs): def funcparser_callable_int2str(*args, **kwargs):
""" """
Usage: $int2str(1) -> 'one' etc, up to 12->twelve. Usage: $int2str(1) -> 'one' etc, up to 12->twelve.
@ -1049,6 +1050,7 @@ def funcparser_callable_clr(*args, **kwargs):
endclr = "|" + endclr if endclr else ("|n" if startclr else "") endclr = "|" + endclr if endclr else ("|n" if startclr else "")
return f"{startclr}{text}{endclr}" return f"{startclr}{text}{endclr}"
def funcparser_callable_pluralize(*args, **kwargs): def funcparser_callable_pluralize(*args, **kwargs):
""" """
FuncParser callable. Handles pluralization of a word. FuncParser callable. Handles pluralization of a word.
@ -1059,7 +1061,7 @@ def funcparser_callable_pluralize(*args, **kwargs):
otherwise use plural form. otherwise use plural form.
plural_word (str, optional): If given, this will be used if `number` plural_word (str, optional): If given, this will be used if `number`
is greater than one. If not given, we simply add 's' to the end of is greater than one. If not given, we simply add 's' to the end of
`singular_word'. `singular_word`.
Example: Example:
- `$pluralize(thing, 2)` -> "things" - `$pluralize(thing, 2)` -> "things"

View file

@ -10,8 +10,8 @@ total runtime of the server and the current uptime.
import time import time
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.db.utils import OperationalError
from django.conf import settings from django.conf import settings
from django.db.utils import OperationalError
from evennia import DefaultScript from evennia import DefaultScript
from evennia.server.models import ServerConfig from evennia.server.models import ServerConfig
from evennia.utils.create import create_script from evennia.utils.create import create_script
@ -236,7 +236,7 @@ def schedule(
Args: Args:
callback (function): The callback function that will be called. Note callback (function): The callback function that will be called. Note
that the callback must be a module-level function, since the script will that the callback must be a module-level function, since the script will
be persistent. The callable should be on form `callable(*args, **kwargs)` be persistent. The callable should be on the form `callable(*args, **kwargs)`
where args/kwargs are passed into this schedule. where args/kwargs are passed into this schedule.
repeat (bool, optional): Defines if the callback should be called regularly repeat (bool, optional): Defines if the callback should be called regularly
at the specified time. at the specified time.