Clarify the rplanguage docstring a bit

This commit is contained in:
Griatch 2022-09-12 20:15:00 +02:00
parent 10952ae47b
commit ca6456b134

View file

@ -17,7 +17,7 @@ in the game in various ways:
overhear (for example "s" sounds tend to be audible even when no other overhear (for example "s" sounds tend to be audible even when no other
meaning can be determined). meaning can be determined).
Usage: ## Usage
```python ```python
from evennia.contrib import rplanguage from evennia.contrib import rplanguage
@ -48,15 +48,38 @@ Usage:
``` ```
To set up new languages, import and use the `add_language()` ## Custom languages
helper method in this module. This allows you to customize the
"feel" of the semi-random language you are creating. Especially To set up new languages, you need to run `add_language()`
helper function in this module. The arguments of this function (see below)
are used to store the new language in the database (in the LanguageHandler,
which is a type of Script).
If you want to remember the language definitions, you could put them all
in a module along with the `add_language` call as a quick way to
rebuild the language on a db reset:
```python
# a stand-alone module somewhere under mygame. Just import this
# once to automatically add the language!
from evennia.contrib.rpg.rpsystem import rplanguage
grammar = (...)
vowels = "eaouy"
# etc
rplanguage.add_language(grammar=grammar, vowels=vowels, ...)
```
The variables of `add_language` allows you to customize the "feel" of
the semi-random language you are creating. Especially
the `word_length_variance` helps vary the length of translated the `word_length_variance` helps vary the length of translated
words compared to the original and can help change the "feel" for words compared to the original. You can also add your own
the language you are creating. You can also add your own
dictionary and "fix" random words for a list of input words. dictionary and "fix" random words for a list of input words.
Below is an example of "elvish", using "rounder" vowels and sounds: ## Example
Below is an example module creating "elvish", using "rounder" vowels and sounds:
```python ```python
# vowel/consonant grammar possibilities # vowel/consonant grammar possibilities
@ -115,12 +138,12 @@ Usage:
""" """
import re import re
from random import choice, randint
from collections import defaultdict from collections import defaultdict
from random import choice, randint
from evennia import DefaultScript from evennia import DefaultScript
from evennia.utils import logger from evennia.utils import logger
# ------------------------------------------------------------ # ------------------------------------------------------------
# #
# Obfuscate language # Obfuscate language