mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 22:47:16 +02:00
Updated HTML docs
This commit is contained in:
parent
66d0ad0bc9
commit
7900aad365
2073 changed files with 32986 additions and 41197 deletions
|
|
@ -5,18 +5,18 @@ need to adopt some best practices as well as find a good place to start to learn
|
|||
|
||||
Here are some pointers to get you going.
|
||||
|
||||
### Start with the tutorial
|
||||
## Start with the tutorial
|
||||
|
||||
It's highly recommended that you jump in on the [Starting Tutorial](../Howto/Starting/Part1/Starting-Part1). Even if
|
||||
It's highly recommended that you jump in on the [Starting Tutorial](../Howto/Starting/Part1/Starting-Part1.md). Even if
|
||||
you only the beginning or some part of it, it covers much of the things needed to get started.
|
||||
|
||||
### Python
|
||||
## Python
|
||||
|
||||
Evennia is developed using Python. Even if you are more of a designer than a coder, it is wise to
|
||||
learn how to read and understand basic Python code. If you are new to Python, or need a refresher,
|
||||
take a look at our [Python introduction](../Howto/Starting/Part1/Python-basic-introduction).
|
||||
take a look at our [Python introduction](../Howto/Starting/Part1/Python-basic-introduction.md).
|
||||
|
||||
### Explore Evennia interactively
|
||||
## Explore Evennia interactively
|
||||
|
||||
When new to Evennia it can be hard to find things or figure out what is available. Evennia offers a
|
||||
special interactive python shell that allows you to experiment and try out things. It's recommended
|
||||
|
|
@ -35,13 +35,13 @@ This will open an Evennia-aware python shell (using ipython). From within this s
|
|||
evennia.<TAB>
|
||||
|
||||
That is, enter `evennia.` and press the `<TAB>` key. This will show you all the resources made
|
||||
available at the top level of Evennia's "flat API". See the [flat API](../Evennia-API) page for more
|
||||
available at the top level of Evennia's "flat API". See the [flat API](../Evennia-API.md) page for more
|
||||
info on how to explore it efficiently.
|
||||
|
||||
#### Jupyter Notebook Support
|
||||
### Jupyter Notebook Support
|
||||
|
||||
You can also explore evennia interactively in a [Jupyter notebook](https://jupyter.readthedocs.io/en/latest/index.html#). This offers
|
||||
an in-browser view of your code similar to Matlab or similar programs. There are
|
||||
an in-browser view of your code similar to Matlab or similar programs. There are
|
||||
a few extra steps that must be taken in order for this to work:
|
||||
|
||||
# [open a new console/terminal]
|
||||
|
|
@ -51,7 +51,7 @@ a few extra steps that must be taken in order for this to work:
|
|||
|
||||
Next, `cd` to your game folder. _It's important that you are in the _root_ of this folder for the next command_:
|
||||
|
||||
evennia shell_plus --notebook &
|
||||
evennia shell_plus --notebook &
|
||||
|
||||
The `&` at the end starts the process as a background process on Linux/Unix.
|
||||
Skip it if your OS doesn't support this syntax. Your browser should now open
|
||||
|
|
@ -59,7 +59,7 @@ with the Jupyter interface. If not, open a browser to the link given on the
|
|||
command line.
|
||||
|
||||
In the window, open the `new` menu in the top right and start a `Django Shell-Plus` notebook (or
|
||||
open an existing one if you had one from before). In the first cell you must initialize
|
||||
open an existing one if you had one from before). In the first cell you must initialize
|
||||
Evennia like so:
|
||||
|
||||
```python
|
||||
|
|
@ -71,13 +71,13 @@ _Note that the above initialization must be run every time a new new notebook/ke
|
|||
|
||||
After this you can import and access all of the Evennia system, same as with `evennia shell`.
|
||||
|
||||
#### More exploration
|
||||
### More exploration
|
||||
|
||||
You can complement your exploration by peeking at the sections of the much more detailed
|
||||
[Evennia Component overview](../Components/Components-Overview). The [Tutorials](../Howto/Howto-Overview) section also contains a growing collection
|
||||
You can complement your exploration by peeking at the sections of the much more detailed
|
||||
[Evennia Component overview](../Components/Components-Overview.md). The [Tutorials](../Howto/Howto-Overview.md) section also contains a growing collection
|
||||
of system- or implementation-specific help.
|
||||
|
||||
### Use a python syntax checker
|
||||
## Use a python syntax checker
|
||||
|
||||
Evennia works by importing your own modules and running them as part of the server. Whereas Evennia
|
||||
should just gracefully tell you what errors it finds, it can nevertheless be a good idea for you to
|
||||
|
|
@ -89,12 +89,12 @@ many python syntax checkers out there. A fast and easy one is
|
|||
every possible problem - some bugs or problems will only appear when you actually run the code. But
|
||||
using such a checker can be a good start to weed out the simple problems.
|
||||
|
||||
### Plan before you code
|
||||
## Plan before you code
|
||||
|
||||
Before you start coding away at your dream game, take a look at our [Game Planning](../Howto/Starting/Part2/Game-Planning)
|
||||
Before you start coding away at your dream game, take a look at our [Game Planning](../Howto/Starting/Part2/Game-Planning.md)
|
||||
page. It might hopefully help you avoid some common pitfalls and time sinks.
|
||||
|
||||
### Code in your game folder, not in the evennia/ repository
|
||||
## Code in your game folder, not in the evennia/ repository
|
||||
|
||||
As part of the Evennia setup you will create a game folder to host your game code. This is your
|
||||
home. You should *never* need to modify anything in the `evennia` library (anything you download
|
||||
|
|
@ -103,9 +103,9 @@ it out into your game folder and edit it there.
|
|||
|
||||
If you find that Evennia doesn't support some functionality you need, make a [Feature
|
||||
Request](github:issue) about it. Same goes for [bugs][bug]. If you add features or fix bugs
|
||||
yourself, please consider [Contributing](../Contributing) your changes upstream!
|
||||
yourself, please consider [Contributing](../Contributing.md) your changes upstream!
|
||||
|
||||
### Learn to read tracebacks
|
||||
## Learn to read tracebacks
|
||||
|
||||
Python is very good at reporting when and where things go wrong. A *traceback* shows everything you
|
||||
need to know about crashing code. The text can be pretty long, but you usually are only interested
|
||||
|
|
@ -124,7 +124,7 @@ module holding your custom class. Since such a module is not valid Python, Evenn
|
|||
all. Instead of crashing, Evennia will then print the full traceback to the terminal/console and
|
||||
temporarily fall back to the safe `DefaultObject` until you fix the problem and reload.
|
||||
|
||||
### Docs are here to help you
|
||||
## Docs are here to help you
|
||||
|
||||
Some people find reading documentation extremely dull and shun it out of principle. That's your
|
||||
call, but reading docs really *does* help you, promise! Evennia's documentation is pretty thorough
|
||||
|
|
@ -133,7 +133,7 @@ can't find the answer in the docs, don't be shy to ask questions! The [discussio
|
|||
group](https://sites.google.com/site/evenniaserver/discussions) and the [irc
|
||||
chat](https://webchat.freenode.net/?channels=evennia) are also there for you.
|
||||
|
||||
### The most important point
|
||||
## The most important point
|
||||
|
||||
And finally, of course, have fun!
|
||||
|
||||
|
|
|
|||
|
|
@ -7,24 +7,24 @@ to you, but some things may still be useful.
|
|||
|
||||
## Find your way
|
||||
|
||||
- [Directory-Overview](../Howto/Starting/Part1/Gamedir-Overview)
|
||||
- [Quirks of Evennia](./Quirks)
|
||||
- [Directory-Overview](../Howto/Starting/Part1/Gamedir-Overview.md)
|
||||
- [Quirks of Evennia](./Quirks.md)
|
||||
|
||||
## Setting up a workflow
|
||||
|
||||
- [Setting up PyCharm](./Setting-up-PyCharm)
|
||||
- [Using Version-Control](./Version-Control)
|
||||
- [Updating Evennia sources](./Updating-Your-Game)
|
||||
- [Setting up PyCharm](./Setting-up-PyCharm.md)
|
||||
- [Using Version-Control](./Version-Control.md)
|
||||
- [Updating Evennia sources](./Updating-Your-Game.md)
|
||||
|
||||
## Coding away
|
||||
|
||||
- [Coding Introduction](./Coding-Introduction)
|
||||
- [Ways to Debug](./Debugging)
|
||||
- [Adding unit-tests](./Unit-Testing)
|
||||
- [Things to remember when importing from evennia](./Flat-API)
|
||||
- [Coding Introduction](./Coding-Introduction.md)
|
||||
- [Ways to Debug](./Debugging.md)
|
||||
- [Adding unit-tests](./Unit-Testing.md)
|
||||
- [Things to remember when importing from evennia](./Flat-API.md)
|
||||
|
||||
## Advanced concepts
|
||||
|
||||
- [Continuous Integration](./Continuous-Integration)
|
||||
- [Using Travis](./Using-Travis)
|
||||
- [Profiling](./Profiling)
|
||||
- [Continuous Integration](./Continuous-Integration.md)
|
||||
- [Using Travis](./Using-Travis.md)
|
||||
- [Profiling](./Profiling.md)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Among those you will need:
|
|||
* A Continuous Integration Environment.
|
||||
* I recommend [TeamCity](https://www.jetbrains.com/teamcity/) which has an in-depth [Setup
|
||||
Guide](https://confluence.jetbrains.com/display/TCD8/Installing+and+Configuring+the+TeamCity+Server)
|
||||
* [Source Control](./Version-Control)
|
||||
* [Source Control](./Version-Control.md)
|
||||
* This could be Git or SVN or any other available SC.
|
||||
|
||||
## Linux TeamCity Setup
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Things to remember about the flat API
|
||||
|
||||
The flat API is a series of 'shortcuts' on the `evennia` main library root (defined in
|
||||
`evennia/__init__.py`). Its componentas are documented [as part of the auto-documentation](../Evennia-API).
|
||||
`evennia/__init__.py`). Its componentas are documented [as part of the auto-documentation](../Evennia-API.md).
|
||||
|
||||
## To remember when importing from `evennia`
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ through the launcher:
|
|||
This will start Evennia with the Server component running (in daemon mode) under
|
||||
cProfile. You could instead try `--profile` with the `portal` argument to
|
||||
profile the Portal (you would then need to
|
||||
[start the Server separately](../Setup/Start-Stop-Reload)).
|
||||
[start the Server separately](../Setup/Start-Stop-Reload.md)).
|
||||
|
||||
Please note that while the profiler is running, your process will use a lot more
|
||||
memory than usual. Memory usage is even likely to climb over time. So don't
|
||||
|
|
@ -127,7 +127,7 @@ game with simulated players (aka "bots" or "dummies"). Once connected, these
|
|||
dummies will semi-randomly perform various tasks from a list of possible
|
||||
actions. Use `Ctrl-C` to stop the Dummyrunner.
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
|
||||
You should not run the Dummyrunner on a production database. It
|
||||
will spawn many objects and also needs to run with general permissions.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
This is a list of various quirks or common stumbling blocks that people often ask about or report
|
||||
when using (or trying to use) Evennia. They are not bugs.
|
||||
|
||||
### Forgetting to use @reload to see changes to your typeclasses
|
||||
## Forgetting to use @reload to see changes to your typeclasses
|
||||
|
||||
Firstly: Reloading the server is a safe and usually quick operation which will *not* disconnect any
|
||||
accounts.
|
||||
|
|
@ -13,7 +13,7 @@ New users tend to forget this step. When editing source code (such as when tweak
|
|||
commands or adding new commands to command sets) you need to either use the in-game `@reload`
|
||||
command or, from the command line do `python evennia.py reload` before you see your changes.
|
||||
|
||||
### Web admin to create new Account
|
||||
## Web admin to create new Account
|
||||
|
||||
If you use the default login system and are trying to use the Web admin to create a new Player
|
||||
account, you need to consider which `MULTIACCOUNT_MODE` you are in. If you are in
|
||||
|
|
@ -28,12 +28,12 @@ the "account" property on the Character and the "character" property on the Acco
|
|||
other. You must also set the lockstring of the Character to allow the Account to "puppet" this
|
||||
particular character.
|
||||
|
||||
### Mutable attributes and their connection to the database
|
||||
## Mutable attributes and their connection to the database
|
||||
|
||||
When storing a mutable object (usually a list or a dictionary) in an Attribute
|
||||
|
||||
```python
|
||||
object.db.mylist = [1,2,3]
|
||||
object.db.mylist = [1,2,3]
|
||||
```
|
||||
|
||||
you should know that the connection to the database is retained also if you later extract that
|
||||
|
|
@ -62,16 +62,16 @@ use of `evennia.utils.dbserialize.deserialize`:
|
|||
The property `blist` is now `[1,2,3,4]` whereas `object.db.mylist` remains unchanged. If you want to
|
||||
update the database you'd need to explicitly re-assign the updated data to the `mylist` Attribute.
|
||||
|
||||
### Commands are matched by name *or* alias
|
||||
## Commands are matched by name *or* alias
|
||||
|
||||
When merging [command sets](../Components/Commands) it's important to remember that command objects are identified
|
||||
When merging [command sets](../Components/Commands.md) it's important to remember that command objects are identified
|
||||
*both* by key *or* alias. So if you have a command with a key `look` and an alias `ls`, introducing
|
||||
another command with a key `ls` will be assumed by the system to be *identical* to the first one.
|
||||
This usually means merging cmdsets will overload one of them depending on priority. Whereas this is
|
||||
logical once you know how command objects are handled, it may be confusing if you are just looking
|
||||
at the command strings thinking they are parsed as-is.
|
||||
|
||||
### Objects turning to `DefaultObject`
|
||||
## Objects turning to `DefaultObject`
|
||||
|
||||
A common confusing error for new developers is finding that one or more objects in-game are suddenly
|
||||
of the type `DefaultObject` rather than the typeclass you wanted it to be. This happens when you
|
||||
|
|
@ -82,7 +82,7 @@ back to the safe `DefaultObject` until you fix the problem and reload. Most erro
|
|||
be caught by any good text editors. Keep an eye on the terminal/console during a reload to catch
|
||||
such errors - you may have to scroll up if your window is small.
|
||||
|
||||
### Overriding of magic methods
|
||||
## Overriding of magic methods
|
||||
|
||||
Python implements a system of [magic
|
||||
methods](https://docs.python.org/3/reference/datamodel.html#emulating-container-types), usually
|
||||
|
|
@ -104,17 +104,17 @@ can result in very inconsistent and hard-to-diagnose errors.
|
|||
The moral of the story-- it can be dangerous to tinker with magic methods on typeclassed objects.
|
||||
Try to avoid doing so.
|
||||
|
||||
### Known upstream bugs
|
||||
## Known upstream bugs
|
||||
|
||||
- There is currently (Autumn 2017) a bug in the `zope.interface` installer on some Linux Ubuntu
|
||||
distributions (notably Ubuntu 16.04 LTS). Zope is a dependency of Twisted. The error manifests in
|
||||
the server not starting with an error that `zope.interface` is not found even though `pip list`
|
||||
shows it's installed. The reason is a missing empty `__init__.py` file at the root of the zope
|
||||
package. If the virtualenv is named "evenv" as suggested in the [Setup Quickstart](../Setup/Setup-Quickstart)
|
||||
package. If the virtualenv is named "evenv" as suggested in the [Setup Quickstart](../Setup/Setup-Quickstart.md)
|
||||
instructions, use the following command to fix it:
|
||||
|
||||
```shell
|
||||
touch evenv/local/lib/python2.7/site-packages/zope/__init__.py
|
||||
```
|
||||
|
||||
This will create the missing file and things should henceforth work correctly.
|
||||
This will create the missing file and things should henceforth work correctly.
|
||||
|
|
|
|||
|
|
@ -74,28 +74,28 @@ To test the results, you use special methods of the `TestCase` class. Many of t
|
|||
"`assert`", such as `assertEqual` or `assertTrue`.
|
||||
|
||||
Example of a `TestCase` class:
|
||||
|
||||
|
||||
```python
|
||||
import unittest
|
||||
|
||||
|
||||
# the function we want to test
|
||||
from mypath import myfunc
|
||||
|
||||
|
||||
class TestObj(unittest.TestCase):
|
||||
"This tests a function myfunc."
|
||||
|
||||
|
||||
def test_return_value(self):
|
||||
"test method. Makes sure return value is as expected."
|
||||
"test method. Makes sure return value is as expected."
|
||||
expected_return = "This is me being nice."
|
||||
actual_return = myfunc()
|
||||
# test
|
||||
# test
|
||||
self.assertEqual(expected_return, actual_return)
|
||||
def test_alternative_call(self):
|
||||
"test method. Calls with a keyword argument."
|
||||
expected_return = "This is me being baaaad."
|
||||
actual_return = myfunc(bad=True)
|
||||
# test
|
||||
self.assertEqual(expected_return, actual_return)
|
||||
self.assertEqual(expected_return, actual_return)
|
||||
```
|
||||
|
||||
You might also want to read the [documentation for the unittest
|
||||
|
|
@ -145,7 +145,7 @@ class in the same module to get access to the command-specific utilities mention
|
|||
self.call(general.CmdLook(), "Char2", "Char2(#7)")
|
||||
"tests the look command by simple call, with target as room"
|
||||
def test_mycmd_room(self):
|
||||
self.call(general.CmdLook(), "Room",
|
||||
self.call(general.CmdLook(), "Room",
|
||||
"Room(#1)\nroom_desc\nExits: out(#3)\n"
|
||||
"You see: Obj(#4), Obj2(#5), Char2(#7)")
|
||||
```
|
||||
|
|
@ -153,7 +153,7 @@ class in the same module to get access to the command-specific utilities mention
|
|||
### Unit testing contribs with custom models
|
||||
|
||||
A special case is if you were to create a contribution to go to the `evennia/contrib` folder that
|
||||
uses its [own database models](../Concepts/New-Models). The problem with this is that Evennia (and Django) will
|
||||
uses its [own database models](../Concepts/New-Models.md). The problem with this is that Evennia (and Django) will
|
||||
only recognize models in `settings.INSTALLED_APPS`. If a user wants to use your contrib, they will
|
||||
be required to add your models to their settings file. But since contribs are optional you cannot
|
||||
add the model to Evennia's central `settings_default.py` file - this would always create your
|
||||
|
|
@ -199,7 +199,7 @@ class TestMyModel(EvenniaTest):
|
|||
from django.db.models import loading
|
||||
loading.cache.loaded = False
|
||||
call_command('syncdb', verbosity=0)
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
settings.configure(**OLD_DEFAULT_SETTINGS)
|
||||
django.setup()
|
||||
|
|
@ -290,11 +290,11 @@ just to show how unit testing works:
|
|||
# mygame/commands/tests.py
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class TestString(unittest.TestCase):
|
||||
|
||||
|
||||
"""Unittest for strings (just a basic example)."""
|
||||
|
||||
|
||||
def test_upper(self):
|
||||
"""Test the upper() str method."""
|
||||
self.assertEqual('foo'.upper(), 'FOO')
|
||||
|
|
@ -317,7 +317,7 @@ Let's execute that test to see if it works.
|
|||
.
|
||||
----------------------------------------------------------------------
|
||||
Ran 1 test in 0.001s
|
||||
|
||||
|
||||
OK
|
||||
Destroying test database for alias 'default'...
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ to see how it looks when it fails.
|
|||
|
||||
### Testing commands
|
||||
|
||||
```warning:: This is not correct anymore.
|
||||
```{warning} This is not correct anymore.
|
||||
```
|
||||
|
||||
This section will test the proper execution of the 'abilities' command, as described in the DELETED
|
||||
|
|
@ -349,14 +349,14 @@ already have in `commands` from before.
|
|||
# bottom of mygame/commands/tests.py
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
|
||||
|
||||
from commands.command import CmdAbilities
|
||||
from typeclasses.characters import Character
|
||||
|
||||
|
||||
class TestAbilities(CommandTest):
|
||||
|
||||
|
||||
character_typeclass = Character
|
||||
|
||||
|
||||
def test_simple(self):
|
||||
self.call(CmdAbilities(), "", "STR: 5, AGI: 4, MAG: 2")
|
||||
```
|
||||
|
|
@ -392,7 +392,7 @@ Let's run our new test:
|
|||
..
|
||||
----------------------------------------------------------------------
|
||||
Ran 2 tests in 0.156s
|
||||
|
||||
|
||||
OK
|
||||
Destroying test database for alias 'default'...
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
|
||||
Fortunately, it's extremely easy to keep your Evennia server up-to-date. If you haven't already, see
|
||||
the [Getting Started guide](../Setup/Setup-Quickstart) and get everything running.
|
||||
the [Getting Started guide](../Setup/Setup-Quickstart.md) and get everything running.
|
||||
|
||||
### Updating with the latest Evennia code changes
|
||||
## Updating with the latest Evennia code changes
|
||||
|
||||
Very commonly we make changes to the Evennia code to improve things. There are many ways to get told
|
||||
when to update: You can subscribe to the RSS feed or manually check up on the feeds from
|
||||
|
|
@ -30,7 +30,7 @@ the new code affect your game. If you want to be really sure you should run a fu
|
|||
so that both Server and Portal can restart (this will disconnect everyone though, so if you know the
|
||||
Portal has had no updates you don't have to do that).
|
||||
|
||||
### Upgrading Evennia dependencies
|
||||
## Upgrading Evennia dependencies
|
||||
|
||||
On occasion we update the versions of third-party libraries Evennia depend on (or we may add a new
|
||||
dependency). This will be announced on the mailing list/forum. If you run into errors when starting
|
||||
|
|
@ -40,8 +40,8 @@ version that should not be used in production.
|
|||
|
||||
Upgrading `evennia` will automatically fetch all the latest packages that it now need. First `cd` to
|
||||
your cloned `evennia` folder. Make sure your `virtualenv` is active and use
|
||||
|
||||
pip install --upgrade -e .
|
||||
|
||||
pip install --upgrade -e .
|
||||
|
||||
Remember the period (`.`) at the end - that applies the upgrade to the current location (your
|
||||
`evennia` dir).
|
||||
|
|
@ -55,7 +55,7 @@ source-code changes.
|
|||
Follow the upgrade output to make sure it finishes without errors. To check what packages are
|
||||
currently available in your python environment after the upgrade, use
|
||||
|
||||
pip list
|
||||
pip list
|
||||
|
||||
This will show you the version of all installed packages. The `evennia` package will also show the
|
||||
location of its source code.
|
||||
|
|
@ -72,13 +72,13 @@ When the database schema changes, you just go to your game folder and run
|
|||
evennia migrate
|
||||
|
||||
> Hint: If the `evennia` command is not found, you most likely need to activate your
|
||||
[virtualenv](../Glossary#virtualenv).
|
||||
[virtualenv](../Glossary.md#virtualenv).
|
||||
|
||||
## Resetting your database
|
||||
|
||||
Should you ever want to start over completely from scratch, there is no need to re-download Evennia
|
||||
or anything like that. You just need to clear your database. Once you are done, you just rebuild it
|
||||
from scratch by running
|
||||
from scratch by running
|
||||
|
||||
evennia migrate
|
||||
|
||||
|
|
@ -131,4 +131,4 @@ automatically for you. Basically, whenever the schema changes we distribute smal
|
|||
"migrations" with the source. Those tell the system exactly how to implement the change so you don't
|
||||
have to do so manually. When a migration has been added we will tell you so on Evennia's mailing
|
||||
lists and in commit messages -
|
||||
you then just run `evennia migrate` to be up-to-date again.
|
||||
you then just run `evennia migrate` to be up-to-date again.
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ developer mailing list or IRC chat to see beforehand if your feature is deemed s
|
|||
as a core feature in the engine. When it comes to bug-fixes, other developers may also have good
|
||||
input on how to go about resolving the issue.
|
||||
|
||||
To contribute you need to have [forked Evennia](./Version-Control#forking-evennia) first. As described
|
||||
To contribute you need to have [forked Evennia](./Version-Control.md#forking-evennia) first. As described
|
||||
above you should do your modification in a separate local branch (not in the master branch). This
|
||||
branch is what you then present to us (as a *Pull request*, PR, see below). We can then merge your
|
||||
change into the upstream master and you then do `git pull` to update master usual. Now that the
|
||||
|
|
|
|||
|
|
@ -1,45 +1,45 @@
|
|||
# Accounts
|
||||
|
||||
|
||||
All *users* (real people) that starts a game [Session](./Sessions) on Evennia are doing so through an
|
||||
All *users* (real people) that starts a game [Session](./Sessions.md) on Evennia are doing so through an
|
||||
object called *Account*. The Account object has no in-game representation, it represents a unique
|
||||
game account. In order to actually get on the game the Account must *puppet* an [Object](./Objects)
|
||||
(normally a [Character](./Objects#Character)).
|
||||
game account. In order to actually get on the game the Account must *puppet* an [Object](./Objects.md)
|
||||
(normally a [Character](./Objects.md#characters)).
|
||||
|
||||
Exactly how many Sessions can interact with an Account and its Puppets at once is determined by
|
||||
Evennia's [MULTISESSION_MODE](./Sessions#Multisession-mode) setting.
|
||||
Evennia's [MULTISESSION_MODE](./Sessions.md#multisession-mode) setting.
|
||||
|
||||
Apart from storing login information and other account-specific data, the Account object is what is
|
||||
chatting on [Channels](./Communications). It is also a good place to store [Permissions](./Locks) to be
|
||||
chatting on [Channels](./Communications.md). It is also a good place to store [Permissions](./Locks.md) to be
|
||||
consistent between different in-game characters as well as configuration options. The Account
|
||||
object also has its own [CmdSet](./Command-Sets), the `AccountCmdSet`.
|
||||
object also has its own [CmdSet](./Command-Sets.md), the `AccountCmdSet`.
|
||||
|
||||
Logged into default evennia, you can use the `ooc` command to leave your current
|
||||
[character](./Objects) and go into OOC mode. You are quite limited in this mode, basically it works
|
||||
[character](./Objects.md) and go into OOC mode. You are quite limited in this mode, basically it works
|
||||
like a simple chat program. It acts as a staging area for switching between Characters (if your
|
||||
game supports that) or as a safety mode if your Character gets deleted. Use `ic` to attempt to
|
||||
(re)puppet a Character.
|
||||
(re)puppet a Character.
|
||||
|
||||
Note that the Account object can have, and often does have, a different set of
|
||||
[Permissions](./Locks#Permissions) from the Character they control. Normally you should put your
|
||||
[Permissions](./Permissions.md) from the Character they control. Normally you should put your
|
||||
permissions on the Account level - this will overrule permissions set on the Character level. For
|
||||
the permissions of the Character to come into play the default `quell` command can be used. This
|
||||
allows for exploring the game using a different permission set (but you can't escalate your
|
||||
permissions this way - for hierarchical permissions like `Builder`, `Admin` etc, the *lower* of the
|
||||
permissions on the Character/Account will always be used).
|
||||
permissions on the Character/Account will always be used).
|
||||
|
||||
## How to create your own Account types
|
||||
|
||||
You will usually not want more than one Account typeclass for all new accounts (but you could in
|
||||
principle create a system that changes an account's typeclass dynamically).
|
||||
principle create a system that changes an account's typeclass dynamically).
|
||||
|
||||
An Evennia Account is, per definition, a Python class that includes `evennia.DefaultAccount` among
|
||||
its parents. In `mygame/typeclasses/accounts.py` there is an empty class ready for you to modify.
|
||||
Evennia defaults to using this (it inherits directly from `DefaultAccount`).
|
||||
Evennia defaults to using this (it inherits directly from `DefaultAccount`).
|
||||
|
||||
Here's an example of modifying the default Account class in code:
|
||||
Here's an example of modifying the default Account class in code:
|
||||
|
||||
```python
|
||||
```python
|
||||
# in mygame/typeclasses/accounts.py
|
||||
|
||||
from evennia import DefaultAccount
|
||||
|
|
@ -51,7 +51,7 @@ Here's an example of modifying the default Account class in code:
|
|||
self.db.config_1 = True # default config self.db.config_2 = False # "
|
||||
self.db.config_3 = 1 # "
|
||||
|
||||
# ... whatever else our game needs to know ``` Reload the server with `reload`.
|
||||
# ... whatever else our game needs to know ``` Reload the server with `reload`.
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ using `py`:
|
|||
|
||||
``` py [account.at_account_creation() for account in evennia.managers.accounts.all()] ```
|
||||
|
||||
You should now see the Attributes on yourself.
|
||||
You should now see the Attributes on yourself.
|
||||
|
||||
|
||||
> If you wanted Evennia to default to a completely *different* Account class located elsewhere, you
|
||||
|
|
@ -76,8 +76,8 @@ You should now see the Attributes on yourself.
|
|||
|
||||
## Properties on Accounts
|
||||
|
||||
Beyond those properties assigned to all typeclassed objects (see [Typeclasses](./Typeclasses)), the
|
||||
Account also has the following custom properties:
|
||||
Beyond those properties assigned to all typeclassed objects (see [Typeclasses](./Typeclasses.md)), the
|
||||
Account also has the following custom properties:
|
||||
|
||||
- `user` - a unique link to a `User` Django object, representing the logged-in user.
|
||||
- `obj` - an alias for `character`.
|
||||
|
|
@ -91,12 +91,12 @@ as
|
|||
- `is_superuser` (bool: True/False) - if this account is a superuser.
|
||||
|
||||
Special handlers:
|
||||
- `cmdset` - This holds all the current [Commands](./Commands) of this Account. By default these are
|
||||
- `cmdset` - This holds all the current [Commands](./Commands.md) of this Account. By default these are
|
||||
the commands found in the cmdset defined by `settings.CMDSET_ACCOUNT`.
|
||||
- `nicks` - This stores and handles [Nicks](./Nicks), in the same way as nicks it works on Objects.
|
||||
- `nicks` - This stores and handles [Nicks](./Nicks.md), in the same way as nicks it works on Objects.
|
||||
For Accounts, nicks are primarily used to store custom aliases for
|
||||
[Channels](./Communications#Channels).
|
||||
|
||||
[Channels](./Channels.md).
|
||||
|
||||
Selection of special methods (see `evennia.DefaultAccount` for details):
|
||||
- `get_puppet` - get a currently puppeted object connected to the Account and a given session id, if
|
||||
any.
|
||||
|
|
@ -104,4 +104,4 @@ Selection of special methods (see `evennia.DefaultAccount` for details):
|
|||
- `unpuppet_object` - disconnect a session from a puppetable Object.
|
||||
- `msg` - send text to the Account
|
||||
- `execute_cmd` - runs a command as if this Account did it.
|
||||
- `search` - search for Accounts.
|
||||
- `search` - search for Accounts.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ can give correct subsequent commands. If you are writing a combat system, you mi
|
|||
combattant's next roll get easier dependent on if their opponent failed. Your characters will
|
||||
probably need to store roleplaying-attributes like strength and agility. And so on.
|
||||
|
||||
[Typeclassed](./Typeclasses) game entities ([Accounts](./Accounts), [Objects](./Objects),
|
||||
[Scripts](./Scripts) and [Channels](./Communications)) always have *Attributes* associated with them.
|
||||
[Typeclassed](./Typeclasses.md) game entities ([Accounts](./Accounts.md), [Objects](./Objects.md),
|
||||
[Scripts](./Scripts.md) and [Channels](./Communications.md)) always have *Attributes* associated with them.
|
||||
Attributes are used to store any type of data 'on' such entities. This is different from storing
|
||||
data in properties already defined on entities (such as `key` or `location`) - these have very
|
||||
specific names and require very specific types of data (for example you couldn't assign a python
|
||||
|
|
@ -16,12 +16,12 @@ specific names and require very specific types of data (for example you couldn't
|
|||
want to assign arbitrary data to arbitrary names.
|
||||
|
||||
**Attributes are _not_ secure by default and any player may be able to change them unless you
|
||||
[prevent this behavior](./Attributes#locking-and-checking-attributes).**
|
||||
[prevent this behavior](./Attributes.md#locking-and-checking-attributes).**
|
||||
|
||||
## The .db and .ndb shortcuts
|
||||
|
||||
To save persistent data on a Typeclassed object you normally use the `db` (DataBase) operator. Let's
|
||||
try to save some data to a *Rose* (an [Object](./Objects)):
|
||||
try to save some data to a *Rose* (an [Object](./Objects.md)):
|
||||
|
||||
```python
|
||||
# saving
|
||||
|
|
@ -87,13 +87,13 @@ The handlers have normal access methods that allow you to manage and retrieve `A
|
|||
returned, but the method takes keywords for returning the Attribute object itself. By supplying an
|
||||
`accessing_object` to the call one can also make sure to check permissions before modifying
|
||||
anything.
|
||||
- `add(...)` - this adds a new Attribute to the object. An optional [lockstring](./Locks) can be
|
||||
- `add(...)` - this adds a new Attribute to the object. An optional [lockstring](./Locks.md) can be
|
||||
supplied here to restrict future access and also the call itself may be checked against locks.
|
||||
- `remove(...)` - Remove the given Attribute. This can optionally be made to check for permission
|
||||
before performing the deletion. - `clear(...)` - removes all Attributes from object.
|
||||
- `all(...)` - returns all Attributes (of the given category) attached to this object.
|
||||
|
||||
See [this section](./Attributes#locking-and-checking-attributes) for more about locking down Attribute
|
||||
See [this section](./Attributes.md#locking-and-checking-attributes) for more about locking down Attribute
|
||||
access and editing. The `Nattribute` offers no concept of access control.
|
||||
|
||||
Some examples:
|
||||
|
|
@ -118,23 +118,23 @@ An Attribute object is stored in the database. It has the following properties:
|
|||
to `attrname`.
|
||||
- `value` - this is the value of the Attribute. This value can be anything which can be pickled -
|
||||
objects, lists, numbers or what have you (see
|
||||
[this section](./Attributes#What_types_of_data_can_I_save_in_an_Attribute) for more info). In the
|
||||
[this section](./Attributes.md#what-types-of-data-can-i-save-in-an-attribute) for more info). In the
|
||||
example
|
||||
`obj.db.attrname = value`, the `value` is stored here.
|
||||
- `category` - this is an optional property that is set to None for most Attributes. Setting this
|
||||
allows to use Attributes for different functionality. This is usually not needed unless you want
|
||||
to use Attributes for very different functionality ([Nicks](./Nicks) is an example of using
|
||||
to use Attributes for very different functionality ([Nicks](./Nicks.md) is an example of using
|
||||
Attributes
|
||||
in this way). To modify this property you need to use the [Attribute
|
||||
Handler](Attributes#The_Attribute_Handler).
|
||||
in this way). To modify this property you need to use the
|
||||
[Attribute Handler](./Attributes.md#the-attributehandler).
|
||||
- `strvalue` - this is a separate value field that only accepts strings. This severely limits the
|
||||
data possible to store, but allows for easier database lookups. This property is usually not used
|
||||
except when re-using Attributes for some other purpose ([Nicks](./Nicks) use it). It is only
|
||||
accessible via the [Attribute Handler](./Attributes#The_Attribute_Handler).
|
||||
except when re-using Attributes for some other purpose ([Nicks](./Nicks.md) use it). It is only
|
||||
accessible via the [Attribute Handler](./Attributes.md#the-attributehandler).
|
||||
|
||||
There are also two special properties:
|
||||
|
||||
- `attrtype` - this is used internally by Evennia to separate [Nicks](./Nicks), from Attributes (Nicks
|
||||
- `attrtype` - this is used internally by Evennia to separate [Nicks](./Nicks.md), from Attributes (Nicks
|
||||
use Attributes behind the scenes).
|
||||
- `model` - this is a *natural-key* describing the model this Attribute is attached to. This is on
|
||||
the form *appname.modelclass*, like `objects.objectdb`. It is used by the Attribute and
|
||||
|
|
@ -162,7 +162,7 @@ default
|
|||
during heavy loads.
|
||||
- A more valid reason for using non-persistent data is if you *want* to lose your state when logging
|
||||
off. Maybe you are storing throw-away data that are re-initialized at server startup. Maybe you
|
||||
are implementing some caching of your own. Or maybe you are testing a buggy [Script](./Scripts) that
|
||||
are implementing some caching of your own. Or maybe you are testing a buggy [Script](./Scripts.md) that
|
||||
does potentially harmful stuff to your character object. With non-persistent storage you can be
|
||||
sure
|
||||
that whatever is messed up, it's nothing a server reboot can't clear up.
|
||||
|
|
@ -192,7 +192,7 @@ not a big deal. But if you are accessing the Attribute as part of some big loop
|
|||
amount of reads/writes you should first extract it to a temporary variable, operate on *that* and
|
||||
then save the result back to the Attribute. If you are storing a more complex structure like a
|
||||
`dict` or a `list` you should make sure to "disconnect" it from the database before looping over it,
|
||||
as mentioned in the [Retrieving Mutable Objects](./Attributes#retrieving-mutable-objects) section
|
||||
as mentioned in the [Retrieving Mutable Objects](./Attributes.md#retrieving-mutable-objects) section
|
||||
below.
|
||||
|
||||
### Storing single objects
|
||||
|
|
@ -248,7 +248,7 @@ containing dicts, etc.
|
|||
Since you can use any combination of the above iterables, this is generally not much of a
|
||||
limitation.
|
||||
|
||||
Any entity listed in the [Single object](./Attributes#Storing-Single-Objects) section above can be
|
||||
Any entity listed in the [Single object](./Attributes.md#storing-single-objects) section above can be
|
||||
stored in the iterable.
|
||||
|
||||
> As mentioned in the previous section, database entities (aka typeclasses) are not possible to
|
||||
|
|
@ -355,7 +355,7 @@ already disconnected from the database from the onset.
|
|||
Attributes are normally not locked down by default, but you can easily change that for individual
|
||||
Attributes (like those that may be game-sensitive in games with user-level building).
|
||||
|
||||
First you need to set a *lock string* on your Attribute. Lock strings are specified [Locks](./Locks).
|
||||
First you need to set a *lock string* on your Attribute. Lock strings are specified [Locks](./Locks.md).
|
||||
The relevant lock types are
|
||||
|
||||
- `attrread` - limits who may read the value of the Attribute
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Batch Code Processor
|
||||
|
||||
|
||||
For an introduction and motivation to using batch processors, see [here](./Batch-Processors). This
|
||||
For an introduction and motivation to using batch processors, see [here](./Batch-Processors.md). This
|
||||
page describes the Batch-*code* processor. The Batch-*command* one is covered [here](Batch-Command-
|
||||
Processor).
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ connect that room with a room you built in the current block. There are two ways
|
|||
|
||||
- Perform a database search for the name of the room you created (since you cannot know in advance
|
||||
which dbref it got assigned). The problem is that a name may not be unique (you may have a lot of "A
|
||||
dark forest" rooms). There is an easy way to handle this though - use [Tags](./Tags) or *Aliases*. You
|
||||
dark forest" rooms). There is an easy way to handle this though - use [Tags](./Tags.md) or *Aliases*. You
|
||||
can assign any number of tags and/or aliases to any object. Make sure that one of those tags or
|
||||
aliases is unique to the room (like "room56") and you will henceforth be able to always uniquely
|
||||
search and find it later.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Batch Command Processor
|
||||
|
||||
|
||||
For an introduction and motivation to using batch processors, see [here](./Batch-Processors). This
|
||||
For an introduction and motivation to using batch processors, see [here](./Batch-Processors.md). This
|
||||
page describes the Batch-*command* processor. The Batch-*code* one is covered [here](Batch-Code-
|
||||
Processor).
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ when creating the file, so that you can 'walk' (or teleport) to the right places
|
|||
This also means there are several pitfalls when designing and adding certain types of objects. Here
|
||||
are some examples:
|
||||
|
||||
- *Rooms that change your [Command Set](./Command-Sets)*: Imagine that you build a 'dark' room, which
|
||||
- *Rooms that change your [Command Set](./Command-Sets.md)*: Imagine that you build a 'dark' room, which
|
||||
severely limits the cmdsets of those entering it (maybe you have to find the light switch to
|
||||
proceed). In your batch script you would create this room, then teleport to it - and promptly be
|
||||
shifted into the dark state where none of your normal build commands work ...
|
||||
|
|
@ -172,7 +172,7 @@ The fact that you build as 'yourself' can also be considered an advantage howeve
|
|||
decide to change the default command to allow others than superusers to call the processor. Since
|
||||
normal access-checks are still performed, a malevolent builder with access to the processor should
|
||||
not be able to do all that much damage (this is the main drawback of the [Batch Code
|
||||
Processor](Batch-Code-Processor))
|
||||
Processor](./Batch-Code-Processor.md))
|
||||
|
||||
- [GNU Emacs](https://www.gnu.org/software/emacs/) users might find it interesting to use emacs'
|
||||
*evennia mode*. This is an Emacs major mode found in `evennia/utils/evennia-mode.el`. It offers
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ just list in-game commands in a text file. The code-processor on the other hand
|
|||
powerful but also more complex - it lets you use Evennia's API to code your world in full-fledged
|
||||
Python code.
|
||||
|
||||
- The [Batch Command Processor](./Batch-Command-Processor)
|
||||
- The [Batch Code Processor](./Batch-Code-Processor)
|
||||
- The [Batch Command Processor](./Batch-Command-Processor.md)
|
||||
- The [Batch Code Processor](./Batch-Code-Processor.md)
|
||||
|
||||
If you plan to use international characters in your batchfiles you are wise to read about *file
|
||||
encodings* below.
|
||||
|
|
@ -73,7 +73,7 @@ need to add the editor's encoding to Evennia's `ENCODINGS` list. If you are unsu
|
|||
file with lots of non-ASCII letters in the editor of your choice, then import to make sure it works
|
||||
as it should.
|
||||
|
||||
More help with encodings can be found in the entry [Text Encodings](../Concepts/Text-Encodings) and also in the
|
||||
More help with encodings can be found in the entry [Text Encodings](../Concepts/Text-Encodings.md) and also in the
|
||||
Wikipedia article [here](https://en.wikipedia.org/wiki/Text_encodings).
|
||||
|
||||
**A footnote for the batch-code processor**: Just because *Evennia* can parse your file and your
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
Bootstrap provides many utilities and components you can use when customizing Evennia's web
|
||||
presence. We'll go over a few examples here that you might find useful.
|
||||
> Please take a look at either [the basic web tutorial](../Howto/Starting/Part5/Add-a-simple-new-web-page) or
|
||||
>[the web character view tutorial](../Howto/Web-Character-View-Tutorial)
|
||||
> Please take a look at either [the basic web tutorial](../Howto/Starting/Part5/Add-a-simple-new-web-page.md) or
|
||||
>[the web character view tutorial](../Howto/Web-Character-View-Tutorial.md)
|
||||
> to get a feel for how to add pages to Evennia's website to test these examples.
|
||||
|
||||
## General Styling
|
||||
|
|
@ -77,4 +77,4 @@ width of the page - Evennia's base site uses the former.
|
|||
### Forms
|
||||
[Forms](https://getbootstrap.com/docs/4.0/components/forms/) are highly customizable with Bootstrap.
|
||||
For a more in-depth look at how to use forms and their styles in your own Evennia site, please read
|
||||
over [the web character gen tutorial.](../Howto/Web-Character-Generation)
|
||||
over [the web character gen tutorial.](../Howto/Web-Character-Generation.md)
|
||||
|
|
@ -7,8 +7,8 @@ _Channels_ allows Evennia's to act as a fancy chat program. When a player is
|
|||
connected to a channel, sending a message to it will automatically distribute
|
||||
it to every other subscriber.
|
||||
|
||||
Channels can be used both for chats between [Accounts](./Accounts) and between
|
||||
[Objects](./Objects) (usually Characters). Chats could be both OOC
|
||||
Channels can be used both for chats between [Accounts](./Accounts.md) and between
|
||||
[Objects](./Objects.md) (usually Characters). Chats could be both OOC
|
||||
(out-of-character) or IC (in-charcter) in nature. Some examples:
|
||||
|
||||
- A support channel for contacting staff (OOC)
|
||||
|
|
@ -20,7 +20,7 @@ Channels can be used both for chats between [Accounts](./Accounts) and between
|
|||
- Group telephathy (IC)
|
||||
- Walkie talkies (IC)
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
|
||||
Channel system changed to use a central 'channel' command and nicks instead of
|
||||
auto-generated channel-commands and -cmdset. ChannelHandler was removed.
|
||||
|
|
@ -30,7 +30,8 @@ Channels can be used both for chats between [Accounts](./Accounts) and between
|
|||
## Using channels in-game
|
||||
|
||||
In the default command set, channels are all handled via the mighty
|
||||
[channel command](api:evennia.commands.default.comms.CmdChannel), `channel` (or
|
||||
[channel
|
||||
command](evennia.commands.default.comms.CmdChannel), `channel` (or
|
||||
`chan`). By default, this command will assume all entities dealing with
|
||||
channels are `Accounts`.
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ system automatically sets up an personal alias so you can do this instead:
|
|||
|
||||
public Hello world
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
|
||||
This shortcut will not work if the channel-name has spaces in it.
|
||||
So channels with long names should make sure to provide a one-word alias as
|
||||
|
|
@ -91,7 +92,7 @@ But you can also use your alias with the `channel` command:
|
|||
|
||||
channel foo Hello world!
|
||||
|
||||
> What happens when aliasing is that a [nick](./Nicks) is created that maps your
|
||||
> What happens when aliasing is that a [nick](./Nicks.md) is created that maps your
|
||||
> alias + argument onto calling the `channel` command. So when you enter `foo hello`,
|
||||
> what the server sees is actually `channel foo = hello`. The system is also
|
||||
> clever enough to know that whenever you search for channels, your channel-nicks
|
||||
|
|
@ -140,10 +141,10 @@ Banning adds the user to the channels blacklist. This means they will not be
|
|||
able to _rejoin_ if you boot them. You will need to run `channel/boot` to
|
||||
actually kick them out.
|
||||
|
||||
See the [Channel command](api:evennia.commands.default.comms.CmdChannel) api
|
||||
See the [Channel command](evennia.commands.default.comms.CmdChannel) api
|
||||
docs (and in-game help) for more details.
|
||||
|
||||
Admin-level users can also modify channel's [locks](./Locks):
|
||||
Admin-level users can also modify channel's [locks](./Locks.md):
|
||||
|
||||
channel/lock buildchannel = listen:all();send:perm(Builders)
|
||||
|
||||
|
|
@ -158,7 +159,7 @@ Channels use three lock-types by default:
|
|||
|
||||
#### Restricting channel administration
|
||||
|
||||
By default everyone can use the channel command ([evennia.commands.default.comms.CmdChannel](api:evennia.commands.default.comms.CmdChannel))
|
||||
By default everyone can use the channel command ([evennia.commands.default.comms.CmdChannel](evennia.commands.default.comms.CmdChannel))
|
||||
to create channels and will then control the channels they created (to boot/ban
|
||||
people etc). If you as a developer does not want regular players to do this
|
||||
(perhaps you want only staff to be able to spawn new channels), you can
|
||||
|
|
@ -170,7 +171,7 @@ The default `help` command has the following `locks` property:
|
|||
locks = "cmd:not perm(channel_banned); admin:all(); manage:all(); changelocks: perm(Admin)"
|
||||
```
|
||||
|
||||
This is a regular [lockstring](./Locks).
|
||||
This is a regular [lockstring](./Locks.md).
|
||||
|
||||
- `cmd: pperm(channel_banned)` - The `cmd` locktype is the standard one used for all Commands.
|
||||
an accessing object failing this will not even know that the command exists. The `pperm()` lockfunc
|
||||
|
|
@ -204,14 +205,14 @@ access-denied error when trying to use use these switches.
|
|||
|
||||
## Allowing Characters to use Channels
|
||||
|
||||
The default `channel` command ([evennia.commands.default.comms.CmdChannel](api:evennia.commands.default.comms.CmdChannel))
|
||||
sits in the `Account` [command set](./Command-Sets). It is set up such that it will
|
||||
The default `channel` command ([evennia.commands.default.comms.CmdChannel](evennia.commands.default.comms.CmdChannel))
|
||||
sits in the `Account` [command set](./Command-Sets.md). It is set up such that it will
|
||||
always operate on `Accounts`, even if you were to add it to the
|
||||
`CharacterCmdSet`.
|
||||
|
||||
It's a one-line change to make this command accept non-account callers. But for
|
||||
convenience we provide a version for Characters/Objects. Just import
|
||||
[evennia.commands.default.comms.CmdObjectChannel](api:evennia.commands.default.comms.CmdObjectChannel)
|
||||
[evennia.commands.default.comms.CmdObjectChannel](evennia.commands.default.comms.CmdObjectChannel)
|
||||
and inherit from that instead.
|
||||
|
||||
## Customizing channel output and behavior
|
||||
|
|
@ -248,13 +249,13 @@ For most common changes, the default channel, the recipient hooks and possibly
|
|||
overriding the `channel` command will get you very far. But you can also tweak
|
||||
channels themselves.
|
||||
|
||||
Channels are [Typeclassed](./Typeclasses) entities. This means they are
|
||||
persistent in the database, can have [attributes](./Attributes) and [Tags](./Tags)
|
||||
Channels are [Typeclassed](./Typeclasses.md) entities. This means they are
|
||||
persistent in the database, can have [attributes](./Attributes.md) and [Tags](./Tags.md)
|
||||
and can be easily extended.
|
||||
|
||||
To change which channel typeclass Evennia uses for default commands, change
|
||||
`settings.BASE_CHANNEL_TYPECLASS`. The base command class is
|
||||
[`evennia.comms.comms.DefaultChannel`](api:evennia.comms.comms.DefaultChannel).
|
||||
[`evennia.comms.comms.DefaultChannel`](evennia.comms.comms.DefaultChannel).
|
||||
There is an empty child class in `mygame/typeclasses/channels.py`, same
|
||||
as for other typelass-bases.
|
||||
|
||||
|
|
@ -299,11 +300,11 @@ details.
|
|||
|
||||
## Channel logging
|
||||
|
||||
```versionchanged:: 0.7
|
||||
```{versionchanged} 0.7
|
||||
|
||||
Channels changed from using Msg to TmpMsg and optional log files.
|
||||
```
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
|
||||
Channels stopped supporting Msg and TmpMsg, using only log files.
|
||||
```
|
||||
|
|
@ -325,7 +326,7 @@ channel's `at_post_channel_msg` method.
|
|||
|
||||
Channels have all the standard properties of a Typeclassed entity (`key`,
|
||||
`aliases`, `attributes`, `tags`, `locks` etc). This is not an exhaustive list;
|
||||
see the [Channel api docs](api:evennia.comms.comms.DefaultChannel) for details.
|
||||
see the [Channel api docs](evennia.comms.comms.DefaultChannel) for details.
|
||||
|
||||
- `send_to_online_only` - this class boolean defaults to `True` and is a
|
||||
sensible optimization since people offline people will not see the message anyway.
|
||||
|
|
@ -334,8 +335,8 @@ see the [Channel api docs](api:evennia.comms.comms.DefaultChannel) for details.
|
|||
`mygame/server/logs/`). You should usually not change this.
|
||||
- `channel_prefix_string` - this property is a string to easily change how
|
||||
the channel is prefixed. It takes the `channelname` format key. Default is `"[{channelname}] "`
|
||||
and produces output like `[public] ...``.
|
||||
- `subscriptions` - this is the [SubscriptionHandler](api:evennia.comms.comms#SubscriptionHandler), which
|
||||
and produces output like `[public] ...`.
|
||||
- `subscriptions` - this is the [SubscriptionHandler](evennia.comms.models.SubscriptionHandler), which
|
||||
has methods `has`, `add`, `remove`, `all`, `clear` and also `online` (to get
|
||||
only actually online channel-members).
|
||||
- `wholist`, `mutelist`, `banlist` are properties that return a list of subscribers,
|
||||
|
|
@ -345,7 +346,7 @@ see the [Channel api docs](api:evennia.comms.comms.DefaultChannel) for details.
|
|||
This pattern accepts an `{alias}` formatting marker. Don't mess with this unless you really
|
||||
want to change how channels work.
|
||||
- `channel_msg_nick_replacement` - this is a string on the [nick replacement
|
||||
- form](Nicks). It accepts the `{channelname}` formatting tag. This is strongly tied to the
|
||||
- form](./Nicks.md). It accepts the `{channelname}` formatting tag. This is strongly tied to the
|
||||
`channel` command and is by default `channel {channelname} = $1`.
|
||||
|
||||
Notable `Channel` hooks:
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ If you need to search for objects in a code module you can use the functions in
|
|||
obj = search_object(objname)
|
||||
```
|
||||
|
||||
- [evennia.search_account](../wiki/evennia.accounts.manager#accountdbmanagersearch_account)
|
||||
- [evennia.search_object](../wiki/evennia.objects.manager#objectdbmanagersearch_object)
|
||||
- [evennia.search_object_by_tag](../wiki/evennia.utils.search#search_object_by_tag)
|
||||
- [evennia.search_script](../wiki/evennia.scripts.manager#scriptdbmanagersearch_script)
|
||||
- [evennia.search_channel](../wiki/evennia.comms.managers#channeldbmanagersearch_channel)
|
||||
- [evennia.search_message](../wiki/evennia.comms.managers#msgmanagersearch_message)
|
||||
- [evennia.search_help](../wiki/evennia.help.manager#helpentrymanagersearch_help)
|
||||
- [`evennia.search_account`](evennia.accounts.manager.AccountDBManager.search_account)
|
||||
- [`evennia.search_object`](evennia.objects.manager.ObjectDBManager.search_object)
|
||||
- [`evennia.search(object)_by_tag`](evennia.utils.search.search_tag)
|
||||
- [`evennia.search_script`](evennia.scripts.manager.ScriptDBManager.search_script)
|
||||
- [`evennia.search_channel`](evennia.comms.managers.ChannelDBManager.search_channel)
|
||||
- [`evennia.search_message`](evennia.comms.managers.MsgManager.search_message)
|
||||
- [`evennia.search_help`](evennia.help.manager.HelpEntryManager.search_help)
|
||||
|
||||
Note that these latter methods will always return a `list` of results, even if the list has one or
|
||||
zero entries.
|
||||
|
|
@ -50,12 +50,12 @@ entities directly in code (for example when defining new create commands).
|
|||
myobj = evennia.create_objects("game.gamesrc.objects.myobj.MyObj", key="MyObj")
|
||||
```
|
||||
|
||||
- [evennia.create_account](../wiki/evennia.utils.create#create_account)
|
||||
- [evennia.create_object](../wiki/evennia.utils.create#create_object)
|
||||
- [evennia.create_script](../wiki/evennia.utils.create#create_script)
|
||||
- [evennia.create_channel](../wiki/evennia.utils.create#create_channel)
|
||||
- [evennia.create_help_entry](../wiki/evennia.utils.create#create_help_entry)
|
||||
- [evennia.create_message](../wiki/evennia.utils.create#create_message)
|
||||
- [`evennia.create_account`](evennia.utils.create.create_account)
|
||||
- [`evennia.create_object`](evennia.utils.create.create_object)
|
||||
- [`evennia.create_script`](evennia.utils.create.create_script)
|
||||
- [`evennia.create_channel`](evennia.utils.create.create_channel)
|
||||
- [`evennia.create_help_entry`](evennia.utils.create.create_help_entry)
|
||||
- [`evennia.create_message`](evennia.utils.create.create_message)
|
||||
|
||||
Each of these create-functions have a host of arguments to further customize the created entity. See
|
||||
`evennia/utils/create.py` for more information.
|
||||
|
|
@ -137,7 +137,7 @@ setting `TIME_GAME_EPOCH` sets the starting game epoch (in seconds). The functio
|
|||
you desire for your game. You can use the `@time` command to view the server time info.
|
||||
|
||||
You can also *schedule* things to happen at specific in-game times using the
|
||||
[gametime.schedule](github:evennia.utils.gametime#schedule) function:
|
||||
[gametime.schedule](evennia.utils.gametime.schedule) function:
|
||||
|
||||
```python
|
||||
import evennia
|
||||
|
|
@ -181,13 +181,13 @@ number of seconds. This is a very light wrapper over a Twisted
|
|||
non-persistently, which means that if the server is `@reload`ed before the delay is over, the
|
||||
callback will never run (the server forgets it). If setting `persistent` to True, the delay will be
|
||||
stored in the database and survive a `@reload` - but for this to work it is susceptible to the same
|
||||
limitations incurred when saving to an [Attribute](./Attributes).
|
||||
limitations incurred when saving to an [Attribute](./Attributes.md).
|
||||
|
||||
The `deferred` return object can usually be ignored, but calling its `.cancel()` method will abort
|
||||
the delay prematurely.
|
||||
|
||||
`utils.delay` is the lightest form of delayed call in Evennia. For other way to create time-bound
|
||||
tasks, see the [TickerHandler](./TickerHandler) and [Scripts](./Scripts).
|
||||
tasks, see the [TickerHandler](./TickerHandler.md) and [Scripts](./Scripts.md).
|
||||
|
||||
> Note that many delayed effects can be achieved without any need for an active timer. For example
|
||||
if you have a trait that should recover a point every 5 seconds you might just need its value when
|
||||
|
|
@ -203,7 +203,7 @@ classes, instances or python-paths-to-classes.
|
|||
|
||||
Note that Python code should usually work with [duck
|
||||
typing](https://en.wikipedia.org/wiki/Duck_typing). But in Evennia's case it can sometimes be useful
|
||||
to check if an object inherits from a given [Typeclass](./Typeclasses) as a way of identification. Say
|
||||
to check if an object inherits from a given [Typeclass](./Typeclasses.md) as a way of identification. Say
|
||||
for example that we have a typeclass *Animal*. This has a subclass *Felines* which in turn has a
|
||||
subclass *HouseCat*. Maybe there are a bunch of other animal types too, like horses and dogs. Using
|
||||
`inherits_from` will allow you to check for all animals in one go:
|
||||
|
|
@ -274,17 +274,17 @@ need to send byte-data over the wire, `to_str` is the only one you'll need.
|
|||
The difference from Python's in-built `str()` and `bytes()` operators are that
|
||||
the Evennia ones makes use of the `ENCODINGS` setting and will try very hard to
|
||||
never raise a traceback but instead echo errors through logging. See
|
||||
[here](../Concepts/Text-Encodings) for more info.
|
||||
[here](../Concepts/Text-Encodings.md) for more info.
|
||||
|
||||
### Ansi Coloring Tools
|
||||
- [evennia.ansi](api:evennia.utils.ansi)
|
||||
- [evennia.utils.ansi](evennia.utils.ansi)
|
||||
|
||||
## Display utilities
|
||||
### Making ascii tables
|
||||
|
||||
The [EvTable](github:evennia.utils.evtable#evtable) class (`evennia/utils/evtable.py`) can be used
|
||||
The [EvTable](evennia.utils.evtable.EvTable) class (`evennia/utils/evtable.py`) can be used
|
||||
to create correctly formatted text tables. There is also
|
||||
[EvForm](github:evennia.utils.evform#evform) (`evennia/utils/evform.py`). This reads a fixed-format
|
||||
[EvForm](evennia.utils.evform.EvForm) (`evennia/utils/evform.py`). This reads a fixed-format
|
||||
text template from a file in order to create any level of sophisticated ascii layout. Both evtable
|
||||
and evform have lots of options and inputs so see the header of each module for help.
|
||||
|
||||
|
|
@ -294,4 +294,4 @@ ANSI colour. PrettyTable can be found in `evennia/utils/prettytable/`. See its
|
|||
instructions.
|
||||
|
||||
### Menus
|
||||
- [evennia.EvMenu](github:evennia.utils.evmenu#evmenu)
|
||||
- [evennia.EvMenu](evennia.utils.evmenu.EvMenu)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Command Sets
|
||||
|
||||
|
||||
Command Sets are intimately linked with [Commands](./Commands) and you should be familiar with
|
||||
Command Sets are intimately linked with [Commands](./Commands.md) and you should be familiar with
|
||||
Commands before reading this page. The two pages were split for ease of reading.
|
||||
|
||||
A *Command Set* (often referred to as a CmdSet or cmdset) is the basic unit for storing one or more
|
||||
|
|
@ -11,7 +11,7 @@ classes in a command set is the way to make commands available to use in your ga
|
|||
When storing a CmdSet on an object, you will make the commands in that command set available to the
|
||||
object. An example is the default command set stored on new Characters. This command set contains
|
||||
all the useful commands, from `look` and `inventory` to `@dig` and `@reload`
|
||||
([permissions](./Locks#Permissions) then limit which players may use them, but that's a separate
|
||||
([permissions](./Permissions.md) then limit which players may use them, but that's a separate
|
||||
topic).
|
||||
|
||||
When an account enters a command, cmdsets from the Account, Character, its location, and elsewhere
|
||||
|
|
@ -26,7 +26,7 @@ on. The tutorial world included with Evennia showcases a dark room that replaces
|
|||
commands with its own versions because the Character cannot see.
|
||||
|
||||
If you want a quick start into defining your first commands and using them with command sets, you
|
||||
can head over to the [Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands) which steps through things
|
||||
can head over to the [Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands.md) which steps through things
|
||||
without the explanations.
|
||||
|
||||
## Defining Command Sets
|
||||
|
|
@ -112,11 +112,11 @@ back even if all other cmdsets fail or are removed. It is always persistent and
|
|||
by `cmdset.delete()`. To remove a default cmdset you must explicitly call `cmdset.remove_default()`.
|
||||
|
||||
Command sets are often added to an object in its `at_object_creation` method. For more examples of
|
||||
adding commands, read the [Step by step tutorial](../Howto/Starting/Part1/Adding-Commands). Generally you can
|
||||
adding commands, read the [Step by step tutorial](../Howto/Starting/Part1/Adding-Commands.md). Generally you can
|
||||
customize which command sets are added to your objects by using `self.cmdset.add()` or
|
||||
`self.cmdset.add_default()`.
|
||||
|
||||
> Important: Commands are identified uniquely by key *or* alias (see [Commands](./Commands)). If any
|
||||
> Important: Commands are identified uniquely by key *or* alias (see [Commands](./Commands.md)). If any
|
||||
overlap exists, two commands are considered identical. Adding a Command to a command set that
|
||||
already has an identical command will *replace* the previous command. This is very important. You
|
||||
must take this behavior into account when attempting to overload any default Evennia commands with
|
||||
|
|
@ -127,7 +127,7 @@ new one that has a matching alias.
|
|||
|
||||
There are several extra flags that you can set on CmdSets in order to modify how they work. All are
|
||||
optional and will be set to defaults otherwise. Since many of these relate to *merging* cmdsets,
|
||||
you might want to read the [Adding and Merging Command Sets](./Command-Sets#adding-and-merging-
|
||||
you might want to read the [Adding and Merging Command Sets](./Command-Sets.md#adding-and-merging-
|
||||
command-sets) section for some of these to make sense.
|
||||
|
||||
- `key` (string) - an identifier for the cmdset. This is optional, but should be unique. It is used
|
||||
|
|
@ -138,7 +138,7 @@ dictionary below.
|
|||
- `priority` (int) - This defines the merge order of the merge stack - cmdsets will merge in rising
|
||||
order of priority with the highest priority set merging last. During a merger, the commands from the
|
||||
set with the higher priority will have precedence (just what happens depends on the [merge
|
||||
type](Command-Sets#adding-and-merging-command-sets)). If priority is identical, the order in the
|
||||
type](./Command-Sets.md#adding-and-merging-command-sets)). If priority is identical, the order in the
|
||||
merge stack determines preference. The priority value must be greater or equal to `-100`. Most in-
|
||||
game sets should usually have priorities between `0` and `100`. Evennia default sets have priorities
|
||||
as follows (these can be changed if you want a different distribution):
|
||||
|
|
@ -154,7 +154,7 @@ arguments, there is no collision between exits named the same as a channel even
|
|||
differently with certain named cmdsets. If the cmdset to merge with has a `key` matching an entry in
|
||||
`key_mergetype`, it will not be merged according to the setting in `mergetype` but according to the
|
||||
mode in this dict. Please note that this is more complex than it may seem due to the [merge
|
||||
order](Command-Sets#adding-and-merging-command-sets) of command sets. Please review that section
|
||||
order](./Command-Sets.md#adding-and-merging-command-sets) of command sets. Please review that section
|
||||
before using `key_mergetype`.
|
||||
- `duplicates` (bool/None default `None`) - this determines what happens when merging same-priority
|
||||
cmdsets containing same-key commands together. The`dupicate` option will *only* apply when merging
|
||||
|
|
@ -195,15 +195,15 @@ priority determines what is used.
|
|||
|
||||
## Command Sets Searched
|
||||
|
||||
When a user issues a command, it is matched against the [merged](./Command-Sets#adding-and-merging-
|
||||
When a user issues a command, it is matched against the [merged](./Command-Sets.md#adding-and-merging-
|
||||
command-sets) command sets available to the player at the moment. Which those are may change at any
|
||||
time (such as when the player walks into the room with the `Window` object described earlier).
|
||||
|
||||
The currently valid command sets are collected from the following sources:
|
||||
|
||||
- The cmdsets stored on the currently active [Session](./Sessions). Default is the empty
|
||||
- The cmdsets stored on the currently active [Session](./Sessions.md). Default is the empty
|
||||
`SessionCmdSet` with merge priority `-20`.
|
||||
- The cmdsets defined on the [Account](./Accounts). Default is the AccountCmdSet with merge priority
|
||||
- The cmdsets defined on the [Account](./Accounts.md). Default is the AccountCmdSet with merge priority
|
||||
`-10`.
|
||||
- All cmdsets on the Character/Object (assuming the Account is currently puppeting such a
|
||||
Character/Object). Merge priority `0`.
|
||||
|
|
@ -215,14 +215,14 @@ included if `no_objs` option is active in the merge stack.
|
|||
`no_objs` option is active in the merge stack.
|
||||
- The cmdsets of Exits in the location. Merge priority `+101`. Will not be included if `no_exits`
|
||||
*or* `no_objs` option is active in the merge stack.
|
||||
- The [channel](./Communications) cmdset containing commands for posting to all channels the account
|
||||
- The [channel](./Communications.md) cmdset containing commands for posting to all channels the account
|
||||
or character is currently connected to. Merge priority `+101`. Will not be included if `no_channels`
|
||||
option is active in the merge stack.
|
||||
|
||||
Note that an object does not *have* to share its commands with its surroundings. A Character's
|
||||
cmdsets should not be shared for example, or all other Characters would get multi-match errors just
|
||||
by being in the same room. The ability of an object to share its cmdsets is managed by its `call`
|
||||
[lock](./Locks). For example, [Character objects](./Objects) defaults to `call:false()` so that any
|
||||
[lock](./Locks.md). For example, [Character objects](./Objects.md) defaults to `call:false()` so that any
|
||||
cmdsets on them can only be accessed by themselves, not by other objects around them. Another
|
||||
example might be to lock an object with `call:inside()` to only make their commands available to
|
||||
objects inside them, or `cmd:holds()` to make their commands available only if they are held.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Command System
|
||||
|
||||
- [Commands](./Commands)
|
||||
- [Command Sets](./Command-Sets)
|
||||
- [Command Auto-help](./Help-System#command-auto-help-system)
|
||||
- [Commands](./Commands.md)
|
||||
- [Command Sets](./Command-Sets.md)
|
||||
- [Command Auto-help](./Help-System.md#command-auto-help-system)
|
||||
|
||||
See also:
|
||||
- [Default Command Help](api:evennia.commands.default#modules)
|
||||
- [Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands)
|
||||
- [Default Commands](./Default-Commands.md)
|
||||
- [Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands.md)
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
# Commands
|
||||
|
||||
|
||||
Commands are intimately linked to [Command Sets](./Command-Sets) and you need to read that page too to
|
||||
Commands are intimately linked to [Command Sets](./Command-Sets.md) and you need to read that page too to
|
||||
be familiar with how the command system works. The two pages were split for easy reading.
|
||||
|
||||
The basic way for users to communicate with the game is through *Commands*. These can be commands
|
||||
directly related to the game world such as *look*, *get*, *drop* and so on, or administrative
|
||||
commands such as *examine* or *@dig*.
|
||||
|
||||
The [default commands](api:evennia.commands.default#modules) coming with Evennia are 'MUX-like' in that they use @
|
||||
The [default commands](./Default-Commands.md) coming with Evennia are 'MUX-like' in that they use @
|
||||
for admin commands, support things like switches, syntax with the '=' symbol etc, but there is
|
||||
nothing that prevents you from implementing a completely different command scheme for your game. You
|
||||
can find the default commands in `evennia/commands/default`. You should not edit these directly -
|
||||
they will be updated by the Evennia team as new features are added. Rather you should look to them
|
||||
for inspiration and inherit your own designs from them.
|
||||
|
||||
There are two components to having a command running - the *Command* class and the
|
||||
[Command Set](./Command-Sets) (command sets were split into a separate wiki page for ease of reading).
|
||||
There are two components to having a command running - the *Command* class and the
|
||||
[Command Set](./Command-Sets.md) (command sets were split into a separate wiki page for ease of reading).
|
||||
|
||||
1. A *Command* is a python class containing all the functioning code for what a command does - for
|
||||
example, a *get* command would contain code for picking up objects.
|
||||
|
|
@ -28,8 +28,8 @@ object in various ways. Consider a "Tree" object with a cmdset defining the comm
|
|||
*chop down*. Or a "Clock" with a cmdset containing the single command *check time*.
|
||||
|
||||
This page goes into full detail about how to use Commands. To fully use them you must also read the
|
||||
page detailing [Command Sets](./Command-Sets). There is also a step-by-step
|
||||
[Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands) that will get you started quickly without the
|
||||
page detailing [Command Sets](./Command-Sets.md). There is also a step-by-step
|
||||
[Adding Command Tutorial](../Howto/Starting/Part1/Adding-Commands.md) that will get you started quickly without the
|
||||
extra explanations.
|
||||
|
||||
## Defining Commands
|
||||
|
|
@ -81,15 +81,15 @@ In Evennia there are three types of objects that may call the command. It is im
|
|||
of this since this will also assign appropriate `caller`, `session`, `sessid` and `account`
|
||||
properties on the command body at runtime. Most often the calling type is `Session`.
|
||||
|
||||
* A [Session](./Sessions). This is by far the most common case when a user is entering a command in
|
||||
* A [Session](./Sessions.md). This is by far the most common case when a user is entering a command in
|
||||
their client.
|
||||
* `caller` - this is set to the puppeted [Object](./Objects) if such an object exists. If no
|
||||
* `caller` - this is set to the puppeted [Object](./Objects.md) if such an object exists. If no
|
||||
puppet is found, `caller` is set equal to `account`. Only if an Account is not found either (such as
|
||||
before being logged in) will this be set to the Session object itself.
|
||||
* `session` - a reference to the [Session](./Sessions) object itself.
|
||||
* `session` - a reference to the [Session](./Sessions.md) object itself.
|
||||
* `sessid` - `sessid.id`, a unique integer identifier of the session.
|
||||
* `account` - the [Account](./Accounts) object connected to this Session. None if not logged in.
|
||||
* An [Account](./Accounts). This only happens if `account.execute_cmd()` was used. No Session
|
||||
* `account` - the [Account](./Accounts.md) object connected to this Session. None if not logged in.
|
||||
* An [Account](./Accounts.md). This only happens if `account.execute_cmd()` was used. No Session
|
||||
information can be obtained in this case.
|
||||
* `caller` - this is set to the puppeted Object if such an object can be determined (without
|
||||
Session info this can only be determined in `MULTISESSION_MODE=0` or `1`). If no puppet is found,
|
||||
|
|
@ -97,7 +97,7 @@ this is equal to `account`.
|
|||
* `session` - `None*`
|
||||
* `sessid` - `None*`
|
||||
* `account` - Set to the Account object.
|
||||
* An [Object](./Objects). This only happens if `object.execute_cmd()` was used (for example by an
|
||||
* An [Object](./Objects.md). This only happens if `object.execute_cmd()` was used (for example by an
|
||||
NPC).
|
||||
* `caller` - This is set to the calling Object in question.
|
||||
* `session` - `None*`
|
||||
|
|
@ -120,10 +120,10 @@ it the following properties:
|
|||
- `caller` - The character BigGuy, in this example. This is a reference to the object executing the
|
||||
command. The value of this depends on what type of object is calling the command; see the previous
|
||||
section.
|
||||
- `session` - the [Session](./Sessions) Bob uses to connect to the game and control BigGuy (see also
|
||||
- `session` - the [Session](./Sessions.md) Bob uses to connect to the game and control BigGuy (see also
|
||||
previous section).
|
||||
- `sessid` - the unique id of `self.session`, for quick lookup.
|
||||
- `account` - the [Account](./Accounts) Bob (see previous section).
|
||||
- `account` - the [Account](./Accounts.md) Bob (see previous section).
|
||||
- `cmdstring` - the matched key for the command. This would be *look* in our example.
|
||||
- `args` - this is the rest of the string, except the command name. So if the string entered was
|
||||
*look at sword*, `args` would be " *at sword*". Note the space kept - Evennia would correctly
|
||||
|
|
@ -131,7 +131,7 @@ interpret `lookat sword` too. This is useful for things like `/switches` that sh
|
|||
In the `MuxCommand` class used for default commands, this space is stripped. Also see the
|
||||
`arg_regex` property if you want to enforce a space to make `lookat sword` give a command-not-found
|
||||
error.
|
||||
- `obj` - the game [Object](./Objects) on which this command is defined. This need not be the caller,
|
||||
- `obj` - the game [Object](./Objects.md) on which this command is defined. This need not be the caller,
|
||||
but since `look` is a common (default) command, this is probably defined directly on *BigGuy* - so
|
||||
`obj` will point to BigGuy. Otherwise `obj` could be an Account or any interactive object with
|
||||
commands defined on it, like in the example of the "check time" command defined on a "Clock" object.
|
||||
|
|
@ -143,18 +143,18 @@ for example*).
|
|||
- `raw_string` - this is the raw input coming from the user, without stripping any surrounding
|
||||
whitespace. The only thing that is stripped is the ending newline marker.
|
||||
|
||||
#### Other useful utility methods:
|
||||
#### Other useful utility methods:
|
||||
|
||||
- `.get_help(caller, cmdset)` - Get the help entry for this command. By default the arguments are
|
||||
not
|
||||
used, but they could be used to implement alternate help-display systems.
|
||||
- `.client_width()` - Shortcut for getting the client's screen-width. Note that not all clients will
|
||||
truthfully report this value - that case the `settings.DEFAULT_SCREEN_WIDTH` will be returned.
|
||||
- `.styled_table(*args, **kwargs)` - This returns an [EvTable](api:evennia.utils#module-
|
||||
- `.styled_table(*args, **kwargs)` - This returns an [EvTable](module-
|
||||
evennia.utils.evtable) styled based on the
|
||||
session calling this command. The args/kwargs are the same as for EvTable, except styling defaults
|
||||
are set.
|
||||
- `.styled_header`, `_footer`, `separator` - These will produce styled decorations for
|
||||
- `.styled_header`, `_footer`, `separator` - These will produce styled decorations for
|
||||
display to the user. They are useful for creating listings and forms with colors adjustable per-
|
||||
user.
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ key can consist of more than one word, like "press button" or "pull left lever".
|
|||
either matches. This is important for merging cmdsets described below.
|
||||
- `aliases` (optional list) - a list of alternate names for the command (`["glance", "see", "l"]`).
|
||||
Same name rules as for `key` applies.
|
||||
- `locks` (string) - a [lock definition](./Locks), usually on the form `cmd:<lockfuncs>`. Locks is a
|
||||
- `locks` (string) - a [lock definition](./Locks.md), usually on the form `cmd:<lockfuncs>`. Locks is a
|
||||
rather big topic, so until you learn more about locks, stick to giving the lockstring `"cmd:all()"`
|
||||
to make the command available to everyone (if you don't provide a lock string, this will be assigned
|
||||
for you).
|
||||
|
|
@ -181,9 +181,9 @@ by the next command by retrieving `self.caller.ndb.last_cmd`. The next run comma
|
|||
or replace the storage.
|
||||
- `arg_regex` (optional raw string): Used to force the parser to limit itself and tell it when the
|
||||
command-name ends and arguments begin (such as requiring this to be a space or a /switch). This is
|
||||
done with a regular expression. [See the arg_regex section](./Commands#on-arg_regex) for the details.
|
||||
- `auto_help` (optional boolean). Defaults to `True`. This allows for turning off the
|
||||
[auto-help system](./Help-System#command-auto-help-system) on a per-command basis. This could be useful if you
|
||||
done with a regular expression. [See the arg_regex section](./Commands.md#on-arg_regex) for the details.
|
||||
- `auto_help` (optional boolean). Defaults to `True`. This allows for turning off the
|
||||
[auto-help system](./Help-System.md#command-auto-help-system) on a per-command basis. This could be useful if you
|
||||
either want to write your help entries manually or hide the existence of a command from `help`'s
|
||||
generated list.
|
||||
- `is_exit` (bool) - this marks the command as being used for an in-game exit. This is, by default,
|
||||
|
|
@ -219,7 +219,7 @@ from this method will be returned from the execution as a Twisted Deferred.
|
|||
|
||||
Finally, you should always make an informative [doc
|
||||
string](https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring) (`__doc__`) at the top of
|
||||
your class. This string is dynamically read by the [Help System](./Help-System) to create the help
|
||||
your class. This string is dynamically read by the [Help System](./Help-System.md) to create the help
|
||||
entry for this command. You should decide on a way to format your help and stick to that.
|
||||
|
||||
Below is how you define a simple alternative "`smile`" command:
|
||||
|
|
@ -260,8 +260,8 @@ class CmdSmile(Command):
|
|||
string = f"{caller.key} smiles"
|
||||
else:
|
||||
target = caller.search(self.target)
|
||||
if not target:
|
||||
return
|
||||
if not target:
|
||||
return
|
||||
string = f"{caller.key} smiles at {target.key}"
|
||||
|
||||
caller.location.msg_contents(string)
|
||||
|
|
@ -277,7 +277,7 @@ default commands thus need to implement `parse()` at all, but can assume the
|
|||
incoming string is already split up and parsed in suitable ways by its parent.
|
||||
|
||||
Before you can actually use the command in your game, you must now store it
|
||||
within a *command set*. See the [Command Sets](./Command-Sets) page.
|
||||
within a *command set*. See the [Command Sets](./Command-Sets.md) page.
|
||||
|
||||
### On arg_regex
|
||||
|
||||
|
|
@ -428,7 +428,7 @@ will show.
|
|||
|
||||
> Note again that the `yield` keyword does not store state. If the game reloads while waiting for
|
||||
the user to answer, the user will have to start over. It is not a good idea to use `yield` for
|
||||
important or complex choices, a persistent [EvMenu](./EvMenu) might be more appropriate in this case.
|
||||
important or complex choices, a persistent [EvMenu](./EvMenu.md) might be more appropriate in this case.
|
||||
|
||||
## System commands
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ display the "Huh?" error message.
|
|||
matches.
|
||||
- User is not allowed to execute the command (`syscmdkeys.CMD_NOPERM`) - Default is to display the
|
||||
"Huh?" error message.
|
||||
- Channel (`syscmdkeys.CMD_CHANNEL`) - This is a [Channel](./Communications) name of a channel you are
|
||||
- Channel (`syscmdkeys.CMD_CHANNEL`) - This is a [Channel](./Communications.md) name of a channel you are
|
||||
subscribing to - Default is to relay the command's argument to that channel. Such commands are
|
||||
created by the Comm system on the fly depending on your subscriptions.
|
||||
- New session connection (`syscmdkeys.CMD_LOGINSTART`). This command name should be put in the
|
||||
|
|
@ -485,7 +485,7 @@ work.
|
|||
|
||||
Normally Commands are created as fixed classes and used without modification. There are however
|
||||
situations when the exact key, alias or other properties is not possible (or impractical) to pre-
|
||||
code ([Exits](./Commands#Exits) is an example of this).
|
||||
code ([Exits](./Commands.md#exits) is an example of this).
|
||||
|
||||
To create a command with a dynamic call signature, first define the command body normally in a class
|
||||
(set your `key`, `aliases` to default values), then use the following call (assuming the command
|
||||
|
|
@ -509,10 +509,10 @@ make your command completely customized at run-time.
|
|||
|
||||
*Note: This is an advanced topic.*
|
||||
|
||||
Exits are examples of the use of a [Dynamic Command](./Commands#Dynamic_Commands).
|
||||
Exits are examples of the use of a [Dynamic Command](./Commands.md#dynamic-commands).
|
||||
|
||||
The functionality of [Exit](./Objects) objects in Evennia is not hard-coded in the engine. Instead
|
||||
Exits are normal [typeclassed](./Typeclasses) objects that auto-create a [CmdSet](./Commands#CmdSets) on
|
||||
The functionality of [Exit](./Objects.md) objects in Evennia is not hard-coded in the engine. Instead
|
||||
Exits are normal [typeclassed](./Typeclasses.md) objects that auto-create a [CmdSet](./Command-Sets.md) on
|
||||
themselves when they load. This cmdset has a single dynamically created Command with the same
|
||||
properties (key, aliases and locks) as the Exit object itself. When entering the name of the exit,
|
||||
this dynamic exit-command is triggered and (after access checks) moves the Character to the exit's
|
||||
|
|
@ -610,9 +610,9 @@ cmdset, ignore.
|
|||
- CmdSets defined on the current account, if caller is a puppeted object.
|
||||
- CmdSets defined on the Session itself.
|
||||
- The active CmdSets of eventual objects in the same location (if any). This includes commands
|
||||
on [Exits](./Objects#Exits).
|
||||
on [Exits](./Objects.md#exits).
|
||||
- Sets of dynamically created *System commands* representing available
|
||||
[Communications](./Communications#Channels).
|
||||
[Communications](./Channels.md)
|
||||
7. All CmdSets *of the same priority* are merged together in groups. Grouping avoids order-
|
||||
dependent issues of merging multiple same-prio sets onto lower ones.
|
||||
8. All the grouped CmdSets are *merged* in reverse priority into one combined CmdSet according to
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
TODO: Remove this page?
|
||||
|
||||
- [Channels](./Channels) - are used for implementing in-game chat rooms.
|
||||
- [Msg](./Msg)-objects are used for storing messages in the database (email-like)
|
||||
- [Channels](./Channels.md) - are used for implementing in-game chat rooms.
|
||||
- [Msg](./Msg.md)-objects are used for storing messages in the database (email-like)
|
||||
and is a building block for implementing other game systems. It's used by the
|
||||
`page` command by default.
|
||||
|
|
|
|||
|
|
@ -1,54 +1,54 @@
|
|||
# Core Components
|
||||
|
||||
These are the 'building blocks' out of which Evennia is built. This documentation is complementary to, and often goes deeper
|
||||
than, the doc-strings of each component in the [API](../Evennia-API).
|
||||
than, the doc-strings of each component in the [API](../Evennia-API.md).
|
||||
|
||||
## Database entites
|
||||
## Database entites
|
||||
|
||||
- [Typeclasses](./Typeclasses)
|
||||
- [Sessions](./Sessions)
|
||||
- [Acccounts](./Accounts)
|
||||
- [Guests](../Concepts/Guest-Logins)
|
||||
- [Objects](./Objects)
|
||||
- [Scripts](./Scripts)
|
||||
- [Channels and Messages](./Communications)
|
||||
- [Attributes](./Attributes)
|
||||
- [Nicks](./Nicks)
|
||||
- [Tags](./Tags)
|
||||
- [Spawner and prototypes](./Prototypes)
|
||||
- [Help entries](./Help-System)
|
||||
- [Typeclasses](./Typeclasses.md)
|
||||
- [Sessions](./Sessions.md)
|
||||
- [Acccounts](./Accounts.md)
|
||||
- [Guests](../Concepts/Guest-Logins.md)
|
||||
- [Objects](./Objects.md)
|
||||
- [Scripts](./Scripts.md)
|
||||
- [Channels and Messages](./Communications.md)
|
||||
- [Attributes](./Attributes.md)
|
||||
- [Nicks](./Nicks.md)
|
||||
- [Tags](./Tags.md)
|
||||
- [Spawner and prototypes](./Prototypes.md)
|
||||
- [Help entries](./Help-System.md)
|
||||
|
||||
## Commands
|
||||
## Commands
|
||||
|
||||
- [Command system](./Command-System)
|
||||
- [Commands](./Commands)
|
||||
- [Command-Sets](./Command-Sets)
|
||||
- [The Connection Screen](./Connection-Screen)
|
||||
- [Available default Commands](api:evennia.commands.default#modules)
|
||||
- [Batch-Processors](./Batch-Processors)
|
||||
- [Batch-Code-Processor](./Batch-Code-Processor)
|
||||
- [Batch-Command-Processor](./Batch-Command-Processor)
|
||||
- [Available Default Commands](./Default-Commands.md)
|
||||
- [Command system](./Command-System.md)
|
||||
- [Commands](./Commands.md)
|
||||
- [Command-Sets](./Command-Sets.md)
|
||||
- [The Connection Screen](./Connection-Screen.md)
|
||||
- [Batch-Processors](./Batch-Processors.md)
|
||||
- [Batch-Code-Processor](./Batch-Code-Processor.md)
|
||||
- [Batch-Command-Processor](./Batch-Command-Processor.md)
|
||||
|
||||
## Utils and tools
|
||||
|
||||
- [Misc Utils](./Coding-Utils)
|
||||
- [EvEditor](./EvEditor)
|
||||
- [EvMenu](./EvMenu)
|
||||
- [EvMore](./EvMore)
|
||||
- [MonitorHandler](./MonitorHandler)
|
||||
- [TickerHandler](./TickerHandler)
|
||||
- [Lock system](./Locks)
|
||||
- [FuncParser](./FuncParser)
|
||||
- [Misc Utils](./Coding-Utils.md)
|
||||
- [EvEditor](./EvEditor.md)
|
||||
- [EvMenu](./EvMenu.md)
|
||||
- [EvMore](./EvMore.md)
|
||||
- [MonitorHandler](./MonitorHandler.md)
|
||||
- [TickerHandler](./TickerHandler.md)
|
||||
- [Lock system](./Locks.md)
|
||||
- [FuncParser](./FuncParser.md)
|
||||
|
||||
## Server and network
|
||||
|
||||
- [Portal](./Portal-And-Server)
|
||||
- [Inputfuncs](./Inputfuncs)
|
||||
- [Outputfuncs](./Outputfuncs)
|
||||
- [Protocols](../Concepts/Custom-Protocols)
|
||||
- [Server](./Server)
|
||||
- [Server conf object](./Server-Conf)
|
||||
- [Webserver](./Webserver)
|
||||
- [Webclient](./Webclient)
|
||||
- [Bootstrap](./Bootstrap-Components-and-Utilities)
|
||||
- [Signals](./Signals)
|
||||
- [Portal](./Portal-And-Server.md)
|
||||
- [Inputfuncs](./Inputfuncs.md)
|
||||
- [Outputfuncs](./Outputfuncs.md)
|
||||
- [Protocols](../Concepts/Custom-Protocols.md)
|
||||
- [Server](./Server.md)
|
||||
- [Server conf object](../Setup/Server-Conf.md)
|
||||
- [Webserver](./Webserver.md)
|
||||
- [Webclient](./Webclient.md)
|
||||
- [Bootstrap](./Bootstrap-Components-and-Utilities.md)
|
||||
- [Signals](./Signals.md)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
# Connection Screen
|
||||
|
||||
|
||||
When you first connect to your game you are greeted by Evennia's default connection screen.
|
||||
When you first connect to your game you are greeted by Evennia's default connection screen.
|
||||
|
||||
|
||||
|
||||
==============================================================
|
||||
Welcome to Evennia, version Beta-ra4d24e8a3cab+!
|
||||
|
||||
|
||||
If you have an existing account, connect to it by typing:
|
||||
connect <username> <password>
|
||||
If you need to create an account, type (without the <>'s):
|
||||
create <username> <password>
|
||||
|
||||
|
||||
If you have spaces in your username, enclose it in quotes.
|
||||
Enter help for more info. look will re-show this screen.
|
||||
==============================================================
|
||||
|
|
@ -20,17 +20,17 @@ Effective, but not very exciting. You will most likely want to change this to be
|
|||
your game. This is simple:
|
||||
|
||||
1. Edit `mygame/server/conf/connection_screens.py`.
|
||||
1. [Reload](../Setup/Start-Stop-Reload) Evennia.
|
||||
1. [Reload](../Setup/Start-Stop-Reload.md) Evennia.
|
||||
|
||||
Evennia will look into this module and locate all *globally defined strings* in it. These strings
|
||||
are used as the text in your connection screen and are shown to the user at startup. If more than
|
||||
one such string/screen is defined in the module, a *random* screen will be picked from among those
|
||||
available.
|
||||
|
||||
### Commands available at the Connection Screen
|
||||
## Commands available at the Connection Screen
|
||||
|
||||
You can also customize the [Commands](./Commands) available to use while the connection screen is
|
||||
You can also customize the [Commands](./Commands.md) available to use while the connection screen is
|
||||
shown (`connect`, `create` etc). These commands are a bit special since when the screen is running
|
||||
the account is not yet logged in. A command is made available at the login screen by adding them to
|
||||
`UnloggedinCmdSet` in `mygame/commands/default_cmdset.py`. See [Commands](./Commands) and the
|
||||
tutorial section on how to add new commands to a default command set.
|
||||
`UnloggedinCmdSet` in `mygame/commands/default_cmdset.py`. See [Commands](./Commands.md) and the
|
||||
tutorial section on how to add new commands to a default command set.
|
||||
|
|
|
|||
106
docs/1.0-dev/_sources/Components/Default-Commands.md.txt
Normal file
106
docs/1.0-dev/_sources/Components/Default-Commands.md.txt
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
|
||||
# Default Commands
|
||||
|
||||
The full set of default Evennia commands currently contains 97 commands in 9 source
|
||||
files. Our policy for adding default commands is outlined [here](../Concepts/Using-MUX-as-a-Standard.md). The
|
||||
[Commands](./Commands.md) documentation explains how Commands work as well as make new or customize
|
||||
existing ones. Note that this page is auto-generated. Report problems to the [issue
|
||||
tracker](github:issues).
|
||||
|
||||
```{note}
|
||||
Some game-states adds their own Commands which are not listed here. Examples include editing a text
|
||||
with [EvEditor](./EvEditor.md), flipping pages in [EvMore](./EvMore.md) or using the
|
||||
[Batch-Processor](./Batch-Processors.md)'s interactive mode.
|
||||
```
|
||||
|
||||
- [**__unloggedin_look_command** [l, look]](evennia.commands.default.unloggedin.CmdUnconnectedLook) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**about** [version]](evennia.commands.default.system.CmdAbout) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**access** [groups, hierarchy]](evennia.commands.default.general.CmdAccess) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**accounts** [listaccounts, account]](evennia.commands.default.system.CmdAccounts) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**addcom** [chanalias, aliaschan]](evennia.commands.default.comms.CmdAddCom) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**alias** [setobjalias]](evennia.commands.default.building.CmdSetObjAlias) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**allcom**](evennia.commands.default.comms.CmdAllCom) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**batchcode** [batchcodes]](evennia.commands.default.batchprocess.CmdBatchCode) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**batchcommands** [batchcmd, batchcommand]](evennia.commands.default.batchprocess.CmdBatchCommands) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**cboot**](evennia.commands.default.comms.CmdCBoot) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**ccreate** [channelcreate]](evennia.commands.default.comms.CmdChannelCreate) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**cdesc**](evennia.commands.default.comms.CmdCdesc) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**cdestroy**](evennia.commands.default.comms.CmdCdestroy) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**channel** [chan, channels]](evennia.commands.default.comms.CmdChannel) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**charcreate**](evennia.commands.default.account.CmdCharCreate) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**chardelete**](evennia.commands.default.account.CmdCharDelete) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**clock**](evennia.commands.default.comms.CmdClock) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**cmdsets** [listcmsets]](evennia.commands.default.building.CmdListCmdSets) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**color**](evennia.commands.default.account.CmdColorTest) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**connect** [conn, co, con]](evennia.commands.default.unloggedin.CmdUnconnectedConnect) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**copy**](evennia.commands.default.building.CmdCopy) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**cpattr**](evennia.commands.default.building.CmdCpAttr) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**create**](evennia.commands.default.building.CmdCreate) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**create** [cr, cre]](evennia.commands.default.unloggedin.CmdUnconnectedCreate) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**cwho**](evennia.commands.default.comms.CmdCWho) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**delcom** [delchanalias, delaliaschan]](evennia.commands.default.comms.CmdDelCom) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**desc** [describe]](evennia.commands.default.building.CmdDesc) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**destroy** [del, delete]](evennia.commands.default.building.CmdDestroy) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**dig**](evennia.commands.default.building.CmdDig) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**drop**](evennia.commands.default.general.CmdDrop) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**encoding** [encode]](evennia.commands.default.unloggedin.CmdUnconnectedEncoding) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**examine** [ex, exam]](evennia.commands.default.building.CmdExamine) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Building_)
|
||||
- [**find** [locate, search]](evennia.commands.default.building.CmdFind) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**get** [grab]](evennia.commands.default.general.CmdGet) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**give**](evennia.commands.default.general.CmdGive) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**grapevine2chan**](evennia.commands.default.comms.CmdGrapevine2Chan) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**help** [?]](evennia.commands.default.help.CmdHelp) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**help** [h, ?]](evennia.commands.default.unloggedin.CmdUnconnectedHelp) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**home**](evennia.commands.default.general.CmdHome) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**ic** [puppet]](evennia.commands.default.account.CmdIC) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**info**](evennia.commands.default.unloggedin.CmdUnconnectedInfo) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**inventory** [i, inv]](evennia.commands.default.general.CmdInventory) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**irc2chan**](evennia.commands.default.comms.CmdIRC2Chan) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**ircstatus**](evennia.commands.default.comms.CmdIRCStatus) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**link**](evennia.commands.default.building.CmdLink) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**lock** [locks]](evennia.commands.default.building.CmdLock) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**look** [ls, l]](evennia.commands.default.account.CmdOOCLook) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**look** [ls, l]](evennia.commands.default.general.CmdLook) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**mvattr**](evennia.commands.default.building.CmdMvAttr) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**name** [rename]](evennia.commands.default.building.CmdName) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**nick** [nickname, nicks]](evennia.commands.default.general.CmdNick) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**objects** [listobjs, listobjects, db, stats]](evennia.commands.default.building.CmdObjects) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**ooc** [unpuppet]](evennia.commands.default.account.CmdOOC) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**open**](evennia.commands.default.building.CmdOpen) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**option** [options]](evennia.commands.default.account.CmdOption) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**page** [tell]](evennia.commands.default.comms.CmdPage) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**password**](evennia.commands.default.account.CmdPassword) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**pose** [:, emote]](evennia.commands.default.general.CmdPose) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**py** [!]](evennia.commands.default.system.CmdPy) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _System_)
|
||||
- [**quell** [unquell]](evennia.commands.default.account.CmdQuell) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**quit**](evennia.commands.default.account.CmdQuit) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**quit** [qu, q]](evennia.commands.default.unloggedin.CmdUnconnectedQuit) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**reload** [restart]](evennia.commands.default.system.CmdReload) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _System_)
|
||||
- [**reset** [reboot]](evennia.commands.default.system.CmdReset) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _System_)
|
||||
- [**rss2chan**](evennia.commands.default.comms.CmdRSS2Chan) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _Comms_)
|
||||
- [**say** [", ']](evennia.commands.default.general.CmdSay) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**screenreader**](evennia.commands.default.unloggedin.CmdUnconnectedScreenreader) (cmdset: [UnloggedinCmdSet](evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet), help-category: _General_)
|
||||
- [**scripts** [script]](evennia.commands.default.building.CmdScripts) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**server** [serverload, serverprocess]](evennia.commands.default.system.CmdServerLoad) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**service** [services]](evennia.commands.default.system.CmdService) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**sessions**](evennia.commands.default.account.CmdSessions) (cmdset: [SessionCmdSet](evennia.commands.default.cmdset_session.SessionCmdSet), help-category: _General_)
|
||||
- [**set**](evennia.commands.default.building.CmdSetAttribute) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**setdesc**](evennia.commands.default.general.CmdSetDesc) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**sethelp**](evennia.commands.default.help.CmdSetHelp) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**sethome**](evennia.commands.default.building.CmdSetHome) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**shutdown**](evennia.commands.default.system.CmdShutdown) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _System_)
|
||||
- [**spawn** [olc]](evennia.commands.default.building.CmdSpawn) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**style**](evennia.commands.default.account.CmdStyle) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**tag** [tags]](evennia.commands.default.building.CmdTag) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**tasks** [task, delays]](evennia.commands.default.system.CmdTasks) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**tel** [teleport]](evennia.commands.default.building.CmdTeleport) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**tickers**](evennia.commands.default.system.CmdTickers) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**time** [uptime]](evennia.commands.default.system.CmdTime) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _System_)
|
||||
- [**tunnel** [tun]](evennia.commands.default.building.CmdTunnel) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**typeclass** [swap, type, update, typeclasses, parent]](evennia.commands.default.building.CmdTypeclass) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**unlink**](evennia.commands.default.building.CmdUnLink) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
- [**whisper**](evennia.commands.default.general.CmdWhisper) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _General_)
|
||||
- [**who** [doing]](evennia.commands.default.account.CmdWho) (cmdset: [AccountCmdSet](evennia.commands.default.cmdset_account.AccountCmdSet), help-category: _General_)
|
||||
- [**wipe**](evennia.commands.default.building.CmdWipe) (cmdset: [CharacterCmdSet](evennia.commands.default.cmdset_character.CharacterCmdSet), help-category: _Building_)
|
||||
|
||||
|
|
@ -5,15 +5,15 @@ Evennia offers a powerful in-game line editor in `evennia.utils.eveditor.EvEdito
|
|||
mimicking the well-known VI line editor. It offers line-by-line editing, undo/redo, line deletes,
|
||||
search/replace, fill, dedent and more.
|
||||
|
||||
### Launching the editor
|
||||
## Launching the editor
|
||||
|
||||
The editor is created as follows:
|
||||
The editor is created as follows:
|
||||
|
||||
```python
|
||||
from evennia.utils.eveditor import EvEditor
|
||||
|
||||
EvEditor(caller,
|
||||
loadfunc=None, savefunc=None, quitfunc=None,
|
||||
EvEditor(caller,
|
||||
loadfunc=None, savefunc=None, quitfunc=None,
|
||||
key="")
|
||||
```
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ cleanup and exit messages to the user must be handled by this function.
|
|||
It has no other mechanical function.
|
||||
- `persistent` (default `False`): if set to `True`, the editor will survive a reboot.
|
||||
|
||||
### Example of usage
|
||||
## Example of usage
|
||||
|
||||
This is an example command for setting a specific Attribute using the editor.
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ from evennia.utils import eveditor
|
|||
|
||||
class CmdSetTestAttr(Command):
|
||||
"""
|
||||
Set the "test" Attribute using
|
||||
Set the "test" Attribute using
|
||||
the line editor.
|
||||
|
||||
Usage:
|
||||
|
|
@ -60,12 +60,12 @@ class CmdSetTestAttr(Command):
|
|||
caller.msg("Editor exited")
|
||||
key = f"{self.caller}/test"
|
||||
# launch the editor
|
||||
eveditor.EvEditor(self.caller,
|
||||
loadfunc=load, savefunc=save, quitfunc=quit,
|
||||
key=key)
|
||||
eveditor.EvEditor(self.caller,
|
||||
loadfunc=load, savefunc=save, quitfunc=quit,
|
||||
key=key)
|
||||
```
|
||||
|
||||
### Persistent editor
|
||||
## Persistent editor
|
||||
|
||||
If you set the `persistent` keyword to `True` when creating the editor, it will remain open even
|
||||
when reloading the game. In order to be persistent, an editor needs to have its callback functions
|
||||
|
|
@ -90,7 +90,7 @@ def quit(caller):
|
|||
|
||||
class CmdSetTestAttr(Command):
|
||||
"""
|
||||
Set the "test" Attribute using
|
||||
Set the "test" Attribute using
|
||||
the line editor.
|
||||
|
||||
Usage:
|
||||
|
|
@ -102,12 +102,12 @@ class CmdSetTestAttr(Command):
|
|||
"Set up the callbacks and launch the editor"
|
||||
key = f"{self.caller}/test"
|
||||
# launch the editor
|
||||
eveditor.EvEditor(self.caller,
|
||||
loadfunc=load, savefunc=save, quitfunc=quit,
|
||||
key=key, persistent=True)
|
||||
eveditor.EvEditor(self.caller,
|
||||
loadfunc=load, savefunc=save, quitfunc=quit,
|
||||
key=key, persistent=True)
|
||||
```
|
||||
|
||||
### Line editor usage
|
||||
## Line editor usage
|
||||
|
||||
The editor mimics the `VIM` editor as best as possible. The below is an excerpt of the return from
|
||||
the in-editor help command (`:h`).
|
||||
|
|
@ -154,7 +154,7 @@ the in-editor help command (`:h`).
|
|||
<txt> - longer string, usually not needed to be enclosed in quotes.
|
||||
```
|
||||
|
||||
### The EvEditor to edit code
|
||||
## The EvEditor to edit code
|
||||
|
||||
The `EvEditor` is also used to edit some Python code in Evennia. The `@py` command supports an
|
||||
`/edit` switch that will open the EvEditor in code mode. This mode isn't significantly different
|
||||
|
|
@ -178,4 +178,4 @@ to paste several lines of code that are already correctly indented, for instance
|
|||
To see the EvEditor in code mode, you can use the `@py/edit` command. Type in your code (on one or
|
||||
several lines). You can then use the `:w` option (save without quitting) and the code you have
|
||||
typed will be executed. The `:!` will do the same thing. Executing code while not closing the
|
||||
editor can be useful if you want to test the code you have typed but add new lines after your test.
|
||||
editor can be useful if you want to test the code you have typed but add new lines after your test.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ said functions, like `{"nodename": <function>, ...}`
|
|||
## Launching the menu
|
||||
|
||||
Initializing the menu is done using a call to the `evennia.utils.evmenu.EvMenu` class. This is the
|
||||
most common way to do so - from inside a [Command](./Commands):
|
||||
most common way to do so - from inside a [Command](./Commands.md):
|
||||
|
||||
```python
|
||||
# in, for example gamedir/commands/command.py
|
||||
|
|
@ -70,7 +70,7 @@ EvMenu(caller, menu_data,
|
|||
```
|
||||
|
||||
- `caller` (Object or Account): is a reference to the object using the menu. This object will get a
|
||||
new [CmdSet](./Command-Sets) assigned to it, for handling the menu.
|
||||
new [CmdSet](./Command-Sets.md) assigned to it, for handling the menu.
|
||||
- `menu_data` (str, module or dict): is a module or python path to a module where the global-level
|
||||
functions will each be considered to be a menu node. Their names in the module will be the names
|
||||
by which they are referred to in the module. Importantly, function names starting with an
|
||||
|
|
@ -107,7 +107,7 @@ after
|
|||
- `startnode_input` (str or (str, dict) tuple): Pass an input text or a input text + kwargs to the
|
||||
start node as if it was entered on a fictional previous node. This can be very useful in order to
|
||||
start a menu differently depending on the Command's arguments in which it was initialized.
|
||||
- `session` (Session): Useful when calling the menu from an [Account](./Accounts) in
|
||||
- `session` (Session): Useful when calling the menu from an [Account](./Accounts.md) in
|
||||
`MULTISESSION_MODDE` higher than 2, to make sure only the right Session sees the menu output.
|
||||
- `debug` (bool): If set, the `menudebug` command will be made available in the menu. Use it to
|
||||
list the current state of the menu and use `menudebug <variable>` to inspect a specific state
|
||||
|
|
@ -428,16 +428,15 @@ See `evennia/utils/evmenu.py` for the details of their default implementations.
|
|||
|
||||
## Examples:
|
||||
|
||||
- **[Simple branching menu](./EvMenu#example-simple-branching-menu)** - choose from options
|
||||
- **[Dynamic goto](./EvMenu#example-dynamic-goto)** - jumping to different nodes based on response
|
||||
- **[Set caller properties](./EvMenu#example-set-caller-properties)** - a menu that changes things
|
||||
- **[Getting arbitrary input](./EvMenu#example-get-arbitrary-input)** - entering text
|
||||
- **[Storing data between nodes](./EvMenu#example-storing-data-between-nodes)** - keeping states and
|
||||
- **[Simple branching menu](./EvMenu.md#example-simple-branching-menu)** - choose from options
|
||||
- **[Dynamic goto](./EvMenu.md#example-dynamic-goto)** - jumping to different nodes based on response
|
||||
- **[Set caller properties](./EvMenu.md#example-set-caller-properties)** - a menu that changes things
|
||||
- **[Getting arbitrary input](./EvMenu.md#example-get-arbitrary-input)** - entering text
|
||||
- **[Storing data between nodes](./EvMenu.md#example-storing-data-between-nodes)** - keeping states and
|
||||
information while in the menu
|
||||
- **[Repeating the same node](./EvMenu#example-repeating-the-same-node)** - validating within the node
|
||||
- **[Repeating the same node](./EvMenu.md#example-repeating-the-same-node)** - validating within the node
|
||||
before moving to the next
|
||||
- **[Full Menu](./EvMenu#example-full-menu):** a complete example
|
||||
- **[Yes/No prompt](./EvMenu#example-yesno-prompt)** - entering text with limited possible responses
|
||||
- **[Yes/No prompt](#example-yesno-prompt)** - entering text with limited possible responses
|
||||
(this is *not* using EvMenu but the conceptually similar yet technically unrelated `get_input`
|
||||
helper function accessed as `evennia.utils.evmenu.get_input`).
|
||||
|
||||
|
|
@ -507,7 +506,7 @@ def enter_guild:
|
|||
|
||||
This simple callable goto will analyse what happens depending on who the `caller` is. The
|
||||
`enter_guild` node will give you a choice of what to say to the guard. If you try to enter, you will
|
||||
end up in different nodes depending on (in this example) if you have the right [Tag](./Tags) set on
|
||||
end up in different nodes depending on (in this example) if you have the right [Tag](./Tags.md) set on
|
||||
yourself or not. Note that since we don't include any 'key's in the option dictionary, you will just
|
||||
get to pick between numbers.
|
||||
|
||||
|
|
@ -805,7 +804,7 @@ function - for example you can't use other Python keywords like `if` inside the
|
|||
|
||||
Unless you are dealing with a relatively simple dynamic menu, defining menus with lambda's is
|
||||
probably more work than it's worth: You can create dynamic menus by instead making each node
|
||||
function more clever. See the [NPC shop tutorial](../Howto/NPC-shop-Tutorial) for an example of this.
|
||||
function more clever. See the [NPC shop tutorial](../Howto/NPC-shop-Tutorial.md) for an example of this.
|
||||
|
||||
|
||||
## Ask for simple input
|
||||
|
|
@ -906,7 +905,7 @@ return True from the callback to repeat the prompt until you pass whatever check
|
|||
|
||||
> Note: You *cannot* link consecutive questions by putting a new `get_input` call inside the
|
||||
> callback If you want that you should use an EvMenu instead (see the [Repeating the same
|
||||
> node](EvMenu#example-repeating-the-same-node) example above). Otherwise you can either peek at the
|
||||
> node](./EvMenu.md#example-repeating-the-same-node) example above). Otherwise you can either peek at the
|
||||
> implementation of `get_input` and implement your own mechanism (it's just using cmdset nesting) or
|
||||
> you can look at [this extension suggested on the mailing
|
||||
> list](https://groups.google.com/forum/#!category-topic/evennia/evennia-questions/16pi0SfMO5U).
|
||||
|
|
@ -993,9 +992,9 @@ auto-created by the `list_node` decorator.
|
|||
|
||||
## Assorted notes
|
||||
|
||||
The EvMenu is implemented using [Commands](./Commands). When you start a new EvMenu, the user of the
|
||||
menu will be assigned a [CmdSet](./Command-Sets) with the commands they need to navigate the menu.
|
||||
The EvMenu is implemented using [Commands](./Commands.md). When you start a new EvMenu, the user of the
|
||||
menu will be assigned a [CmdSet](./Command-Sets.md) with the commands they need to navigate the menu.
|
||||
This means that if you were to, from inside the menu, assign a new command set to the caller, *you
|
||||
may override the Menu Cmdset and kill the menu*. If you want to assign cmdsets to the caller as part
|
||||
of the menu, you should store the cmdset on `caller.ndb._menutree` and wait to actually assign it
|
||||
until the exit node.
|
||||
until the exit node.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ page of text at a time. It is usually used via its access function, `evmore.msg`
|
|||
|
||||
The name comes from the famous unix pager utility *more* which performs just this function.
|
||||
|
||||
### Using EvMore
|
||||
## Using EvMore
|
||||
|
||||
To use the pager, just pass the long text through it:
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ from evennia.utils import evmore
|
|||
|
||||
evmore.msg(receiver, long_text)
|
||||
```
|
||||
Where receiver is an [Object](./Objects) or a [Account](./Accounts). If the text is longer than the
|
||||
Where receiver is an [Object](./Objects.md) or a [Account](./Accounts.md). If the text is longer than the
|
||||
client's screen height (as determined by the NAWS handshake or by `settings.CLIENT_DEFAULT_HEIGHT`)
|
||||
the pager will show up, something like this:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
# The Inline Function Parser
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
The [FuncParser](api:evennia.utils.funcparser#evennia.utils.funcparser.FuncParser) extracts and executes
|
||||
The [FuncParser](evennia.utils.funcparser.FuncParser) extracts and executes
|
||||
'inline functions'
|
||||
embedded in a string on the form `$funcname(args, kwargs)`. Under the hood, this will
|
||||
lead to a call to a Python function you control. The inline function call will be replaced by
|
||||
embedded in a string on the form `$funcname(args, kwargs)`. Under the hood, this will
|
||||
lead to a call to a Python function you control. The inline function call will be replaced by
|
||||
the return from the function.
|
||||
|
||||
```python
|
||||
```python
|
||||
from evennia.utils.funcparser import FuncParser
|
||||
|
||||
def _power_callable(*args, **kwargs):
|
||||
|
|
@ -48,72 +44,72 @@ parser.parse("This is an escaped $$pow(4) and so is this \$pow(3)")
|
|||
The FuncParser can be applied to any string. Out of the box it's applied in a few situations:
|
||||
|
||||
- _Outgoing messages_. All messages sent from the server is processed through FuncParser and every
|
||||
callable is provided the [Session](./Sessions) of the object receiving the message. This potentially
|
||||
callable is provided the [Session](./Sessions.md) of the object receiving the message. This potentially
|
||||
allows a message to be modified on the fly to look different for different recipients.
|
||||
- _Prototype values_. A [Prototype](./Prototypes) dict's values are run through the parser such that every
|
||||
- _Prototype values_. A [Prototype](./Prototypes.md) dict's values are run through the parser such that every
|
||||
callable gets a reference to the rest of the prototype. In the Prototype ORM, this would allow builders
|
||||
to safely call functions to set non-string values to prototype values, get random values, reference
|
||||
other fields of the prototype, and more.
|
||||
- _Actor-stance in messages to others_. In the
|
||||
[Object.msg_contents](api:evennia.objects.objects#DefaultObject.msg_contents) method,
|
||||
[Object.msg_contents](evennia.objects.objects.DefaultObject.msg_contents) method,
|
||||
the outgoing string is parsed for special `$You()` and `$conj()` callables to decide if a given recipient
|
||||
should see "You" or the character's name.
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
The inline-function parser is not intended as a 'softcode' programming language. It does not
|
||||
have things like loops and conditionals, for example. While you could in principle extend it to
|
||||
do very advanced things and allow builders a lot of power, all-out coding is something
|
||||
have things like loops and conditionals, for example. While you could in principle extend it to
|
||||
do very advanced things and allow builders a lot of power, all-out coding is something
|
||||
Evennia expects you to do in a proper text editor, outside of the game, not from inside it.
|
||||
```
|
||||
|
||||
## Using the FuncParser
|
||||
|
||||
You can apply inline function parsing to any string. The
|
||||
[FuncParser](api:evennia.utils.funcparser.FuncParser) is imported as `evennia.utils.funcparser`.
|
||||
## Using the FuncParser
|
||||
|
||||
You can apply inline function parsing to any string. The
|
||||
[FuncParser](evennia.utils.funcparser.FuncParser) is imported as `evennia.utils.funcparser`.
|
||||
|
||||
```python
|
||||
from evennia.utils import funcparser
|
||||
|
||||
parser = FuncParser(callables, **default_kwargs)
|
||||
parsed_string = parser.parser(input_string, raise_errors=False,
|
||||
escape=False, strip=False,
|
||||
parsed_string = parser.parser(input_string, raise_errors=False,
|
||||
escape=False, strip=False,
|
||||
return_str=True, **reserved_kwargs)
|
||||
|
||||
# callables can also be passed as paths to modules
|
||||
parser = FuncParser(["game.myfuncparser_callables", "game.more_funcparser_callables"])
|
||||
```
|
||||
|
||||
Here, `callables` points to a collection of normal Python functions (see next section) for you to make
|
||||
Here, `callables` points to a collection of normal Python functions (see next section) for you to make
|
||||
available to the parser as you parse strings with it. It can either be
|
||||
- A `dict` of `{"functionname": callable, ...}`. This allows you do pick and choose exactly which callables
|
||||
to include and how they should be named. Do you want a callable to be available under more than one name?
|
||||
Just add it multiple times to the dict, with a different key.
|
||||
- A `module` or (more commonly) a `python-path` to a module. This module can define a dict
|
||||
- A `module` or (more commonly) a `python-path` to a module. This module can define a dict
|
||||
`FUNCPARSER_CALLABLES = {"funcname": callable, ...}` - this will be imported and used like the `dict` above.
|
||||
If no such variable is defined, _every_ top-level function in the module (whose name doesn't start with
|
||||
an underscore `_`) will be considered a suitable callable. The name of the function will be the `$funcname`
|
||||
If no such variable is defined, _every_ top-level function in the module (whose name doesn't start with
|
||||
an underscore `_`) will be considered a suitable callable. The name of the function will be the `$funcname`
|
||||
by which it can be called.
|
||||
- A `list` of modules/paths. This allows you to pull in modules from many sources for your parsing.
|
||||
|
||||
|
||||
The other arguments to the parser:
|
||||
|
||||
- `raise_errors` - By default, any errors from a callable will be quietly ignored and the result
|
||||
will be that the failing function call will show verbatim. If `raise_errors` is set,
|
||||
then parsing will stop and whatever exception happened will be raised. It'd be up to you to handle
|
||||
- `raise_errors` - By default, any errors from a callable will be quietly ignored and the result
|
||||
will be that the failing function call will show verbatim. If `raise_errors` is set,
|
||||
then parsing will stop and whatever exception happened will be raised. It'd be up to you to handle
|
||||
this properly.
|
||||
- `escape` - Returns a string where every `$func(...)` has been escaped as `\$func()`.
|
||||
- `strip` - Remove all `$func(...)` calls from string (as if each returned `''`).
|
||||
- `return_str` - When `True` (default), `parser` always returns a string. If `False`, it may return
|
||||
the return value of a single function call in the string. This is the same as using the `.parse_to_any`
|
||||
- `return_str` - When `True` (default), `parser` always returns a string. If `False`, it may return
|
||||
the return value of a single function call in the string. This is the same as using the `.parse_to_any`
|
||||
method.
|
||||
- The `**default/reserved_keywords` are optional and allow you to pass custom data into _every_ function
|
||||
call. This is great for including things like the current session or config options. Defaults can be
|
||||
replaced if the user gives the same-named kwarg in the string's function call. Reserved kwargs are always passed,
|
||||
ignoring defaults or what the user passed. In addition, the `funcparser` and `raise_errors`
|
||||
ignoring defaults or what the user passed. In addition, the `funcparser` and `raise_errors`
|
||||
reserved kwargs are always passed - the first is a back-reference to the `FuncParser` instance and the second
|
||||
is the `raise_errors` boolean passed into `FuncParser.parse`.
|
||||
|
||||
Here's an example of using the default/reserved keywords:
|
||||
|
||||
Here's an example of using the default/reserved keywords:
|
||||
|
||||
```python
|
||||
def _test(*args, **kwargs):
|
||||
|
|
@ -123,15 +119,15 @@ def _test(*args, **kwargs):
|
|||
parser = funcparser.FuncParser({"test": _test}, mydefault=2)
|
||||
result = parser.parse("$test(foo, bar=4)", myreserved=[1, 2, 3])
|
||||
```
|
||||
Here the callable will be called as
|
||||
Here the callable will be called as
|
||||
|
||||
```python
|
||||
_test('foo', bar='4', mydefault=2, myreserved=[1, 2, 3],
|
||||
funcparser=<FuncParser>, raise_errors=False)
|
||||
_test('foo', bar='4', mydefault=2, myreserved=[1, 2, 3],
|
||||
funcparser=<FuncParser>, raise_errors=False)
|
||||
```
|
||||
|
||||
The `mydefault=2` kwarg could be overwritten if we made the call as `$test(mydefault=...)`
|
||||
but `myreserved=[1, 2, 3]` will _always_ be sent as-is and will override a call `$test(myreserved=...)`.
|
||||
The `mydefault=2` kwarg could be overwritten if we made the call as `$test(mydefault=...)`
|
||||
but `myreserved=[1, 2, 3]` will _always_ be sent as-is and will override a call `$test(myreserved=...)`.
|
||||
The `funcparser`/`raise_errors` kwargs are also always included as reserved kwargs.
|
||||
|
||||
## Defining custom callables
|
||||
|
|
@ -144,44 +140,44 @@ def funcname(*args, **kwargs):
|
|||
return something
|
||||
```
|
||||
|
||||
> The `*args` and `**kwargs` must always be included. If you are unsure how `*args` and `**kwargs` work in Python,
|
||||
> The `*args` and `**kwargs` must always be included. If you are unsure how `*args` and `**kwargs` work in Python,
|
||||
> [read about them here](https://www.digitalocean.com/community/tutorials/how-to-use-args-and-kwargs-in-python-3).
|
||||
|
||||
The input from the innermost `$funcname(...)` call in your callable will always be a `str`. Here's
|
||||
The input from the innermost `$funcname(...)` call in your callable will always be a `str`. Here's
|
||||
an example of an `$toint` function; it converts numbers to integers.
|
||||
|
||||
"There's a $toint(22.0)% chance of survival."
|
||||
|
||||
What will enter the `$toint` callable (as `args[0]`) is the _string_ `"22.0"`. The function is responsible
|
||||
for converting this to a number so that we can convert it to an integer. We must also properly handle invalid
|
||||
for converting this to a number so that we can convert it to an integer. We must also properly handle invalid
|
||||
inputs (like non-numbers).
|
||||
|
||||
If you want to mark an error, raise `evennia.utils.funcparser.ParsingError`. This stops the entire parsing
|
||||
of the string and may or may not raise the exception depending on what you set `raise_errors` to when you
|
||||
of the string and may or may not raise the exception depending on what you set `raise_errors` to when you
|
||||
created the parser.
|
||||
|
||||
However, if you _nest_ functions, the return of the innermost function may be something other than
|
||||
a string. Let's introduce the `$eval` function, which evaluates simple expressions using
|
||||
However, if you _nest_ functions, the return of the innermost function may be something other than
|
||||
a string. Let's introduce the `$eval` function, which evaluates simple expressions using
|
||||
Python's `literal_eval` and/or `simple_eval`.
|
||||
|
||||
"There's a $toint($eval(10 * 2.2))% chance of survival."
|
||||
"There's a $toint($eval(10 * 2.2))% chance of survival."
|
||||
|
||||
Since the `$eval` is the innermost call, it will get a string as input - the string `"10 * 2.2"`.
|
||||
It evaluates this and returns the `float` `22.0`. This time the outermost `$toint` will be called with
|
||||
this `float` instead of with a string.
|
||||
Since the `$eval` is the innermost call, it will get a string as input - the string `"10 * 2.2"`.
|
||||
It evaluates this and returns the `float` `22.0`. This time the outermost `$toint` will be called with
|
||||
this `float` instead of with a string.
|
||||
|
||||
> It's important to safely validate your inputs since users may end up nesting your callables in any order.
|
||||
> It's important to safely validate your inputs since users may end up nesting your callables in any order.
|
||||
> See the next section for useful tools to help with this.
|
||||
|
||||
In these examples, the result will be embedded in the larger string, so the result of the entire parsing
|
||||
will be a string:
|
||||
In these examples, the result will be embedded in the larger string, so the result of the entire parsing
|
||||
will be a string:
|
||||
|
||||
```python
|
||||
parser.parse(above_string)
|
||||
"There's a 22% chance of survival."
|
||||
```
|
||||
|
||||
However, if you use the `parse_to_any` (or `parse(..., return_str=True)`) and _don't add any extra string around the outermost function call_,
|
||||
However, if you use the `parse_to_any` (or `parse(..., return_str=True)`) and _don't add any extra string around the outermost function call_,
|
||||
you'll get the return type of the outermost callable back:
|
||||
|
||||
```python
|
||||
|
|
@ -194,13 +190,13 @@ parser.parse_to_any("$toint($eval(10 * 2.2)")
|
|||
### Safe convertion of inputs
|
||||
|
||||
Since you don't know in which order users may use your callables, they should always check the types
|
||||
of its inputs and convert to the type the callable needs. Note also that when converting from strings,
|
||||
there are limits what inputs you can support. This is because FunctionParser strings are often used by
|
||||
non-developer players/builders and some things (such as complex classes/callables etc) are just not
|
||||
of its inputs and convert to the type the callable needs. Note also that when converting from strings,
|
||||
there are limits what inputs you can support. This is because FunctionParser strings are often used by
|
||||
non-developer players/builders and some things (such as complex classes/callables etc) are just not
|
||||
safe/possible to convert from string representation.
|
||||
|
||||
In `evennia.utils.utils` is a helper called
|
||||
[safe_convert_to_types](api:evennia.utils.utils#evennia.utils.utils.safe_convert_to_types). This function
|
||||
In `evennia.utils.utils` is a helper called
|
||||
[safe_convert_to_types](evennia.utils.utils.safe_convert_to_types). This function
|
||||
automates the conversion of simple data types in a safe way:
|
||||
|
||||
```python
|
||||
|
|
@ -208,94 +204,94 @@ from evennia.utils.utils import safe_convert_to_types
|
|||
|
||||
def _process_callable(*args, **kwargs):
|
||||
"""
|
||||
A callable with a lot of custom options
|
||||
|
||||
$process(expression, local, extra=34, extra2=foo)
|
||||
|
||||
A callable with a lot of custom options
|
||||
|
||||
$process(expression, local, extra=34, extra2=foo)
|
||||
|
||||
"""
|
||||
args, kwargs = safe_convert_to_type(
|
||||
(('py', 'py'), {'extra1': int, 'extra2': str}),
|
||||
(('py', 'py'), {'extra1': int, 'extra2': str}),
|
||||
*args, **kwargs)
|
||||
|
||||
# args/kwargs should be correct types now
|
||||
|
||||
# args/kwargs should be correct types now
|
||||
|
||||
```
|
||||
|
||||
In other words,
|
||||
|
||||
```python
|
||||
```python
|
||||
args, kwargs = safe_convert_to_type(
|
||||
(tuple_of_arg_converters, dict_of_kwarg_converters), *args, **kwargs)
|
||||
```
|
||||
|
||||
Each converter should be a callable taking one argument - this will be the arg/kwarg-value to convert. The
|
||||
special converter `"py"` will try to convert a string argument to a Python structure with the help of the
|
||||
following tools (which you may also find useful to experiment with on your own):
|
||||
Each converter should be a callable taking one argument - this will be the arg/kwarg-value to convert. The
|
||||
special converter `"py"` will try to convert a string argument to a Python structure with the help of the
|
||||
following tools (which you may also find useful to experiment with on your own):
|
||||
|
||||
- [ast.literal_eval](https://docs.python.org/3.8/library/ast.html#ast.literal_eval) is an in-built Python
|
||||
function. It
|
||||
_only_ supports strings, bytes, numbers, tuples, lists, dicts, sets, booleans and `None`. That's
|
||||
it - no arithmetic or modifications of data is allowed. This is good for converting individual values and
|
||||
lists/dicts from the input line to real Python objects.
|
||||
- [simpleeval](https://pypi.org/project/simpleeval/) is a third-party tool included with Evennia. This
|
||||
allows for evaluation of simple (and thus safe) expressions. One can operate on numbers and strings
|
||||
with +-/* as well as do simple comparisons like `4 > 3` and more. It does _not_ accept more complex
|
||||
- [simpleeval](https://pypi.org/project/simpleeval/) is a third-party tool included with Evennia. This
|
||||
allows for evaluation of simple (and thus safe) expressions. One can operate on numbers and strings
|
||||
with `+-/*` as well as do simple comparisons like `4 > 3` and more. It does _not_ accept more complex
|
||||
containers like lists/dicts etc, so this and `literal_eval` are complementary to each other.
|
||||
|
||||
```warning::
|
||||
It may be tempting to run use Python's in-built ``eval()`` or ``exec()`` functions as converters since
|
||||
these are able to convert any valid Python source code to Python. NEVER DO THIS unless you really, really
|
||||
know that ONLY developers will ever modify the string going into the callable. The parser is intended
|
||||
for untrusted users (if you were trusted you'd have access to Python already). Letting untrusted users
|
||||
pass strings to ``eval``/``exec`` is a MAJOR security risk. It allows the caller to run arbitrary
|
||||
Python code on your server. This is the path to maliciously deleted hard drives. Just don't do it and
|
||||
```{warning}
|
||||
It may be tempting to run use Python's in-built ``eval()`` or ``exec()`` functions as converters since
|
||||
these are able to convert any valid Python source code to Python. NEVER DO THIS unless you really, really
|
||||
know that ONLY developers will ever modify the string going into the callable. The parser is intended
|
||||
for untrusted users (if you were trusted you'd have access to Python already). Letting untrusted users
|
||||
pass strings to ``eval``/``exec`` is a MAJOR security risk. It allows the caller to run arbitrary
|
||||
Python code on your server. This is the path to maliciously deleted hard drives. Just don't do it and
|
||||
sleep better at night.
|
||||
```
|
||||
|
||||
## Default callables
|
||||
|
||||
These are some example callables you can import and add your parser. They are divided into
|
||||
global-level dicts in `evennia.utils.funcparser`. Just import the dict(s) and merge/add one or
|
||||
These are some example callables you can import and add your parser. They are divided into
|
||||
global-level dicts in `evennia.utils.funcparser`. Just import the dict(s) and merge/add one or
|
||||
more to them when you create your `FuncParser` instance to have those callables be available.
|
||||
|
||||
### `evennia.utils.funcparser.FUNCPARSER_CALLABLES`
|
||||
|
||||
These are the 'base' callables.
|
||||
|
||||
- `$eval(expression)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_eval)) -
|
||||
this uses `literal_eval` and `simple_eval` (see previous section) attemt to convert a string expression
|
||||
- `$eval(expression)` ([code](evennia.utils.funcparser.funcparser_callable_eval)) -
|
||||
this uses `literal_eval` and `simple_eval` (see previous section) attemt to convert a string expression
|
||||
to a python object. This handles e.g. lists of literals `[1, 2, 3]` and simple expressions like `"1 + 2"`.
|
||||
- `$toint(number)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_toint)) -
|
||||
- `$toint(number)` ([code](evennia.utils.funcparser.funcparser_callable_toint)) -
|
||||
always converts an output to an integer, if possible.
|
||||
- `$add/sub/mult/div(obj1, obj2)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_add)) -
|
||||
this adds/subtracts/multiplies and divides to elements together. While simple addition could be done with
|
||||
`$eval`, this could for example be used also to add two lists together, which is not possible with `eval`;
|
||||
- `$add/sub/mult/div(obj1, obj2)` ([code](evennia.utils.funcparser.funcparser_callable_add)) -
|
||||
this adds/subtracts/multiplies and divides to elements together. While simple addition could be done with
|
||||
`$eval`, this could for example be used also to add two lists together, which is not possible with `eval`;
|
||||
for example `$add($eval([1,2,3]), $eval([4,5,6])) -> [1, 2, 3, 4, 5, 6]`.
|
||||
- `$round(float, significant)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_round)) -
|
||||
- `$round(float, significant)` ([code](evennia.utils.funcparser.funcparser_callable_round)) -
|
||||
rounds an input float into the number of provided significant digits. For example `$round(3.54343, 3) -> 3.543`.
|
||||
- `$random([start, [end]])` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_random)) -
|
||||
this works like the Python `random()` function, but will randomize to an integer value if both start/end are
|
||||
- `$random([start, [end]])` ([code](evennia.utils.funcparser.funcparser_callable_random)) -
|
||||
this works like the Python `random()` function, but will randomize to an integer value if both start/end are
|
||||
integers. Without argument, will return a float between 0 and 1.
|
||||
- `$randint([start, [end]])` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_randint)) -
|
||||
- `$randint([start, [end]])` ([code](evennia.utils.funcparser.funcparser_callable_randint)) -
|
||||
works like the `randint()` python function and always returns an integer.
|
||||
- `$choice(list)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_choice)) -
|
||||
the input will automatically be parsed the same way as `$eval` and is expected to be an iterable. A random
|
||||
- `$choice(list)` ([code](evennia.utils.funcparser.funcparser_callable_choice)) -
|
||||
the input will automatically be parsed the same way as `$eval` and is expected to be an iterable. A random
|
||||
element of this list will be returned.
|
||||
- `$pad(text[, width, align, fillchar])` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_pad)) -
|
||||
- `$pad(text[, width, align, fillchar])` ([code](evennia.utils.funcparser.funcparser_callable_pad)) -
|
||||
this will pad content. `$pad("Hello", 30, c, -)` will lead to a text centered in a 30-wide block surrounded by `-`
|
||||
characters.
|
||||
- `$crop(text, width=78, suffix='[...]')` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_crop)) -
|
||||
- `$crop(text, width=78, suffix='[...]')` ([code](evennia.utils.funcparser.funcparser_callable_crop)) -
|
||||
this will crop a text longer than the width, by default ending it with a `[...]`-suffix that also fits within
|
||||
the width. If no width is given, the client width or `settings.DEFAULT_CLIENT_WIDTH` will be used.
|
||||
- `$space(num)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_space)) -
|
||||
- `$space(num)` ([code](evennia.utils.funcparser.funcparser_callable_space)) -
|
||||
this will insert `num` spaces.
|
||||
- `$just(string, width=40, align=c, indent=2)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_justify)) -
|
||||
- `$just(string, width=40, align=c, indent=2)` ([code](evennia.utils.funcparser.funcparser_callable_justify)) -
|
||||
justifies the text to a given width, aligning it left/right/center or 'f' for full (spread text across width).
|
||||
- `$ljust` - shortcut to justify-left. Takes all other kwarg of `$just`.
|
||||
- `$rjust` - shortcut to right justify.
|
||||
- `$cjust` - shortcut to center justify.
|
||||
- `$clr(startcolor, text[, endcolor])` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_clr)) -
|
||||
color text. The color is given with one or two characters without the preceeding `|`. If no endcolor is
|
||||
- `$clr(startcolor, text[, endcolor])` ([code](evennia.utils.funcparser.funcparser_callable_clr)) -
|
||||
color text. The color is given with one or two characters without the preceeding `|`. If no endcolor is
|
||||
given, the string will go back to neutral, so `$clr(r, Hello)` is equivalent to `|rHello|n`.
|
||||
|
||||
### `evennia.utils.funcparser.SEARCHING_CALLABLES`
|
||||
|
|
@ -304,15 +300,16 @@ These are callables that requires access-checks in order to search for objects.
|
|||
extra reserved kwargs to be passed when running the parser:
|
||||
|
||||
```python
|
||||
parser.parse_to_any(string, caller=<object or account>, access="control", ...)`
|
||||
|
||||
parser.parse_to_any(string, caller=<object or account>, access="control", ...)
|
||||
|
||||
```
|
||||
The `caller` is required, it's the the object to do the access-check for. The `access` kwarg is the
|
||||
[lock type](./Locks) to check, default being `"control"`.
|
||||
The `caller` is required, it's the the object to do the access-check for. The `access` kwarg is the
|
||||
[lock type](./Locks.md) to check, default being `"control"`.
|
||||
|
||||
- `$search(query,type=account|script,return_list=False)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_search)) -
|
||||
this will look up and try to match an object by key or alias. Use the `type` kwarg to
|
||||
search for `account` or `script` instead. By default this will return nothing if there are more than one
|
||||
- `$search(query,type=account|script,return_list=False)` ([code](evennia.utils.funcparser.funcparser_callable_search)) -
|
||||
this will look up and try to match an object by key or alias. Use the `type` kwarg to
|
||||
search for `account` or `script` instead. By default this will return nothing if there are more than one
|
||||
match; if `return_list` is `True` a list of 0, 1 or more matches will be returned instead.
|
||||
- `$obj(query)`, `$dbref(query)` - legacy aliases for `$search`.
|
||||
- `$objlist(query)` - legacy alias for `$search`, always returning a list.
|
||||
|
|
@ -320,9 +317,9 @@ The `caller` is required, it's the the object to do the access-check for. The `a
|
|||
|
||||
### `evennia.utils.funcparser.ACTOR_STANCE_CALLABLES`
|
||||
|
||||
These are used to implement actor-stance emoting. They are used by the
|
||||
[DefaultObject.msg_contents](api:evennia.objects.objects#evennia.objects.objects.DefaultObject.msg_contents) method
|
||||
by default.
|
||||
These are used to implement actor-stance emoting. They are used by the
|
||||
[DefaultObject.msg_contents](evennia.objects.objects.DefaultObject.msg_contents) method
|
||||
by default.
|
||||
|
||||
These all require extra kwargs be passed into the parser:
|
||||
|
||||
|
|
@ -333,16 +330,16 @@ parser.parse(string, caller=<obj>, receiver=<obj>, mapping={'key': <obj>, ...})
|
|||
Here the `caller` is the one sending the message and `receiver` the one to see it. The `mapping` contains
|
||||
references to other objects accessible via these callables.
|
||||
|
||||
- `$you([key])` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_you)) -
|
||||
if no `key` is given, this represents the `caller`, otherwise an object from `mapping`
|
||||
will be used. As this message is sent to different recipients, the `receiver` will change and this will
|
||||
be replaced either with the string `you` (if you and the receiver is the same entity) or with the
|
||||
- `$you([key])` ([code](evennia.utils.funcparser.funcparser_callable_you)) -
|
||||
if no `key` is given, this represents the `caller`, otherwise an object from `mapping`
|
||||
will be used. As this message is sent to different recipients, the `receiver` will change and this will
|
||||
be replaced either with the string `you` (if you and the receiver is the same entity) or with the
|
||||
result of `you_obj.get_display_name(looker=receiver)`. This allows for a single string to echo differently
|
||||
depending on who sees it, and also to reference other people in the same way.
|
||||
- `$You([key])` - same as `$you` but always capitalized.
|
||||
- `$conj(verb)` ([code](api:evennia.utils.funcparser#evennia.utils.funcparser.funcparser_callable_conjugate)) -- conjugates a verb between 4nd person presens to 3rd person presence depending on who
|
||||
- `$conj(verb)` ([code](evennia.utils.funcparser.funcparser_callable_conjugate)) -- conjugates a verb between 4nd person presens to 3rd person presence depending on who
|
||||
sees the string. For example `"$You() $conj(smiles)".` will show as "You smile." and "Tom smiles." depending
|
||||
on who sees it. This makes use of the tools in [evennia.utils.verb_conjugation](api:evennia.utils.verb_conjugation)
|
||||
on who sees it. This makes use of the tools in [evennia.utils.verb_conjugation](evennia.utils.verb_conjugation)
|
||||
to do this, and only works for English verbs.
|
||||
|
||||
### Example
|
||||
|
|
@ -377,10 +374,10 @@ result = parser.parse(string)
|
|||
```
|
||||
|
||||
Above we define two callables `_dashline` and `_uptime` and map them to names `"dashline"` and `"uptime"`,
|
||||
which is what we then can call as `$header` and `$uptime` in the string. We also have access to
|
||||
which is what we then can call as `$header` and `$uptime` in the string. We also have access to
|
||||
all the defaults (like `$toint()`).
|
||||
|
||||
The parsed result of the above would be something like this:
|
||||
The parsed result of the above would be something like this:
|
||||
|
||||
This is the current uptime:
|
||||
------- 343 seconds -------
|
||||
------- 343 seconds -------
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ regular code editor, see below).
|
|||
Evennia collects help entries from three sources:
|
||||
|
||||
- _Auto-generated command help_ - this is literally the doc-strings of
|
||||
the [Command classes](./Commands). The idea is that the command docs are
|
||||
the [Command classes](./Commands.md). The idea is that the command docs are
|
||||
easier to maintain and keep up-to-date if the developer can change them at the
|
||||
same time as they do the code.
|
||||
- _Database-stored help entries_ - These are created in-game (using the
|
||||
|
|
@ -93,14 +93,14 @@ All help entries (no matter the source) have the following properties:
|
|||
extra space at beginning and end.
|
||||
|
||||
A `text` that scrolls off the screen will automatically be paginated by
|
||||
the [EvMore](./EvMore) pager (you can control this with
|
||||
the [EvMore](./EvMore.md) pager (you can control this with
|
||||
`settings.HELP_MORE_ENABLED=False`). If you use EvMore and want to control
|
||||
exactly where the pager should break the page, mark the break with the control
|
||||
character `\f`.
|
||||
|
||||
#### Subtopics
|
||||
|
||||
```versionadded:: 1.0
|
||||
```{versionadded} 1.0
|
||||
```
|
||||
|
||||
Rather than making a very long help entry, the `text` may also be broken up
|
||||
|
|
@ -199,7 +199,7 @@ The text at the very top of the command class definition is the class'
|
|||
consistent format - all default commands are using the structure shown above.
|
||||
|
||||
You can limit access to the help entry by the `view` and/or `read` locks on the
|
||||
Command. See [the section below](#Locking-help-entries) for details.
|
||||
Command. See [the section below](./Help-System.md#locking-help-entries) for details.
|
||||
|
||||
You should also supply the `help_category` class property if you can; this helps
|
||||
to group help entries together for people to more easily find them. See the
|
||||
|
|
@ -209,7 +209,7 @@ used.
|
|||
|
||||
If you don't want your command to be picked up by the auto-help system at all
|
||||
(like if you want to write its docs manually using the info in the next section
|
||||
or you use a [cmdset](./Command-Sets) that has its own help functionality) you
|
||||
or you use a [cmdset](./Command-Sets.md) that has its own help functionality) you
|
||||
can explicitly set `auto_help` class property to `False` in your command
|
||||
definition.
|
||||
|
||||
|
|
@ -233,8 +233,8 @@ entry = create_help_entry("emote",
|
|||
category="Roleplaying", locks="view:all()")
|
||||
```
|
||||
|
||||
The entity being created is a [evennia.help.models.HelpEntry](api:evennia.help.models.HelpEntry)
|
||||
object. This is _not_ a [Typeclassed](./Typeclasses) entity and is not meant to
|
||||
The entity being created is a [evennia.help.models.HelpEntry](evennia.help.models.HelpEntry)
|
||||
object. This is _not_ a [Typeclassed](./Typeclasses.md) entity and is not meant to
|
||||
be modified to any great degree. It holds the properties listed earlier. The
|
||||
text is stored in a field `entrytext`. It does not provide a `get_help` method
|
||||
like commands, stores and returns the `entrytext` directly.
|
||||
|
|
@ -244,7 +244,7 @@ this will not return the two other types of help entries.
|
|||
|
||||
### File-help entries
|
||||
|
||||
```versionadded:: 1.0
|
||||
```{versionadded} 1.0
|
||||
```
|
||||
|
||||
File-help entries are created by the game development team outside of the game. The
|
||||
|
|
@ -369,7 +369,7 @@ help_entry = {
|
|||
|
||||
```
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
Changed the old 'view' lock to control the help-index inclusion and added
|
||||
the new 'read' lock-type to control access to the entry itself.
|
||||
```
|
||||
|
|
@ -377,7 +377,7 @@ help_entry = {
|
|||
## Customizing the look of the help system
|
||||
|
||||
This is done almost exclusively by overriding the `help` command
|
||||
[evennia.commands.default.help.CmdHelp](api:evennia.commands.default.help#CmdHelp).
|
||||
[evennia.commands.default.help.CmdHelp](evennia.commands.default.help.CmdHelp).
|
||||
|
||||
Since the available commands may vary from moment to moment, `help` is
|
||||
responsible for collating the three sources of help-entries (commands/db/file)
|
||||
|
|
@ -401,7 +401,7 @@ Once the main entry has been found, subtopics are then searched with
|
|||
simple `==`, `startswith` and `in` matching (there are so relatively few of them
|
||||
at that point).
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
Replaced the old bag-of-words algorithm with lunr package.
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Inputfuncs
|
||||
|
||||
|
||||
An *inputfunc* is an Evennia function that handles a particular input (an [inputcommand](../Concepts/OOB)) from
|
||||
An *inputfunc* is an Evennia function that handles a particular input (an [inputcommand](../Concepts/OOB.md)) from
|
||||
the client. The inputfunc is the last destination for the inputcommand along the [ingoing message
|
||||
path](Messagepath#the-ingoing-message-path). The inputcommand always has the form `(commandname,
|
||||
path](../Concepts/Messagepath.md#the-ingoing-message-path). The inputcommand always has the form `(commandname,
|
||||
(args), {kwargs})` and Evennia will use this to try to find and call an inputfunc on the form
|
||||
|
||||
```python
|
||||
|
|
@ -42,7 +42,7 @@ Evennia defines a few default inputfuncs to handle the common cases. These are d
|
|||
|
||||
This is the most common of inputcommands, and the only one supported by every traditional mud. The
|
||||
argument is usually what the user sent from their command line. Since all text input from the user
|
||||
like this is considered a [Command](./Commands), this inputfunc will do things like nick-replacement
|
||||
like this is considered a [Command](./Commands.md), this inputfunc will do things like nick-replacement
|
||||
and then pass on the input to the central Commandhandler.
|
||||
|
||||
### echo
|
||||
|
|
@ -134,7 +134,7 @@ to expand. By default the following values can be retrieved:
|
|||
accepted names if given an unfamiliar callback name.
|
||||
|
||||
This will tell evennia to repeatedly call a named function at a given interval. Behind the scenes
|
||||
this will set up a [Ticker](./TickerHandler). Only previously acceptable functions are possible to
|
||||
this will set up a [Ticker](./TickerHandler.md). Only previously acceptable functions are possible to
|
||||
repeat-call in this way, you'll need to overload this inputfunc to add the ones you want to offer.
|
||||
By default only two example functions are allowed, "test1" and "test2", which will just echo a text
|
||||
back at the given interval. Stop the repeat by sending `"stop": True` (note that you must include
|
||||
|
|
@ -155,7 +155,7 @@ This is a convenience wrapper for sending "stop" to the `repeat` inputfunc.
|
|||
|
||||
This sets up on-object monitoring of Attributes or database fields. Whenever the field or Attribute
|
||||
changes in any way, the outputcommand will be sent. This is using the
|
||||
[MonitorHandler](./MonitorHandler) behind the scenes. Pass the "stop" key to stop monitoring. Note
|
||||
[MonitorHandler](./MonitorHandler.md) behind the scenes. Pass the "stop" key to stop monitoring. Note
|
||||
that you must supply the name also when stopping to let the system know which monitor should be
|
||||
cancelled.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
|
||||
For most games it is a good idea to restrict what people can do. In Evennia such restrictions are
|
||||
applied and checked by something called *locks*. All Evennia entities ([Commands](./Commands),
|
||||
[Objects](./Objects), [Scripts](./Scripts), [Accounts](./Accounts), [Help System](./Help-System),
|
||||
[messages](./Communications#Msg) and [channels](./Communications#Channels)) are accessed through locks.
|
||||
applied and checked by something called *locks*. All Evennia entities ([Commands](./Commands.md),
|
||||
[Objects](./Objects.md), [Scripts](./Scripts.md), [Accounts](./Accounts.md), [Help System](./Help-System.md),
|
||||
[messages](./Msg.md) and [channels](./Channels.md)) are accessed through locks.
|
||||
|
||||
A lock can be thought of as an "access rule" restricting a particular use of an Evennia entity.
|
||||
Whenever another entity wants that kind of access the lock will analyze that entity in different
|
||||
|
|
@ -92,9 +92,9 @@ the default command set) actually checks for, as in the example of `delete` abov
|
|||
|
||||
Below are the access_types checked by the default commandset.
|
||||
|
||||
- [Commands](./Commands)
|
||||
- [Commands](./Commands.md)
|
||||
- `cmd` - this defines who may call this command at all.
|
||||
- [Objects](./Objects):
|
||||
- [Objects](./Objects.md):
|
||||
- `control` - who is the "owner" of the object. Can set locks, delete it etc. Defaults to the
|
||||
creator of the object.
|
||||
- `call` - who may call Object-commands stored on this Object except for the Object itself. By
|
||||
|
|
@ -109,26 +109,26 @@ something like `call:false()`.
|
|||
- `get`- who may pick up the object and carry it around.
|
||||
- `puppet` - who may "become" this object and control it as their "character".
|
||||
- `attrcreate` - who may create new attributes on the object (default True)
|
||||
- [Characters](./Objects#Characters):
|
||||
- [Characters](./Objects.md#characters):
|
||||
- Same as for Objects
|
||||
- [Exits](./Objects#Exits):
|
||||
- [Exits](./Objects.md#exits):
|
||||
- Same as for Objects
|
||||
- `traverse` - who may pass the exit.
|
||||
- [Accounts](./Accounts):
|
||||
- [Accounts](./Accounts.md):
|
||||
- `examine` - who may examine the account's properties.
|
||||
- `delete` - who may delete the account.
|
||||
- `edit` - who may edit the account's attributes and properties.
|
||||
- `msg` - who may send messages to the account.
|
||||
- `boot` - who may boot the account.
|
||||
- [Attributes](./Attributes): (only checked by `obj.secure_attr`)
|
||||
- [Attributes](./Attributes.md): (only checked by `obj.secure_attr`)
|
||||
- `attrread` - see/access attribute
|
||||
- `attredit` - change/delete attribute
|
||||
- [Channels](./Communications#Channels):
|
||||
- [Channels](./Channels.md):
|
||||
- `control` - who is administrating the channel. This means the ability to delete the channel,
|
||||
boot listeners etc.
|
||||
- `send` - who may send to the channel.
|
||||
- `listen` - who may subscribe and listen to the channel.
|
||||
- [HelpEntry](./Help-System):
|
||||
- [HelpEntry](./Help-System.md):
|
||||
- `examine` - who may view this help entry (usually everyone)
|
||||
- `edit` - who may edit this help entry.
|
||||
|
||||
|
|
@ -214,10 +214,10 @@ Some useful default lockfuncs (see `src/locks/lockfuncs.py` for more):
|
|||
- `false()/none()/superuser()` - give access to none. Superusers bypass the check entirely and are
|
||||
thus the only ones who will pass this check.
|
||||
- `perm(perm)` - this tries to match a given `permission` property, on an Account firsthand, on a
|
||||
Character second. See [below](./Locks#permissions).
|
||||
Character second. See [below](./Permissions.md).
|
||||
- `perm_above(perm)` - like `perm` but requires a "higher" permission level than the one given.
|
||||
- `id(num)/dbref(num)` - checks so the access_object has a certain dbref/id.
|
||||
- `attr(attrname)` - checks if a certain [Attribute](./Attributes) exists on accessing_object.
|
||||
- `attr(attrname)` - checks if a certain [Attribute](./Attributes.md) exists on accessing_object.
|
||||
- `attr(attrname, value)` - checks so an attribute exists on accessing_object *and* has the given
|
||||
value.
|
||||
- `attr_gt(attrname, value)` - checks so accessing_object has a value larger (`>`) than the given
|
||||
|
|
@ -250,7 +250,7 @@ a Lock lookup.
|
|||
## Default locks
|
||||
|
||||
Evennia sets up a few basic locks on all new objects and accounts (if we didn't, noone would have
|
||||
any access to anything from the start). This is all defined in the root [Typeclasses](./Typeclasses)
|
||||
any access to anything from the start). This is all defined in the root [Typeclasses](./Typeclasses.md)
|
||||
of the respective entity, in the hook method `basetype_setup()` (which you usually don't want to
|
||||
edit unless you want to change how basic stuff like rooms and exits store their internal variables).
|
||||
This is called once, before `at_object_creation`, so just put them in the latter method on your
|
||||
|
|
@ -300,7 +300,7 @@ whereas only Admins and the creator may delete it. Everyone can pick it up.
|
|||
|
||||
## A complete example of setting locks on an object
|
||||
|
||||
Assume we have two objects - one is ourselves (not superuser) and the other is an [Object](./Objects)
|
||||
Assume we have two objects - one is ourselves (not superuser) and the other is an [Object](./Objects.md)
|
||||
called `box`.
|
||||
|
||||
> create/drop box
|
||||
|
|
@ -326,7 +326,7 @@ This is defined in `evennia/commands/default/general.py`. In its code we find th
|
|||
```
|
||||
|
||||
So the `get` command looks for a lock with the type *get* (not so surprising). It also looks for an
|
||||
[Attribute](./Attributes) on the checked object called _get_err_msg_ in order to return a customized
|
||||
[Attribute](./Attributes.md) on the checked object called _get_err_msg_ in order to return a customized
|
||||
error message. Sounds good! Let's start by setting that on the box:
|
||||
|
||||
> set box/get_err_msg = You are not strong enough to lift this box.
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ MONITOR_HANDLER.add(obj, fieldname, callback,
|
|||
|
||||
```
|
||||
|
||||
- `obj` ([Typeclassed](./Typeclasses) entity) - the object to monitor. Since this must be
|
||||
typeclassed, it means you can't monitor changes on [Sessions](./Sessions) with the monitorhandler, for
|
||||
- `obj` ([Typeclassed](./Typeclasses.md) entity) - the object to monitor. Since this must be
|
||||
typeclassed, it means you can't monitor changes on [Sessions](./Sessions.md) with the monitorhandler, for
|
||||
example.
|
||||
- `fieldname` (str) - the name of a field or [Attribute](./Attributes) on `obj`. If you want to
|
||||
- `fieldname` (str) - the name of a field or [Attribute](./Attributes.md) on `obj`. If you want to
|
||||
monitor a database field you must specify its full name, including the starting `db_` (like
|
||||
`db_key`, `db_location` etc). Any names not starting with `db_` are instead assumed to be the names
|
||||
of Attributes. This difference matters, since the MonitorHandler will automatically know to watch
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Msg
|
||||
|
||||
The [Msg](api:evennia.comms.models.Msg) object represents a database-saved
|
||||
The [Msg](evennia.comms.models.Msg) object represents a database-saved
|
||||
piece of communication. Think of it as a discrete piece of email - it contains
|
||||
a message, some metadata and will always have a sender and one or more
|
||||
recipients.
|
||||
|
|
@ -14,7 +14,7 @@ good uses for `Msg` objects:
|
|||
- game-wide email stored in 'mailboxes'.
|
||||
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
|
||||
A `Msg` does not have any in-game representation. So if you want to use them
|
||||
to represent in-game mail/letters, the physical letters would never be
|
||||
|
|
@ -25,15 +25,15 @@ good uses for `Msg` objects:
|
|||
|
||||
```
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
Channels dropped Msg-support. Now only used in `page` command by default.
|
||||
```
|
||||
|
||||
## Msg in code
|
||||
|
||||
The Msg is intended to be used exclusively in code, to build other game systems. It is _not_
|
||||
a [Typeclassed](./Typeclasses) entity, which means it cannot (easily) be overridden. It
|
||||
doesn't support Attributes (but it _does_ support [Tags](./Tags)). It tries to be lean
|
||||
a [Typeclassed](./Typeclasses.md) entity, which means it cannot (easily) be overridden. It
|
||||
doesn't support Attributes (but it _does_ support [Tags](./Tags.md)). It tries to be lean
|
||||
and small since a new one is created for every message.
|
||||
|
||||
You create a new message with `evennia.create_message`:
|
||||
|
|
@ -62,7 +62,7 @@ You can search for `Msg` objects in various ways:
|
|||
### Properties on Msg
|
||||
|
||||
- `senders` - there must always be at least one sender. This is a set of
|
||||
- [Account](./Accounts), [Object](./Objects), [Script](./Scripts)
|
||||
- [Account](./Accounts.md), [Object](./Objects.md), [Script](./Scripts.md)
|
||||
or `str` in any combination (but usually a message only targets one type).
|
||||
Using a `str` for a sender indicates it's an 'external' sender and
|
||||
and can be used to point to a sender that is not a typeclassed entity. This is not used by default
|
||||
|
|
@ -70,17 +70,17 @@ You can search for `Msg` objects in various ways:
|
|||
python-path, for example). While most systems expect a single sender, it's
|
||||
possible to have any number of them.
|
||||
- `receivers` - these are the ones to see the Msg. These are again any combination of
|
||||
[Account](./Accounts), [Object](./Objects) or [Script](./Scripts) or `str` (an 'external' receiver).
|
||||
[Account](./Accounts.md), [Object](./Objects.md) or [Script](./Scripts.md) or `str` (an 'external' receiver).
|
||||
It's in principle possible to have zero receivers but most usages of Msg expects one or more.
|
||||
- `header` - this is an optional text field that can contain meta-information about the message. For
|
||||
an email-like system it would be the subject line. This can be independently searched, making
|
||||
this a powerful place for quickly finding messages.
|
||||
- `message` - the actual text being sent.
|
||||
- `date_sent` - this is auto-set to the time the Msg was created (and thus presumably sent).
|
||||
- `locks` - the Evennia [lock handler](./Locks). Use with `locks.add()` etc and check locks with `msg.access()`
|
||||
- `locks` - the Evennia [lock handler](./Locks.md). Use with `locks.add()` etc and check locks with `msg.access()`
|
||||
like for all other lockable entities. This can be used to limit access to the contents
|
||||
of the Msg. The default lock-type to check is `'read'`.
|
||||
- `hide_from` - this is an optional list of [Accounts](./Accounts) or [Objects](./Objects) that
|
||||
- `hide_from` - this is an optional list of [Accounts](./Accounts.md) or [Objects](./Objects.md) that
|
||||
will not see this Msg. This relationship is available mainly for optimization
|
||||
reasons since it allows quick filtering of messages not intended for a given
|
||||
target.
|
||||
|
|
@ -88,7 +88,7 @@ You can search for `Msg` objects in various ways:
|
|||
|
||||
## TempMsg
|
||||
|
||||
[evennia.comms.models.TempMsg](api:evennia.comms.models.TempMsg) is an object
|
||||
[evennia.comms.models.TempMsg](evennia.comms.models.TempMsg) is an object
|
||||
that implements the same API as the regular `Msg`, but which has no database
|
||||
component (and thus cannot be searched). It's meant to plugged into systems
|
||||
expecting a `Msg` but where you just want to process the message without saving
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Nicks
|
||||
|
||||
|
||||
*Nicks*, short for *Nicknames* is a system allowing an object (usually a [Account](./Accounts)) to
|
||||
*Nicks*, short for *Nicknames* is a system allowing an object (usually a [Account](./Accounts.md)) to
|
||||
assign custom replacement names for other game entities.
|
||||
|
||||
Nicks are not to be confused with *Aliases*. Setting an Alias on a game entity actually changes an
|
||||
|
|
@ -75,7 +75,7 @@ You can also use [shell-type wildcards](http://www.linfo.org/wildcard.html):
|
|||
## Coding with nicks
|
||||
|
||||
Nicks are stored as the `Nick` database model and are referred from the normal Evennia
|
||||
[object](./Objects) through the `nicks` property - this is known as the *NickHandler*. The NickHandler
|
||||
[object](./Objects.md) through the `nicks` property - this is known as the *NickHandler*. The NickHandler
|
||||
offers effective error checking, searches and conversion.
|
||||
|
||||
```python
|
||||
|
|
@ -101,12 +101,12 @@ offers effective error checking, searches and conversion.
|
|||
In a command definition you can reach the nick handler through `self.caller.nicks`. See the `nick`
|
||||
command in `evennia/commands/default/general.py` for more examples.
|
||||
|
||||
As a last note, The Evennia [channel](./Communications) alias systems are using nicks with the
|
||||
As a last note, The Evennia [channel](./Communications.md) alias systems are using nicks with the
|
||||
`nick_type="channel"` in order to allow users to create their own custom aliases to channels.
|
||||
|
||||
# Advanced note
|
||||
|
||||
Internally, nicks are [Attributes](./Attributes) saved with the `db_attrype` set to "nick" (normal
|
||||
Internally, nicks are [Attributes](./Attributes.md) saved with the `db_attrype` set to "nick" (normal
|
||||
Attributes has this set to `None`).
|
||||
|
||||
The nick stores the replacement data in the Attribute.db_value field as a tuple with four fields
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
All in-game objects in Evennia, be it characters, chairs, monsters, rooms or hand grenades are
|
||||
represented by an Evennia *Object*. Objects form the core of Evennia and is probably what you'll
|
||||
spend most time working with. Objects are [Typeclassed](./Typeclasses) entities.
|
||||
spend most time working with. Objects are [Typeclassed](./Typeclasses.md) entities.
|
||||
|
||||
## How to create your own object types
|
||||
|
||||
|
|
@ -48,17 +48,17 @@ thing yourself in code:
|
|||
call manually you have to give the full path to the class. The `create.create_object` function is
|
||||
powerful and should be used for all coded object creating (so this is what you use when defining
|
||||
your own building commands). Check out the `ev.create_*` functions for how to build other entities
|
||||
like [Scripts](./Scripts)).
|
||||
like [Scripts](./Scripts.md)).
|
||||
|
||||
This particular Rose class doesn't really do much, all it does it make sure the attribute
|
||||
`desc`(which is what the `look` command looks for) is pre-set, which is pretty pointless since you
|
||||
will usually want to change this at build time (using the `@desc` command or using the
|
||||
[Spawner](./Prototypes)). The `Object` typeclass offers many more hooks that is available
|
||||
[Spawner](./Prototypes.md)). The `Object` typeclass offers many more hooks that is available
|
||||
to use though - see next section.
|
||||
|
||||
## Properties and functions on Objects
|
||||
|
||||
Beyond the properties assigned to all [typeclassed](./Typeclasses) objects (see that page for a list
|
||||
Beyond the properties assigned to all [typeclassed](./Typeclasses.md) objects (see that page for a list
|
||||
of those), the Object also has the following custom properties:
|
||||
|
||||
- `aliases` - a handler that allows you to add and remove aliases from this object. Use
|
||||
|
|
@ -67,12 +67,12 @@ of those), the Object also has the following custom properties:
|
|||
- `home` is a backup location. The main motivation is to have a safe place to move the object to if
|
||||
its `location` is destroyed. All objects should usually have a home location for safety.
|
||||
- `destination` - this holds a reference to another object this object links to in some way. Its
|
||||
main use is for [Exits](./Objects#Exits), it's otherwise usually unset.
|
||||
- `nicks` - as opposed to aliases, a [Nick](./Nicks) holds a convenient nickname replacement for a
|
||||
main use is for [Exits](./Objects.md#exits), it's otherwise usually unset.
|
||||
- `nicks` - as opposed to aliases, a [Nick](./Nicks.md) holds a convenient nickname replacement for a
|
||||
real name, word or sequence, only valid for this object. This mainly makes sense if the Object is
|
||||
used as a game character - it can then store briefer shorts, example so as to quickly reference game
|
||||
commands or other characters. Use nicks.add(alias, realname) to add a new one.
|
||||
- `account` - this holds a reference to a connected [Account](./Accounts) controlling this object (if
|
||||
- `account` - this holds a reference to a connected [Account](./Accounts.md) controlling this object (if
|
||||
any). Note that this is set also if the controlling account is *not* currently online - to test if
|
||||
an account is online, use the `has_account` property instead.
|
||||
- `sessions` - if `account` field is set *and the account is online*, this is a list of all active
|
||||
|
|
@ -87,9 +87,9 @@ object set as their `location`).
|
|||
|
||||
The last two properties are special:
|
||||
|
||||
- `cmdset` - this is a handler that stores all [command sets](./Commands#Command_Sets) defined on the
|
||||
- `cmdset` - this is a handler that stores all [command sets](./Command-Sets.md) defined on the
|
||||
object (if any).
|
||||
- `scripts` - this is a handler that manages [Scripts](./Scripts) attached to the object (if any).
|
||||
- `scripts` - this is a handler that manages [Scripts](./Scripts.md) attached to the object (if any).
|
||||
|
||||
The Object also has a host of useful utility functions. See the function headers in
|
||||
`src/objects/objects.py` for their arguments and more details.
|
||||
|
|
@ -104,7 +104,7 @@ on).
|
|||
- `execute_cmd()` - Lets the object execute the given string as if it was given on the command line.
|
||||
- `move_to` - perform a full move of this object to a new location. This is the main move method
|
||||
and will call all relevant hooks, do all checks etc.
|
||||
- `clear_exits()` - will delete all [Exits](./Objects#Exits) to *and* from this object.
|
||||
- `clear_exits()` - will delete all [Exits](./Objects.md#exits) to *and* from this object.
|
||||
- `clear_contents()` - this will not delete anything, but rather move all contents (except Exits) to
|
||||
their designated `Home` locations.
|
||||
- `delete()` - deletes this object, first calling `clear_exits()` and
|
||||
|
|
@ -113,8 +113,7 @@ their designated `Home` locations.
|
|||
The Object Typeclass defines many more *hook methods* beyond `at_object_creation`. Evennia calls
|
||||
these hooks at various points. When implementing your custom objects, you will inherit from the
|
||||
base parent and overload these hooks with your own custom code. See `evennia.objects.objects` for an
|
||||
updated list of all the available hooks or the [API for DefaultObject
|
||||
here](api:evennia.objects.objects#defaultobject).
|
||||
updated list of all the available hooks or the [API for DefaultObject here](evennia.objects.objects.DefaultObject).
|
||||
|
||||
## Subclasses of `Object`
|
||||
|
||||
|
|
@ -126,10 +125,10 @@ practice they are all pretty similar to the base Object.
|
|||
|
||||
### Characters
|
||||
|
||||
Characters are objects controlled by [Accounts](./Accounts). When a new Account
|
||||
Characters are objects controlled by [Accounts](./Accounts.md). When a new Account
|
||||
logs in to Evennia for the first time, a new `Character` object is created and
|
||||
the Account object is assigned to the `account` attribute. A `Character` object
|
||||
must have a [Default Commandset](./Commands#Command_Sets) set on itself at
|
||||
must have a [Default Commandset](./Command-Sets.md) set on itself at
|
||||
creation, or the account will not be able to issue any commands! If you just
|
||||
inherit your own class from `evennia.DefaultCharacter` and make sure to use
|
||||
`super()` to call the parent methods you should be fine. In
|
||||
|
|
@ -150,21 +149,21 @@ you to modify.
|
|||
*in* might be an exit, as well as *door*, *portal* or *jump out the window*. An exit has two things
|
||||
that separate them from other objects. Firstly, their *destination* property is set and points to a
|
||||
valid object. This fact makes it easy and fast to locate exits in the database. Secondly, exits
|
||||
define a special [Transit Command](./Commands) on themselves when they are created. This command is
|
||||
define a special [Transit Command](./Commands.md) on themselves when they are created. This command is
|
||||
named the same as the exit object and will, when called, handle the practicalities of moving the
|
||||
character to the Exits's *destination* - this allows you to just enter the name of the exit on its
|
||||
own to move around, just as you would expect.
|
||||
|
||||
The exit functionality is all defined on the Exit typeclass, so you could in principle completely
|
||||
change how exits work in your game (it's not recommended though, unless you really know what you are
|
||||
doing). Exits are [locked](./Locks) using an access_type called *traverse* and also make use of a few
|
||||
doing). Exits are [locked](./Locks.md) using an access_type called *traverse* and also make use of a few
|
||||
hook methods for giving feedback if the traversal fails. See `evennia.DefaultExit` for more info.
|
||||
In `mygame/typeclasses/exits.py` there is an empty `Exit` class for you to modify.
|
||||
|
||||
The process of traversing an exit is as follows:
|
||||
|
||||
1. The traversing `obj` sends a command that matches the Exit-command name on the Exit object. The
|
||||
[cmdhandler](./Commands) detects this and triggers the command defined on the Exit. Traversal always
|
||||
[cmdhandler](./Commands.md) detects this and triggers the command defined on the Exit. Traversal always
|
||||
involves the "source" (the current location) and the `destination` (this is stored on the Exit
|
||||
object).
|
||||
1. The Exit command checks the `traverse` lock on the Exit object
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Outputfuncs
|
||||
|
||||
TODO. For now info about outputfuncs are found in [OOB](../Concepts/OOB).
|
||||
TODO. For now info about outputfuncs are found in [OOB](../Concepts/OOB.md).
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
# Permissions
|
||||
|
||||
A *permission* is simply a text string stored in the handler `permissions` on `Objects`
|
||||
and `Accounts`. Think of it as a specialized sort of [Tag](./Tags) - one specifically dedicated
|
||||
to access checking. They are thus often tightly coupled to [Locks](./Locks).
|
||||
and `Accounts`. Think of it as a specialized sort of [Tag](./Tags.md) - one specifically dedicated
|
||||
to access checking. They are thus often tightly coupled to [Locks](./Locks.md).
|
||||
Permission strings are not case-sensitive, so "Builder" is the same as "builder"
|
||||
etc.
|
||||
|
||||
Permissions are used as a convenient way to structure access levels and
|
||||
hierarchies. It is set by the `perm` command and checked by the
|
||||
`PermissionHandler.check` method as well as by the specially the `perm()` and
|
||||
`pperm()` [lock functions](./Locks).
|
||||
`pperm()` [lock functions](./Locks.md).
|
||||
|
||||
All new accounts are given a default set of permissions defined by
|
||||
`settings.PERMISSION_ACCOUNT_DEFAULT`.
|
||||
|
|
@ -22,7 +22,7 @@ In-game, you use the `perm` command to add and remove permissions
|
|||
perm/account/del Tommy = Builders
|
||||
|
||||
Note the use of the `/account` switch. It means you assign the permission to the
|
||||
[Accounts](./Accounts) Tommy instead of any [Character](./Objects) that also
|
||||
[Accounts](./Accounts.md) Tommy instead of any [Character](./Objects.md) that also
|
||||
happens to be named "Tommy".
|
||||
|
||||
There can be reasons for putting permissions on Objects (especially NPCS), but
|
||||
|
|
@ -32,7 +32,7 @@ of which Character they are currently puppeting. This is especially important to
|
|||
remember when assigning permissions from the *hierarchy tree* (see below), as an
|
||||
Account's permissions will overrule that of its character. So to be sure to
|
||||
avoid confusion you should generally put hierarchy permissions on the Account,
|
||||
not on their Characters (but see also [quelling](./Locks#Quelling)).
|
||||
not on their Characters (but see also [quelling](#quelling)).
|
||||
|
||||
In code, you add/remove Permissions via the `PermissionHandler`, which sits on all
|
||||
typeclassed entities as the property `.permissions`:
|
||||
|
|
@ -73,7 +73,7 @@ that permission to pass.
|
|||
## Checking permissions
|
||||
|
||||
It's important to note that you check for the permission of a *puppeted*
|
||||
[Object](./Objects) (like a Character), the check will always first use the
|
||||
[Object](./Objects.md) (like a Character), the check will always first use the
|
||||
permissions of any `Account` connected to that Object before checking for
|
||||
permissions on the Object. In the case of hierarchical permissions (Admins,
|
||||
Builders etc), the Account permission will always be used (this stops an Account
|
||||
|
|
@ -99,7 +99,7 @@ _PermissionHandler_, stored as `.permissions` on all typeclassed entities.
|
|||
Using the `.check` method is the way to go, it will take hierarchical
|
||||
permissions into account, check accounts/sessions etc.
|
||||
|
||||
```warning
|
||||
```{warning}
|
||||
|
||||
Don't confuse `.permissions.check()` with `.permissions.has()`. The .has()
|
||||
method checks if a string is defined specifically on that PermissionHandler.
|
||||
|
|
@ -111,7 +111,7 @@ permissions into account, check accounts/sessions etc.
|
|||
### Lock funcs
|
||||
|
||||
While the `PermissionHandler` offers a simple way to check perms, [Lock
|
||||
strings](Locks) offers a mini-language for describing how something is accessed.
|
||||
strings](./Locks.md) offers a mini-language for describing how something is accessed.
|
||||
The `perm()` _lock function_ is the main tool for using Permissions in locks.
|
||||
|
||||
Let's say we have a `red_key` object. We also have red chests that we want to
|
||||
|
|
@ -153,7 +153,6 @@ There are several variations to the default `perm` lockfunc:
|
|||
objects (regardless of hierarchical perm or not).
|
||||
- `pperm_above` - like `perm_above`, but for Accounts only.
|
||||
|
||||
|
||||
### Some examples
|
||||
|
||||
Adding permissions and checking with locks
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
Evennia consists of two processes, known as *Portal* and *Server*. They can be controlled from
|
||||
inside the game or from the command line as described [here](../Setup/Start-Stop-Reload).
|
||||
inside the game or from the command line as described [here](../Setup/Start-Stop-Reload.md).
|
||||
|
||||
If you are new to the concept, the main purpose of separating the two is to have accounts connect to
|
||||
the Portal but keep the MUD running on the Server. This way one can restart/reload the game (the
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
|
||||
The *spawner* is a system for defining and creating individual objects from a base template called a
|
||||
*prototype*. It is only designed for use with in-game [Objects](./Objects), not any other type of
|
||||
*prototype*. It is only designed for use with in-game [Objects](./Objects.md), not any other type of
|
||||
entity.
|
||||
|
||||
The normal way to create a custom object in Evennia is to make a [Typeclass](./Typeclasses). If you
|
||||
The normal way to create a custom object in Evennia is to make a [Typeclass](./Typeclasses.md). If you
|
||||
haven't read up on Typeclasses yet, think of them as normal Python classes that save to the database
|
||||
behind the scenes. Say you wanted to create a "Goblin" enemy. A common way to do this would be to
|
||||
first create a `Mobile` typeclass that holds everything common to mobiles in the game, like generic
|
||||
|
|
@ -105,12 +105,12 @@ instead.
|
|||
exist.
|
||||
- `destination` - a valid `#dbref`. Only used by exits.
|
||||
- `permissions` - list of permission strings, like `["Accounts", "may_use_red_door"]`
|
||||
- `locks` - a [lock-string](./Locks) like `"edit:all();control:perm(Builder)"`
|
||||
- `locks` - a [lock-string](./Locks.md) like `"edit:all();control:perm(Builder)"`
|
||||
- `aliases` - list of strings for use as aliases
|
||||
- `tags` - list [Tags](./Tags). These are given as tuples `(tag, category, data)`.
|
||||
- `attrs` - list of [Attributes](./Attributes). These are given as tuples `(attrname, value,
|
||||
- `tags` - list [Tags](./Tags.md). These are given as tuples `(tag, category, data)`.
|
||||
- `attrs` - list of [Attributes](./Attributes.md). These are given as tuples `(attrname, value,
|
||||
category, lockstring)`
|
||||
- Any other keywords are interpreted as non-category [Attributes](./Attributes) and their values.
|
||||
- Any other keywords are interpreted as non-category [Attributes](./Attributes.md) and their values.
|
||||
This is
|
||||
convenient for simple Attributes - use `attrs` for full control of Attributes.
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ Deprecated as of Evennia 0.8:
|
|||
- `ndb_<name>` - sets the value of a non-persistent attribute (`"ndb_"` is stripped from the name).
|
||||
This is simply not useful in a prototype and is deprecated.
|
||||
- `exec` - This accepts a code snippet or a list of code snippets to run. This should not be used -
|
||||
use callables or [$protfuncs](./Prototypes#protfuncs) instead (see below).
|
||||
use callables or [$protfuncs](./Prototypes.md#protfuncs) instead (see below).
|
||||
|
||||
### Prototype values
|
||||
|
||||
|
|
@ -160,10 +160,8 @@ that you embed in strings and that has a `$` in front, like
|
|||
"He has $randint(2,5) skulls in a chain around his neck."}
|
||||
```
|
||||
At execution time, the place of the protfunc will be replaced with the result of that protfunc being
|
||||
called (this is always a string). A protfunc works in much the same way as an
|
||||
[InlineFunc](../Concepts/TextTags#inline-functions) - they are actually
|
||||
parsed using the same parser - except protfuncs are run every time the prototype is used to spawn a
|
||||
new object (whereas an inlinefunc is called when a text is returned to the user).
|
||||
called (this is always a string). A protfunc is a [FuncParser function](./FuncParser.md) run
|
||||
every time the prototype is used to spawn a new object.
|
||||
|
||||
Here is how a protfunc is defined (same as an inlinefunc).
|
||||
|
||||
|
|
@ -233,7 +231,7 @@ A prototype can be defined and stored in two ways, either in the database or as
|
|||
|
||||
### Database prototypes
|
||||
|
||||
Stored as [Scripts](./Scripts) in the database. These are sometimes referred to as *database-
|
||||
Stored as [Scripts](./Scripts.md) in the database. These are sometimes referred to as *database-
|
||||
prototypes* This is the only way for in-game builders to modify and add prototypes. They have the
|
||||
advantage of being easily modifiable and sharable between builders but you need to work with them
|
||||
using in-game tools.
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
# Scripts
|
||||
|
||||
[Script API reference](api:evennia.scripts.scripts)
|
||||
[Script API reference](evennia.scripts.scripts)
|
||||
|
||||
*Scripts* are the out-of-character siblings to the in-character
|
||||
[Objects](./Objects). Scripts are so flexible that the name "Script" is a bit limiting
|
||||
[Objects](./Objects.md). Scripts are so flexible that the name "Script" is a bit limiting
|
||||
in itself - but we had to pick _something_ to name them. Other possible names
|
||||
(depending on what you'd use them for) would be `OOBObjects`, `StorageContainers` or `TimerObjects`.
|
||||
|
||||
If you ever consider creating an [Object](./Objects) with a `None`-location just to store some game data,
|
||||
If you ever consider creating an [Object](./Objects.md) with a `None`-location just to store some game data,
|
||||
you should really be using a Script instead.
|
||||
|
||||
- Scripts are full [Typeclassed](./Typeclasses) entities - they have [Attributes](./Attributes) and
|
||||
- Scripts are full [Typeclassed](./Typeclasses.md) entities - they have [Attributes](./Attributes.md) and
|
||||
can be modified in the same way. But they have _no in-game existence_, so no
|
||||
location or command-execution like [Objects](./Objects) and no connection to a particular
|
||||
player/session like [Accounts](./Accounts). This means they are perfectly suitable for acting
|
||||
location or command-execution like [Objects](./Objects.md) and no connection to a particular
|
||||
player/session like [Accounts](./Accounts.md). This means they are perfectly suitable for acting
|
||||
as database-storage backends for game _systems_: Storing the current state of the economy,
|
||||
who is involved in the current fight, tracking an ongoing barter and so on. They are great as
|
||||
persistent system handlers.
|
||||
|
|
@ -21,22 +21,22 @@ you should really be using a Script instead.
|
|||
to tick the `at_repeat` hook on the Script at a certain interval. The timer can be controlled
|
||||
independently of the rest of the script as needed. This component is optional
|
||||
and complementary to other timing functions in Evennia, like
|
||||
[evennia.utils.delay](api:evennia.utils.utils#evennia.utils.utils.delay) and
|
||||
[evennia.utils.repeat](api:evennia.utils.utils#evennia.utils.utils.repeat).
|
||||
[evennia.utils.delay](evennia.utils.utils.delay) and
|
||||
[evennia.utils.repeat](evennia.utils.utils.repeat).
|
||||
- Scripts can _attach_ to Objects and Accounts via e.g. `obj.scripts.add/remove`. In the
|
||||
script you can then access the object/account as `self.obj` or `self.account`. This can be used to
|
||||
dynamically extend other typeclasses but also to use the timer component to affect the parent object
|
||||
in various ways. For historical reasons, a Script _not_ attached to an object is referred to as a
|
||||
_Global_ Script.
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
In previus Evennia versions, stopping the Script's timer also meant deleting the Script object.
|
||||
Starting with this version, the timer can be start/stopped separately and `.delete()` must be called
|
||||
on the Script explicitly to delete it.
|
||||
|
||||
```
|
||||
|
||||
### In-game command examples
|
||||
## In-game command examples
|
||||
|
||||
There are two main commands controlling scripts in the default cmdset:
|
||||
|
||||
|
|
@ -52,11 +52,11 @@ The `scripts` command is used to view all scripts and perform operations on them
|
|||
> scripts/pause #11
|
||||
> scripts/delete #566
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
The `addscript` command used to be only `script` which was easy to confuse with `scripts`.
|
||||
```
|
||||
|
||||
### Code examples
|
||||
## Code examples
|
||||
|
||||
Here are some examples of working with Scripts in-code (more details to follow in later
|
||||
sections).
|
||||
|
|
@ -111,13 +111,13 @@ new_script.delete()
|
|||
timed_script.delete()
|
||||
```
|
||||
|
||||
## Defining new Scripts
|
||||
# Defining new Scripts
|
||||
|
||||
A Script is defined as a class and is created in the same way as other
|
||||
[typeclassed](./Typeclasses) entities. The parent class is `evennia.DefaultScript`.
|
||||
[typeclassed](./Typeclasses.md) entities. The parent class is `evennia.DefaultScript`.
|
||||
|
||||
|
||||
### Simple storage script
|
||||
## Simple storage script
|
||||
|
||||
In `mygame/typeclasses/scripts.py` is an empty `Script` class already set up. You
|
||||
can use this as a base for your own scripts.
|
||||
|
|
@ -162,12 +162,12 @@ evennia.create_script('typeclasses.scripts.MyScript', key="another name",
|
|||
|
||||
```
|
||||
|
||||
See the [create_script](api:evennia.utils.create#evennia.utils.create.create_script) and
|
||||
[search_script](api:evennia.utils.search#evennia.utils.search.search_script) API documentation for more options
|
||||
See the [create_script](evennia.utils.create.create_script) and
|
||||
[search_script](evennia.utils.search.search_script) API documentation for more options
|
||||
on creating and finding Scripts.
|
||||
|
||||
|
||||
### Timed Scripts
|
||||
## Timed Scripts
|
||||
|
||||
There are several properties one can set on the Script to control its timer component.
|
||||
|
||||
|
|
@ -229,11 +229,11 @@ The timer component is controlled with methods on the Script class:
|
|||
- `.force_repeat()` - this prematurely forces `at_repeat` to be called right away. Doing so will reset the
|
||||
countdown so that next call will again happen after `interval` seconds.
|
||||
|
||||
#### Script timers vs delay/repeat
|
||||
### Script timers vs delay/repeat
|
||||
|
||||
If the _only_ goal is to get a repeat/delay effect, the
|
||||
[evennia.utils.delay](api:evennia.utils.utils#evennia.utils.utils.delay) and
|
||||
[evennia.utils.repeat](api:evennia.utils.utils#evennia.utils.utils.repeat) functions
|
||||
[evennia.utils.delay](evennia.utils.utils.delay) and
|
||||
[evennia.utils.repeat](evennia.utils.utils.repeat) functions
|
||||
should generally be considered first. A Script is a lot 'heavier' to create/delete on the fly.
|
||||
In fact, for making a single delayed call (`script.repeats==1`), the `utils.delay` call is
|
||||
probably always the better choice.
|
||||
|
|
@ -249,9 +249,9 @@ It's also worth noting that once the script object has _already been created_,
|
|||
starting/stopping/pausing/unpausing the timer has very little overhead. The pause/unpause and update
|
||||
methods of the script also offers a bit more fine-control than using `utils.delays/repeat`.
|
||||
|
||||
### Script attached to another object
|
||||
## Script attached to another object
|
||||
|
||||
Scripts can be attached to an [Account](./Accounts) or (more commonly) an [Object](./Objects).
|
||||
Scripts can be attached to an [Account](./Accounts.md) or (more commonly) an [Object](./Objects.md).
|
||||
If so, the 'parent object' will be available to the script as either `.obj` or `.account`.
|
||||
|
||||
|
||||
|
|
@ -303,10 +303,10 @@ You can also attach the script as part of creating it:
|
|||
create_script('typeclasses.weather.Weather', obj=myroom)
|
||||
```
|
||||
|
||||
## Other Script methods
|
||||
# Other Script methods
|
||||
|
||||
A Script has all the properties of a typeclassed object, such as `db` and `ndb`(see
|
||||
[Typeclasses](./Typeclasses)). Setting `key` is useful in order to manage scripts (delete them by name
|
||||
[Typeclasses](./Typeclasses.md)). Setting `key` is useful in order to manage scripts (delete them by name
|
||||
etc). These are usually set up in the Script's typeclass, but can also be assigned on the fly as
|
||||
keyword arguments to `evennia.create_script`.
|
||||
|
||||
|
|
@ -325,12 +325,12 @@ reload.
|
|||
- `delete()` - same as for other typeclassed entities, this will delete the Script. Of note is that
|
||||
it will also stop the timer (if it runs), leading to the `at_stop` hook being called.
|
||||
|
||||
In addition, Scripts support [Attributes](./Attributes), [Tags](./Tags) and [Locks](./Locks) etc like other
|
||||
In addition, Scripts support [Attributes](./Attributes.md), [Tags](./Tags.md) and [Locks](./Locks.md) etc like other
|
||||
Typeclassed entities.
|
||||
|
||||
See also the methods involved in controlling a [Timed Script](#Timed_Scripts) above.
|
||||
See also the methods involved in controlling a [Timed Script](#timed-scripts) above.
|
||||
|
||||
## The GLOBAL_SCRIPTS container
|
||||
# The GLOBAL_SCRIPTS container
|
||||
|
||||
A Script not attached to another entity is commonly referred to as a _Global_ script since it't available
|
||||
to access from anywhere. This means they need to be searched for in order to be used.
|
||||
|
|
@ -353,7 +353,7 @@ GLOBAL_SCRIPTS.weather.db.current_weather = "Cloudy"
|
|||
|
||||
```
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
Note that global scripts appear as properties on `GLOBAL_SCRIPTS` based on their `key`.
|
||||
If you were to create two global scripts with the same `key` (even with different typeclasses),
|
||||
the `GLOBAL_SCRIPTS` container will only return one of them (which one depends on order in
|
||||
|
|
@ -389,10 +389,10 @@ GLOBAL_SCRIPTS = {
|
|||
Above we add two scripts with keys `myscript` and `storagescript`respectively. The following dict
|
||||
can be empty - the `settings.BASE_SCRIPT_TYPECLASS` will then be used. Under the hood, the provided
|
||||
dict (along with the `key`) will be passed into `create_script` automatically, so
|
||||
all the [same keyword arguments as for create_script](api:evennia.utils.create.create_script) are
|
||||
all the [same keyword arguments as for create_script](evennia.utils.create.create_script) are
|
||||
supported here.
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
Before setting up Evennia to manage your script like this, make sure that your Script typeclass
|
||||
does not have any critical errors (test it separately). If there are, you'll see errors in your log
|
||||
and your Script will temporarily fall back to being a `DefaultScript` type.
|
||||
|
|
@ -413,7 +413,7 @@ That is, if the script is deleted, next time you get it from `GLOBAL_SCRIPTS`, E
|
|||
information in settings to recreate it for you on the fly.
|
||||
|
||||
|
||||
## Hints: Dealing with Script Errors
|
||||
# Hints: Dealing with Script Errors
|
||||
|
||||
Errors inside a timed, executing script can sometimes be rather terse or point to
|
||||
parts of the execution mechanism that is hard to interpret. One way to make it
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Server component
|
||||
|
||||
TODO: This is currently in [Portal-and-Server](./Portal-And-Server).
|
||||
TODO: This is currently in [Portal-and-Server](./Portal-And-Server.md).
|
||||
|
|
@ -5,14 +5,14 @@ An Evennia *Session* represents one single established connection to the server.
|
|||
Evennia session, it is possible for a person to connect multiple times, for example using different
|
||||
clients in multiple windows. Each such connection is represented by a session object.
|
||||
|
||||
A session object has its own [cmdset](./Command-Sets), usually the "unloggedin" cmdset. This is what
|
||||
A session object has its own [cmdset](./Command-Sets.md), usually the "unloggedin" cmdset. This is what
|
||||
is used to show the login screen and to handle commands to create a new account (or
|
||||
[Account](./Accounts) in evennia lingo) read initial help and to log into the game with an existing
|
||||
[Account](./Accounts.md) in evennia lingo) read initial help and to log into the game with an existing
|
||||
account. A session object can either be "logged in" or not. Logged in means that the user has
|
||||
authenticated. When this happens the session is associated with an Account object (which is what
|
||||
holds account-centric stuff). The account can then in turn puppet any number of objects/characters.
|
||||
|
||||
> Warning: A Session is not *persistent* - it is not a [Typeclass](./Typeclasses) and has no
|
||||
> Warning: A Session is not *persistent* - it is not a [Typeclass](./Typeclasses.md) and has no
|
||||
connection to the database. The Session will go away when a user disconnects and you will lose any
|
||||
custom data on it if the server reloads. The `.db` handler on Sessions is there to present a uniform
|
||||
API (so you can assume `.db` exists even if you don't know if you receive an Object or a Session),
|
||||
|
|
@ -26,13 +26,13 @@ Here are some important properties available on (Server-)Sessions
|
|||
- `sessid` - The unique session-id. This is an integer starting from 1.
|
||||
- `address` - The connected client's address. Different protocols give different information here.
|
||||
- `logged_in` - `True` if the user authenticated to this session.
|
||||
- `account` - The [Account](./Accounts) this Session is attached to. If not logged in yet, this is
|
||||
- `account` - The [Account](./Accounts.md) this Session is attached to. If not logged in yet, this is
|
||||
`None`.
|
||||
- `puppet` - The [Character/Object](./Objects) currently puppeted by this Account/Session combo. If
|
||||
- `puppet` - The [Character/Object](./Objects.md) currently puppeted by this Account/Session combo. If
|
||||
not logged in or in OOC mode, this is `None`.
|
||||
- `ndb` - The [Non-persistent Attribute](./Attributes) handler.
|
||||
- `ndb` - The [Non-persistent Attribute](./Attributes.md) handler.
|
||||
- `db` - As noted above, Sessions don't have regular Attributes. This is an alias to `ndb`.
|
||||
- `cmdset` - The Session's [CmdSetHandler](./Command-Sets)
|
||||
- `cmdset` - The Session's [CmdSetHandler](./Command-Sets.md)
|
||||
|
||||
Session statistics are mainly used internally by Evennia.
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ transparently detect which session was triggering the command (if any) and redir
|
|||
`command.msg()` is often the safest bet.
|
||||
|
||||
You can get the `session` in two main ways:
|
||||
* [Accounts](./Accounts) and [Objects](./Objects) (including Characters) have a `sessions` property.
|
||||
* [Accounts](./Accounts.md) and [Objects](./Objects.md) (including Characters) have a `sessions` property.
|
||||
This is a *handler* that tracks all Sessions attached to or puppeting them. Use e.g.
|
||||
`accounts.sessions.get()` to get a list of Sessions attached to that entity.
|
||||
* A Command instance has a `session` property that always points back to the Session that triggered
|
||||
|
|
@ -132,7 +132,7 @@ changes carefully.
|
|||
|
||||
*Note: This is considered an advanced topic. You don't need to know this on a first read-through.*
|
||||
|
||||
Evennia is split into two parts, the [Portal and the Server](./Portal-And-Server). Each side tracks
|
||||
Evennia is split into two parts, the [Portal and the Server](./Portal-And-Server.md). Each side tracks
|
||||
its own Sessions, syncing them to each other.
|
||||
|
||||
The "Session" we normally refer to is actually the `ServerSession`. Its counter-part on the Portal
|
||||
|
|
@ -172,7 +172,7 @@ server reboot (assuming the Portal is not stopped at the same time, obviously).
|
|||
Both the Portal and Server each have a *sessionhandler* to manage the connections. These handlers
|
||||
are global entities contain all methods for relaying data across the AMP bridge. All types of
|
||||
Sessions hold a reference to their respective Sessionhandler (the property is called
|
||||
`sessionhandler`) so they can relay data. See [protocols](../Concepts/Custom-Protocols) for more info
|
||||
`sessionhandler`) so they can relay data. See [protocols](../Concepts/Custom-Protocols.md) for more info
|
||||
on building new protocols.
|
||||
|
||||
To get all Sessions in the game (i.e. all currently connected clients), you access the server-side
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ be extracted from the `**kwargs` dict in the signal handler.
|
|||
used way for users to themselves create accounts during login. It passes and extra kwarg `ip` with
|
||||
the client IP of the connecting account.
|
||||
- `SIGNAL_ACCOUNT_POST_LOGIN` - this will always fire when the account has authenticated. Sends
|
||||
extra kwarg `session` with the new [Session](./Sessions) object involved.
|
||||
extra kwarg `session` with the new [Session](./Sessions.md) object involved.
|
||||
- `SIGNAL_ACCCOUNT_POST_FIRST_LOGIN` - this fires just before `SIGNAL_ACCOUNT_POST_LOGIN` but only
|
||||
if
|
||||
this is the *first* connection done (that is, if there are no previous sessions connected). Also
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ currently dead.
|
|||
*Tags* are short text labels that you attach to objects so as to easily be able to retrieve and
|
||||
group them. An Evennia entity can be tagged with any number of Tags. On the database side, Tag
|
||||
entities are *shared* between all objects with that tag. This makes them very efficient but also
|
||||
fundamentally different from [Attributes](./Attributes), each of which always belongs to one *single*
|
||||
fundamentally different from [Attributes](./Attributes.md), each of which always belongs to one *single*
|
||||
object.
|
||||
|
||||
In Evennia, Tags are technically also used to implement `Aliases` (alternative names for objects)
|
||||
and `Permissions` (simple strings for [Locks](./Locks) to check for).
|
||||
and `Permissions` (simple strings for [Locks](./Locks.md) to check for).
|
||||
|
||||
|
||||
## Properties of Tags (and Aliases and Permissions)
|
||||
|
|
@ -26,7 +26,7 @@ unique key + category combination.
|
|||
|
||||
When Tags are assigned to game entities, these entities are actually sharing the same Tag. This
|
||||
means that Tags are not suitable for storing information about a single object - use an
|
||||
[Attribute](./Attributes) for this instead. Tags are a lot more limited than Attributes but this also
|
||||
[Attribute](./Attributes.md) for this instead. Tags are a lot more limited than Attributes but this also
|
||||
makes them very quick to lookup in the database - this is the whole point.
|
||||
|
||||
Tags have the following properties, stored in the database:
|
||||
|
|
@ -52,8 +52,8 @@ free up the *category* property for any use you desire.
|
|||
|
||||
## Adding/Removing Tags
|
||||
|
||||
You can tag any *typeclassed* object, namely [Objects](./Objects), [Accounts](./Accounts),
|
||||
[Scripts](./Scripts) and [Channels](./Communications). General tags are added by the *Taghandler*. The
|
||||
You can tag any *typeclassed* object, namely [Objects](./Objects.md), [Accounts](./Accounts.md),
|
||||
[Scripts](./Scripts.md) and [Channels](./Communications.md). General tags are added by the *Taghandler*. The
|
||||
tag handler is accessed as a property `tags` on the relevant entity:
|
||||
|
||||
```python
|
||||
|
|
@ -135,7 +135,7 @@ objs = evennia.search_tag(category="bar")
|
|||
|
||||
|
||||
|
||||
There is also an in-game command that deals with assigning and using ([Object-](./Objects)) tags:
|
||||
There is also an in-game command that deals with assigning and using ([Object-](./Objects.md)) tags:
|
||||
|
||||
@tag/search furniture
|
||||
|
||||
|
|
@ -166,4 +166,4 @@ That said, tag categories can be useful if you build some game system that uses
|
|||
use tag categories to make sure to separate tags created with this system from any other tags
|
||||
created elsewhere. You can then supply custom search methods that *only* find objects tagged with
|
||||
tags of that category. An example of this
|
||||
is found in the [Zone tutorial](../Concepts/Zones).
|
||||
is found in the [Zone tutorial](../Concepts/Zones.md).
|
||||
|
|
@ -11,7 +11,7 @@ hard-coded to rely on the concept of the global 'tick'. Evennia has no such noti
|
|||
use tickers is very much up to the need of your game and which requirements you have. The "ticker
|
||||
recipe" is just one way of cranking the wheels.
|
||||
|
||||
The most fine-grained way to manage the flow of time is of course to use [Scripts](./Scripts). Many
|
||||
The most fine-grained way to manage the flow of time is of course to use [Scripts](./Scripts.md). Many
|
||||
types of operations (weather being the classic example) are however done on multiple objects in the
|
||||
same way at regular intervals, and for this, storing separate Scripts on each object is inefficient.
|
||||
The way to do this is to use a ticker with a "subscription model" - let objects sign up to be
|
||||
|
|
@ -98,13 +98,13 @@ The `callable` can be on any form as long as it accepts the arguments you give t
|
|||
|
||||
> Note that everything you supply to the TickerHandler will need to be pickled at some point to be
|
||||
saved into the database. Most of the time the handler will correctly store things like database
|
||||
objects, but the same restrictions as for [Attributes](./Attributes) apply to what the TickerHandler
|
||||
objects, but the same restrictions as for [Attributes](./Attributes.md) apply to what the TickerHandler
|
||||
may store.
|
||||
|
||||
When testing, you can stop all tickers in the entire game with `tickerhandler.clear()`. You can also
|
||||
view the currently subscribed objects with `tickerhandler.all()`.
|
||||
|
||||
See the [Weather Tutorial](../Howto/Weather-Tutorial) for an example of using the TickerHandler.
|
||||
See the [Weather Tutorial](../Howto/Weather-Tutorial.md) for an example of using the TickerHandler.
|
||||
|
||||
### When *not* to use TickerHandler
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
different game entities as Python classes, without having to modify the database schema for every
|
||||
new type.
|
||||
|
||||
In Evennia the most important game entities, [Accounts](./Accounts), [Objects](./Objects),
|
||||
[Scripts](./Scripts) and [Channels](./Communications#Channels) are all Python classes inheriting, at
|
||||
In Evennia the most important game entities, [Accounts](./Accounts.md), [Objects](./Objects.md),
|
||||
[Scripts](./Scripts.md) and [Channels](./Channels.md) are all Python classes inheriting, at
|
||||
varying distance, from `evennia.typeclasses.models.TypedObject`. In the documentation we refer to
|
||||
these objects as being "typeclassed" or even "being a typeclass".
|
||||
|
||||
|
|
@ -48,14 +48,14 @@ module from anywhere, the `typeclass/list` will not find it. To make it known
|
|||
to Evennia you must import that module from somewhere.
|
||||
|
||||
|
||||
### Difference between typeclasses and classes
|
||||
## Difference between typeclasses and classes
|
||||
|
||||
All Evennia classes inheriting from class in the table above share one important feature and two
|
||||
important limitations. This is why we don't simply call them "classes" but "typeclasses".
|
||||
|
||||
1. A typeclass can save itself to the database. This means that some properties (actually not that
|
||||
many) on the class actually represents database fields and can only hold very specific data types.
|
||||
This is detailed [below](./Typeclasses#about-typeclass-properties).
|
||||
This is detailed [below](./Typeclasses.md#about-typeclass-properties).
|
||||
1. Due to its connection to the database, the typeclass' name must be *unique* across the _entire_
|
||||
server namespace. That is, there must never be two same-named classes defined anywhere. So the below
|
||||
code would give an error (since `DefaultObject` is now globally found both in this module and in the
|
||||
|
|
@ -82,7 +82,7 @@ both accept arbitrary keyword arguments and use `super` to call its parent::
|
|||
```
|
||||
|
||||
Apart from this, a typeclass works like any normal Python class and you can
|
||||
treat it as such.
|
||||
treat it as such.
|
||||
|
||||
|
||||
## Creating a new typeclass
|
||||
|
|
@ -129,11 +129,11 @@ argument; this can both be the actual class or the python path to the typeclass
|
|||
game directory. So if your `Furniture` typeclass sits in `mygame/typeclasses/furniture.py`, you
|
||||
could point to it as `typeclasses.furniture.Furniture`. Since Evennia will itself look in
|
||||
`mygame/typeclasses`, you can shorten this even further to just `furniture.Furniture`. The create-
|
||||
functions take a lot of extra keywords allowing you to set things like [Attributes](./Attributes) and
|
||||
[Tags](./Tags) all in one go. These keywords don't use the `db_*` prefix. This will also automatically
|
||||
functions take a lot of extra keywords allowing you to set things like [Attributes](./Attributes.md) and
|
||||
[Tags](./Tags.md) all in one go. These keywords don't use the `db_*` prefix. This will also automatically
|
||||
save the new instance to the database, so you don't need to call `save()` explicitly.
|
||||
|
||||
### About typeclass properties
|
||||
## About typeclass properties
|
||||
|
||||
An example of a database field is `db_key`. This stores the "name" of the entity you are modifying
|
||||
and can thus only hold a string. This is one way of making sure to update the `db_key`:
|
||||
|
|
@ -178,36 +178,36 @@ returns the string form "#id".
|
|||
|
||||
The typeclassed entity has several common handlers:
|
||||
|
||||
- `tags` - the [TagHandler](./Tags) that handles tagging. Use `tags.add()` , `tags.get()` etc.
|
||||
- `locks` - the [LockHandler](./Locks) that manages access restrictions. Use `locks.add()`,
|
||||
- `tags` - the [TagHandler](./Tags.md) that handles tagging. Use `tags.add()` , `tags.get()` etc.
|
||||
- `locks` - the [LockHandler](./Locks.md) that manages access restrictions. Use `locks.add()`,
|
||||
`locks.get()` etc.
|
||||
- `attributes` - the [AttributeHandler](./Attributes) that manages Attributes on the object. Use
|
||||
- `attributes` - the [AttributeHandler](./Attributes.md) that manages Attributes on the object. Use
|
||||
`attributes.add()`
|
||||
etc.
|
||||
- `db` (DataBase) - a shortcut property to the AttributeHandler; allowing `obj.db.attrname = value`
|
||||
- `nattributes` - the [Non-persistent AttributeHandler](./Attributes) for attributes not saved in the
|
||||
- `nattributes` - the [Non-persistent AttributeHandler](./Attributes.md) for attributes not saved in the
|
||||
database.
|
||||
- `ndb` (NotDataBase) - a shortcut property to the Non-peristent AttributeHandler. Allows
|
||||
`obj.ndb.attrname = value`
|
||||
|
||||
|
||||
Each of the typeclassed entities then extend this list with their own properties. Go to the
|
||||
respective pages for [Objects](./Objects), [Scripts](./Scripts), [Accounts](./Accounts) and
|
||||
[Channels](./Communications) for more info. It's also recommended that you explore the available
|
||||
entities using [Evennia's flat API](../Evennia-API) to explore which properties and methods they have
|
||||
respective pages for [Objects](./Objects.md), [Scripts](./Scripts.md), [Accounts](./Accounts.md) and
|
||||
[Channels](./Communications.md) for more info. It's also recommended that you explore the available
|
||||
entities using [Evennia's flat API](../Evennia-API.md) to explore which properties and methods they have
|
||||
available.
|
||||
|
||||
### Overloading hooks
|
||||
## Overloading hooks
|
||||
|
||||
The way to customize typeclasses is usually to overload *hook methods* on them. Hooks are methods
|
||||
that Evennia call in various situations. An example is the `at_object_creation` hook on `Objects`,
|
||||
which is only called once, the very first time this object is saved to the database. Other examples
|
||||
are the `at_login` hook of Accounts and the `at_repeat` hook of Scripts.
|
||||
|
||||
### Querying for typeclasses
|
||||
## Querying for typeclasses
|
||||
|
||||
Most of the time you search for objects in the database by using convenience methods like the
|
||||
`caller.search()` of [Commands](./Commands) or the search functions like `evennia.search_objects`.
|
||||
`caller.search()` of [Commands](./Commands.md) or the search functions like `evennia.search_objects`.
|
||||
|
||||
You can however also query for them directly using [Django's query
|
||||
language](https://docs.djangoproject.com/en/1.7/topics/db/queries/). This makes use of a _database
|
||||
|
|
@ -245,13 +245,13 @@ matches = ScriptDB.objects.filter(db_key__contains="Combat")
|
|||
When querying from the database model parent you don't need to use `filter_family` or `get_family` -
|
||||
you will always query all children on the database model.
|
||||
|
||||
## Updating existing typeclass instances
|
||||
# Updating existing typeclass instances
|
||||
|
||||
If you already have created instances of Typeclasses, you can modify the *Python code* at any time -
|
||||
due to how Python inheritance works your changes will automatically be applied to all children once
|
||||
you have reloaded the server.
|
||||
|
||||
However, database-saved data, like `db_*` fields, [Attributes](./Attributes), [Tags](./Tags) etc, are
|
||||
However, database-saved data, like `db_*` fields, [Attributes](./Attributes.md), [Tags](./Tags.md) etc, are
|
||||
not themselves embedded into the class and will *not* be updated automatically. This you need to
|
||||
manage yourself, by searching for all relevant objects and updating or adding the data:
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ The arguments to this method are described [in the API docs
|
|||
here](github:evennia.typeclasses.models#typedobjectswap_typeclass).
|
||||
|
||||
|
||||
## How typeclasses actually work
|
||||
# How typeclasses actually work
|
||||
|
||||
*This is considered an advanced section.*
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ Technically, typeclasses are [Django proxy
|
|||
models](https://docs.djangoproject.com/en/1.7/topics/db/models/#proxy-models). The only database
|
||||
models that are "real" in the typeclass system (that is, are represented by actual tables in the
|
||||
database) are `AccountDB`, `ObjectDB`, `ScriptDB` and `ChannelDB` (there are also
|
||||
[Attributes](./Attributes) and [Tags](./Tags) but they are not typeclasses themselves). All the
|
||||
[Attributes](./Attributes.md) and [Tags](./Tags.md) but they are not typeclasses themselves). All the
|
||||
subclasses of them are "proxies", extending them with Python code without actually modifying the
|
||||
database layout.
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ Evennia modifies Django's proxy model in various ways to allow them to work with
|
|||
handles this for you using metaclasses). Evennia also makes sure you can query subclasses as well as
|
||||
patches django to allow multiple inheritance from the same base class.
|
||||
|
||||
### Caveats
|
||||
## Caveats
|
||||
|
||||
Evennia uses the *idmapper* to cache its typeclasses (Django proxy models) in memory. The idmapper
|
||||
allows things like on-object handlers and properties to be stored on typeclass instances and to not
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ meant to be accessed in code, by other programs.
|
|||
The API is using [Django Rest Framework][drf]. This automates the process
|
||||
of setting up _views_ (Python code) to process the result of web requests.
|
||||
The process of retrieving data is similar to that explained on the
|
||||
[Webserver](./Webserver) page, except the views will here return [JSON][json]
|
||||
[Webserver](./Webserver.md) page, except the views will here return [JSON][json]
|
||||
data for the resource you want. You can also _send_ such JSON data
|
||||
in order to update the database from the outside.
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ To activate the API, add this to your settings file.
|
|||
The main controlling setting is `REST_FRAMEWORK`, which is a dict. The keys
|
||||
`DEFAULT_LIST_PERMISSION` and `DEFAULT_CREATE_PERMISSIONS` control who may
|
||||
view and create new objects via the api respectively. By default, users with
|
||||
['Builder'-level permission](./Permissions) or higher may access both actions.
|
||||
['Builder'-level permission](./Permissions.md) or higher may access both actions.
|
||||
|
||||
While the api is meant to be expanded upon, Evennia supplies several operations
|
||||
out of the box. If you click the `Autodoc` button in the upper right of the `/api`
|
||||
|
|
@ -74,7 +74,7 @@ permissions:
|
|||
"results": [{"username": "bob",...}]
|
||||
}
|
||||
|
||||
Now suppose that you want to use the API to create an [Object](./Objects):
|
||||
Now suppose that you want to use the API to create an [Object](./Objects.md):
|
||||
|
||||
>>> data = {"db_key": "A shiny sword"}
|
||||
>>> response = requests.post("https://www.mygame.com/api/objects",
|
||||
|
|
@ -108,7 +108,7 @@ Overall, reading up on [Django Rest Framework ViewSets](https://www.django-rest-
|
|||
other parts of their documentation is required for expanding and
|
||||
customizing the API.
|
||||
|
||||
Check out the [Website](./Website) page for help on how to override code, templates
|
||||
Check out the [Website](./Website.md) page for help on how to override code, templates
|
||||
and static files.
|
||||
- API templates (for the web-display) is located in `evennia/web/api/templates/rest_framework/` (it must
|
||||
be named such to allow override of the original REST framework templates).
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ objects are actually stored as a `tuple` with object-unique data.
|
|||
you'll find the field _Serialized string_. This string shows a Python tuple like
|
||||
|
||||
('__packed_dbobj__', ('objects', 'objectdb'), '2021:05:15-08:59:30:624660', 358)
|
||||
|
||||
|
||||
Mark and copy this tuple-string to your clipboard exactly as it stands (parentheses and all).
|
||||
2. Go to the entity that should have the new Attribute and create the Attribute. In its `value`
|
||||
field, paste the tuple-string you copied before. Save!
|
||||
|
|
@ -86,21 +86,21 @@ Only Superusers can change the `Superuser status` flag, and grant new
|
|||
permissions to accounts. The superuser is the only permission level that is
|
||||
also relevant in-game. `User Permissions` and `Groups` found on the `Account`
|
||||
admin page _only_ affects the admin - they have no connection to the in-game
|
||||
[Permissions](./Permissions) (Player, Builder, Admin etc).
|
||||
[Permissions](./Permissions.md) (Player, Builder, Admin etc).
|
||||
|
||||
For a staffer with `Staff status` to be able to actually do anything, the
|
||||
superuser must grant at least some permissions for them on their Account. This
|
||||
can also be good in order to limit mistakes. It can be a good idea to not allow
|
||||
the `Can delete Account` permission, for example.
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
|
||||
If you grant staff-status and permissions to an Account and they still cannot
|
||||
access the admin's content, try reloading the server.
|
||||
|
||||
```
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
|
||||
If a staff member has access to the in-game ``py`` command, they can just as
|
||||
well have their admin ``Superuser status`` set too. The reason is that ``py``
|
||||
|
|
@ -112,25 +112,25 @@ the `Can delete Account` permission, for example.
|
|||
|
||||
## Customizing the web admin
|
||||
|
||||
Customizing the admin is a big topic and something beyond the scope of this
|
||||
Customizing the admin is a big topic and something beyond the scope of this
|
||||
documentation. See the [official Django docs](https://docs.djangoproject.com/en/3.2/ref/contrib/admin/) for
|
||||
the details. This is just a brief summary.
|
||||
the details. This is just a brief summary.
|
||||
|
||||
See the [Website](./Website) page for an overview of the components going into
|
||||
See the [Website](./Website.md) page for an overview of the components going into
|
||||
generating a web page. The Django admin uses the same principle except that
|
||||
Django provides a lot of tools to automate the admin-generation for us.
|
||||
|
||||
Admin templates are found in `evennia/web/templates/admin/` but you'll find
|
||||
this is relatively empty. This is because most of the templates are just
|
||||
inherited directly from their original location in the Django package
|
||||
(`django/contrib/admin/templates/`). So if you wanted to override one you'd have
|
||||
(`django/contrib/admin/templates/`). So if you wanted to override one you'd have
|
||||
to copy it from _there_ into your `mygame/templates/admin/` folder. Same is true
|
||||
for CSS files.
|
||||
|
||||
The admin site's backend code (the views) is found in `evennia/web/admin/`. It
|
||||
is organized into `admin`-classes, like `ObjectAdmin`, `AccountAdmin` etc.
|
||||
These automatically use the underlying database models to generate useful views
|
||||
for us without us havint go code the forms etc ourselves.
|
||||
for us without us havint go code the forms etc ourselves.
|
||||
|
||||
The top level `AdminSite` (the admin configuration referenced in django docs)
|
||||
is found in `evennia/web/utils/adminsite.py`.
|
||||
|
|
@ -138,7 +138,7 @@ is found in `evennia/web/utils/adminsite.py`.
|
|||
|
||||
### Change the title of the admin
|
||||
|
||||
By default the admin's title is `Evennia web admin`. To change this, add the
|
||||
By default the admin's title is `Evennia web admin`. To change this, add the
|
||||
following to your `mygame/web/urls.py`:
|
||||
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ When Evennia starts it also spins up its own Twisted-based web server. The
|
|||
webserver is responsible for serving the html pages of the game's website. It
|
||||
can also serve static resources like images and music.
|
||||
|
||||
The webclient runs as part of the [Server](./Portal-And-Server) process of
|
||||
The webclient runs as part of the [Server](./Portal-And-Server.md) process of
|
||||
Evennia. This means that it can directly access cached objects modified
|
||||
in-game, and there is no risk of working with objects that are temporarily
|
||||
out-of-sync in the database.
|
||||
|
|
@ -12,17 +12,17 @@ out-of-sync in the database.
|
|||
The webserver runs on Twisted and is meant to be used in a production
|
||||
environment. It leverages the Django web framework and provides:
|
||||
|
||||
- A [Game Website](./Website) - this is what you see when you go to
|
||||
- A [Game Website](./Website.md) - this is what you see when you go to
|
||||
`localhost:4001`. The look of the website is meant to be customized to your
|
||||
game. Users logged into the website will be auto-logged into the game if they
|
||||
do so with the webclient since they share the same login credentials (there
|
||||
is no way to safely do auto-login with telnet clients).
|
||||
- The [Web Admin](./Web-Admin) is based on the Django web admin and allows you to
|
||||
- The [Web Admin](./Web-Admin.md) is based on the Django web admin and allows you to
|
||||
edit the game database in a graphical interface.
|
||||
- The [Webclient](./Webclient) page is served by the webserver, but the actual
|
||||
- The [Webclient](./Webclient.md) page is served by the webserver, but the actual
|
||||
game communication (sending/receiving data) is done by the javascript client
|
||||
on the page opening a websocket connection directly to Evennia's Portal.
|
||||
- The [Evennia REST-API](./Web-API) allows for accessing the database from outside the game
|
||||
- The [Evennia REST-API](./Web-API.md) allows for accessing the database from outside the game
|
||||
(only if `REST_API_ENABLED=True).
|
||||
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ it operates independently from Evennia. Small snippets of javascript can be
|
|||
used on a page to have buttons react, make small animations etc that doesn't
|
||||
require the server.
|
||||
|
||||
In the case of the [Webclient](./Webclient), Evennia will load the Webclient page
|
||||
In the case of the [Webclient](./Webclient.md), Evennia will load the Webclient page
|
||||
as above, but the page then initiates Javascript code (a lot of it) responsible
|
||||
for actually displaying the client GUI, allows you to resize windows etc.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
# Game website
|
||||
|
||||
When Evennia starts it will also start a [Webserver](./Webserver) as part of the
|
||||
[Server](./Portal-And-Server) process. This uses [Django](https://docs.djangoproject.com)
|
||||
When Evennia starts it will also start a [Webserver](./Webserver.md) as part of the
|
||||
[Server](./Portal-And-Server.md) process. This uses [Django](https://docs.djangoproject.com)
|
||||
to present a simple but functional default game website. With the default setup,
|
||||
open your browser to [localhost:4001](http://localhost:4001) or [127.0.0.1:4001](http://127.0.0.1:4001)
|
||||
open your browser to [localhost:4001](http://localhost:4001) or [127.0.0.1:4001](http://127.0.0.1:4001)
|
||||
to see it.
|
||||
|
||||
The website allows existing players to log in using an account-name and
|
||||
password they previously used to register with the game. If a user logs in with
|
||||
the [Webclient](./Webclient) they will also log into the website and vice-versa.
|
||||
the [Webclient](./Webclient.md) they will also log into the website and vice-versa.
|
||||
So if you are logged into the website, opening the webclient will automatically
|
||||
log you into the game as that account.
|
||||
|
||||
|
|
@ -28,15 +28,15 @@ In the top menu you can find
|
|||
show a list of all channels available to you and allow you to view the latest
|
||||
discussions. Most channels require logging in, but the `Public` channel can
|
||||
also be viewed by non-loggedin users.
|
||||
- _Help_ - This ties the in-game [Help system](./Help-System) to the website. All
|
||||
- _Help_ - This ties the in-game [Help system](./Help-System.md) to the website. All
|
||||
database-based help entries that are publicly available or accessible to your
|
||||
account can be read. This is a good way to present a body of help for people
|
||||
to read outside of the game.
|
||||
- _Play Online_ - This opens the [Webclient](./Webclient) in the browser.
|
||||
- _Play Online_ - This opens the [Webclient](./Webclient.md) in the browser.
|
||||
- _Admin_ The [Web admin](Web admin) will only show if you are logged in.
|
||||
- _Log in/out_ - Allows you to authenticate using the same credentials you use
|
||||
in the game.
|
||||
- _Register_ - Allows you to register a new account. This is the same as
|
||||
- _Register_ - Allows you to register a new account. This is the same as
|
||||
creating a new account upon first logging into the game).
|
||||
|
||||
## Modifying the default Website
|
||||
|
|
@ -52,7 +52,7 @@ You'll mostly be doing so in your settings file
|
|||
> DEBUG mode leaks memory (for retaining debug info) and is *not* safe to use
|
||||
> for a production game!
|
||||
|
||||
As explained on the [Webserver](./Webserver) page, the process for getting a web
|
||||
As explained on the [Webserver](./Webserver.md) page, the process for getting a web
|
||||
page is
|
||||
|
||||
1. Web browser sends HTTP request to server with an URL
|
||||
|
|
@ -115,7 +115,7 @@ This is the layout of the `mygame/web/` folder relevant for the website:
|
|||
|
||||
```
|
||||
|
||||
```versionchanged:: 1.0
|
||||
```{versionchanged} 1.0
|
||||
|
||||
Game folders created with older versions of Evennia will lack most of this
|
||||
convenient `mygame/web/` layout. If you use a game dir from an older version,
|
||||
|
|
@ -139,7 +139,7 @@ version rather than it using the original.
|
|||
|
||||
## Examples of commom web changes
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
|
||||
Django is a very mature web-design framework. There are endless
|
||||
internet-tutorials, courses and books available to explain how to use Django.
|
||||
|
|
@ -206,8 +206,8 @@ There's a lot more information to be found in the [Django template language docu
|
|||
|
||||
### Change webpage colors and styling
|
||||
|
||||
You can tweak the [CSS](https://en.wikipedia.org/wiki/Cascading_Style_Sheets) of the entire
|
||||
website. If you investigate the `evennia/web/templates/website/base.html` file you'll see that we
|
||||
You can tweak the [CSS](https://en.wikipedia.org/wiki/Cascading_Style_Sheets) of the entire
|
||||
website. If you investigate the `evennia/web/templates/website/base.html` file you'll see that we
|
||||
use the [Bootstrap
|
||||
4](https://getbootstrap.com/docs/4.6/getting-started/introduction/) toolkit.
|
||||
|
||||
|
|
@ -220,8 +220,8 @@ The website's custom CSS is found in
|
|||
empty) `custom.css` in the same location. You can override either, but it may
|
||||
be easier to revert your changes if you only add things to `custom.css`.
|
||||
|
||||
Copy the CSS file you want to modify to the corresponding location in `mygame/web`.
|
||||
Modify it and reload the server to see your changes.
|
||||
Copy the CSS file you want to modify to the corresponding location in `mygame/web`.
|
||||
Modify it and reload the server to see your changes.
|
||||
|
||||
You can also apply static files without reloading, but running this in the
|
||||
terminal:
|
||||
|
|
@ -233,8 +233,8 @@ terminal:
|
|||
> Note that before you see new CSS files applied you may need to refresh your
|
||||
> browser without cache (Ctrl-F5 in Firefox, for example).
|
||||
|
||||
As an example, add/copy `custom.css` to `mygame/web/static/website/css/` and
|
||||
add the following:
|
||||
As an example, add/copy `custom.css` to `mygame/web/static/website/css/` and
|
||||
add the following:
|
||||
|
||||
|
||||
```css
|
||||
|
|
@ -271,14 +271,14 @@ look in `evennia/web/website/urls.py`. Here we find the following line:
|
|||
|
||||
```
|
||||
|
||||
The first `""` is the empty url - root - what you get if you just enter `localhost:4001/`
|
||||
The first `""` is the empty url - root - what you get if you just enter `localhost:4001/`
|
||||
with no extra path. As expected, this leads to the index page. By looking at the imports
|
||||
we find the view is in in `evennia/web/website/views/index.py`.
|
||||
we find the view is in in `evennia/web/website/views/index.py`.
|
||||
|
||||
Copy this file to the corresponding location in `mygame/web`. Then tweak your `mygame/web/website/urls.py`
|
||||
Copy this file to the corresponding location in `mygame/web`. Then tweak your `mygame/web/website/urls.py`
|
||||
file to point to the new file:
|
||||
|
||||
```python
|
||||
```python
|
||||
# in mygame/web/website/urls.py
|
||||
|
||||
# ...
|
||||
|
|
@ -292,8 +292,8 @@ urlpatterns = [
|
|||
# ...
|
||||
|
||||
```
|
||||
|
||||
So we just import `index` from the new location and point to it. After a reload
|
||||
|
||||
So we just import `index` from the new location and point to it. After a reload
|
||||
the front page will now redirect to use your copy rather than the original.
|
||||
|
||||
The frontpage view is a class `EvenniaIndexView`. This is a [Django class-based view](https://docs.djangoproject.com/en/3.2/topics/class-based-views/).
|
||||
|
|
@ -321,7 +321,7 @@ your copy. Just remember to reload.
|
|||
### Using Flat Pages
|
||||
|
||||
The absolutely simplest way to add a new web page is to use the `Flat Pages`
|
||||
app available in the [Web Admin](./Web-Admin). The page will appear with the same
|
||||
app available in the [Web Admin](./Web-Admin.md). The page will appear with the same
|
||||
styling as the rest of the site.
|
||||
|
||||
For the `Flat pages` module to work you must first set up a _Site_ (or
|
||||
|
|
@ -337,7 +337,7 @@ experimentation, add the domain `localhost:4001`. Note the `id` of the domain
|
|||
Next you create new pages easily.
|
||||
|
||||
- Go the `Flat Pages` web admin and choose to add a new flat page.
|
||||
- Set the url. If you want the page to appear as e.g. `localhost:4001/test/`, then
|
||||
- Set the url. If you want the page to appear as e.g. `localhost:4001/test/`, then
|
||||
add `/test/` here. You need to add both leading and trailing slashes.
|
||||
- Set `Title` to the name of the page.
|
||||
- The `Content` is the HTML content of the body of the page. Go wild!
|
||||
|
|
@ -348,16 +348,16 @@ You can now go to `localhost:4001/test/` and see your new page!
|
|||
|
||||
### Add Custom new page
|
||||
|
||||
The `Flat Pages` page doesn't allow for (much) dynamic content and customization. For
|
||||
The `Flat Pages` page doesn't allow for (much) dynamic content and customization. For
|
||||
this you need to add the needed components yourself.
|
||||
|
||||
Let's see how to make a `/test/` page from scratch.
|
||||
|
||||
- Add a new `test.html` file under `mygame/web/templates/website/`. Easiest is to base
|
||||
this off an existing file. Make sure to `{% extend base.html %}` if you want to
|
||||
- Add a new `test.html` file under `mygame/web/templates/website/`. Easiest is to base
|
||||
this off an existing file. Make sure to `{% extend base.html %}` if you want to
|
||||
get the same styling as the rest of your site.
|
||||
- Add a new view `testview.py` under `mygame/web/website/views/` (don't name it `test.py` or
|
||||
Django/Evennia will think it contains unit tests). Add a view there to process
|
||||
- Add a new view `testview.py` under `mygame/web/website/views/` (don't name it `test.py` or
|
||||
Django/Evennia will think it contains unit tests). Add a view there to process
|
||||
your page. This is a minimal view to start from (read much more [in the Django docs](https://docs.djangoproject.com/en/3.2/topics/class-based-views/)):
|
||||
|
||||
```python
|
||||
|
|
@ -385,7 +385,7 @@ Let's see how to make a `/test/` page from scratch.
|
|||
path("test/", testview.MyTestView.as_view())
|
||||
]
|
||||
|
||||
```
|
||||
```
|
||||
- Reload the server and your new page is available. You can now continue to add
|
||||
all sorts of advanced dynamic content through your view and template!
|
||||
|
||||
|
|
@ -395,13 +395,13 @@ Let's see how to make a `/test/` page from scratch.
|
|||
All the pages created so far deal with _presenting_ information to the user.
|
||||
It's also possible for the user to _input_ data on the page through _forms_. An
|
||||
example would be a page of fields and sliders you fill in to create a
|
||||
character, with a big 'Submit' button at the bottom.
|
||||
character, with a big 'Submit' button at the bottom.
|
||||
|
||||
Firstly, this must be represented in HTML. The `<form> ... </form>` is a
|
||||
standard HTML element you need to add to your template. It also has some other
|
||||
requirements, such as `<input>` and often Javascript components as well (but
|
||||
usually Django will help with this). If you are unfamiliar with how HTML forms
|
||||
work, [read about them here](https://docs.djangoproject.com/en/3.2/topics/forms/#html-forms).
|
||||
work, [read about them here](https://docs.djangoproject.com/en/3.2/topics/forms/#html-forms).
|
||||
|
||||
The basic gist of it is that when you click to 'submit' the form, a POST HTML
|
||||
request will be sent to the server containing the data the user entered. It's
|
||||
|
|
@ -412,9 +412,9 @@ On the backend side, we need to specify the logic for validating and processing
|
|||
the form data. This is done by the `Form` [Django class](https://docs.djangoproject.com/en/3.2/topics/forms/#forms-in-django).
|
||||
This specifies _fields_ on itself that define how to validate that piece of data.
|
||||
|
||||
The form is then linked into the view-class by adding `form_class = MyFormClass` to
|
||||
The form is then linked into the view-class by adding `form_class = MyFormClass` to
|
||||
the view (next to `template_name`).
|
||||
|
||||
There are several example forms in `evennia/web/website/forms.py`. It's also a good
|
||||
There are several example forms in `evennia/web/website/forms.py`. It's also a good
|
||||
idea to read [Building a form in Django](https://docs.djangoproject.com/en/3.2/topics/forms/#building-a-form-in-django)
|
||||
on the Django website - it covers all you need.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ line quite pointless for processing any data from the function. Instead one has
|
|||
- `at_err_kwargs` - an optional dictionary that will be fed as keyword arguments to the `at_err`
|
||||
errback.
|
||||
|
||||
An example of making an asynchronous call from inside a [Command](../Components/Commands) definition:
|
||||
An example of making an asynchronous call from inside a [Command](../Components/Commands.md) definition:
|
||||
|
||||
```python
|
||||
from evennia import utils, Command
|
||||
|
|
@ -139,7 +139,7 @@ sleep.
|
|||
```
|
||||
|
||||
This will delay the execution of the callback for 10 seconds. This function is explored much more in
|
||||
the [Command Duration Tutorial](../Howto/Command-Duration).
|
||||
the [Command Duration Tutorial](../Howto/Command-Duration.md).
|
||||
|
||||
You can also try the following snippet just see how it works:
|
||||
|
||||
|
|
|
|||
|
|
@ -114,14 +114,14 @@ is not what you want in this case.
|
|||
|
||||
- **cboot mychannel = thomas** -- Boot a subscriber from a channel you control
|
||||
- **clock mychannel = control:perm(Admin);listen:all();send:all()** -- Fine control of access to
|
||||
your channel using [lock definitions](../Components/Locks).
|
||||
your channel using [lock definitions](../Components/Locks.md).
|
||||
|
||||
Locking a specific command (like `page`) is accomplished like so:
|
||||
1. Examine the source of the command. [The default `page` command class](
|
||||
https://github.com/evennia/evennia/blob/master/evennia/commands/default/comms.py#L686) has the lock
|
||||
string **"cmd:not pperm(page_banned)"**. This means that unless the player has the 'permission'
|
||||
"page_banned" they can use this command. You can assign any lock string to allow finer customization
|
||||
in your commands. You might look for the value of an [Attribute](../Components/Attributes) or [Tag](../Components/Tags), your
|
||||
in your commands. You might look for the value of an [Attribute](../Components/Attributes.md) or [Tag](../Components/Tags.md), your
|
||||
current location etc.
|
||||
2. **perm/account thomas = page_banned** -- Give the account the 'permission' which causes (in this
|
||||
case) the lock to fail.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
*OBS: This gives only a brief introduction to the access system. Locks and permissions are fully
|
||||
detailed* [here](../Components/Locks).
|
||||
detailed* [here](../Components/Locks.md).
|
||||
|
||||
## The super user
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ but one superuser.
|
|||
|
||||
Whereas permissions can be used for anything, those put in `settings.PERMISSION_HIERARCHY` will have
|
||||
a ranking relative each other as well. We refer to these types of permissions as *hierarchical
|
||||
permissions*. When building locks to check these permissions, the `perm()` [lock function](../Components/Locks) is
|
||||
permissions*. When building locks to check these permissions, the `perm()` [lock function](../Components/Locks.md) is
|
||||
used. By default Evennia creates the following hierarchy (spelled exactly like this):
|
||||
|
||||
1. **Developers** basically have the same access as superusers except that they do *not* sidestep
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
## Clickable links
|
||||
# Clickable links
|
||||
|
||||
Evennia supports clickable links for clients that supports it. This marks certain text so it can be
|
||||
clicked by a mouse and either trigger a given Evennia command, or open a URL in an external web
|
||||
browser. To support clickable links, Evennia requires the webclient or an third-party telnet client
|
||||
clicked by a mouse and either trigger a given Evennia command, or open a URL in an external web
|
||||
browser. To support clickable links, Evennia requires the webclient or an third-party telnet client
|
||||
with [MXP](http://www.zuggsoft.com/zmud/mxp.htm) support (*Note: Evennia only supports clickable links, no other MXP features*).
|
||||
|
||||
- `|lc` to start the link, by defining the command to execute.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Colors
|
||||
|
||||
*Note that the Documentation does not display colour the way it would look on the screen.*
|
||||
|
||||
|
||||
Color can be a very useful tool for your game. It can be used to increase readability and make your
|
||||
game more appealing visually.
|
||||
|
||||
|
|
@ -14,13 +14,13 @@ equipment by people who are blind or have otherwise diminished eyesight.
|
|||
|
||||
So a good rule of thumb is to use colour to enhance your game but don't *rely* on it to display
|
||||
critical information. If you are coding the game, you can add functionality to let users disable
|
||||
colours as they please, as described [here](../Howto/Manually-Configuring-Color).
|
||||
colours as they please, as described [here](../Howto/Manually-Configuring-Color.md).
|
||||
|
||||
To see which colours your client support, use the default `@color` command. This will list all
|
||||
available colours for ANSI and Xterm256 along with the codes you use for them. You can find a list
|
||||
of all the parsed `ANSI`-colour codes in `evennia/utils/ansi.py`.
|
||||
|
||||
### ANSI colours
|
||||
## ANSI colours
|
||||
|
||||
Evennia supports the `ANSI` standard for text. This is by far the most supported MUD-color standard,
|
||||
available in all but the most ancient mud clients. The ANSI colours are **r**ed, **g**reen,
|
||||
|
|
@ -28,7 +28,7 @@ available in all but the most ancient mud clients. The ANSI colours are **r**ed,
|
|||
first letter except for black which is abbreviated with the letter **x**. In ANSI there are "bright"
|
||||
and "normal" (darker) versions of each color, adding up to a total of 16 colours to use for
|
||||
foreground text. There are also 8 "background" colours. These have no bright alternative in ANSI
|
||||
(but Evennia uses the [Xterm256](./TextTags#xterm256-colours) extension behind the scenes to offer
|
||||
(but Evennia uses the [Xterm256](#xterm256-colours) extension behind the scenes to offer
|
||||
them anyway).
|
||||
|
||||
To colour your text you put special tags in it. Evennia will parse these and convert them to the
|
||||
|
|
@ -37,7 +37,7 @@ will see the text in the specified colour, otherwise the tags will be stripped (
|
|||
This works also for non-terminal clients, such as the webclient. For the webclient, Evennia will
|
||||
translate the codes to HTML RGB colors.
|
||||
|
||||
Here is an example of the tags in action:
|
||||
Here is an example of the tags in action:
|
||||
|
||||
|rThis text is bright red.|n This is normal text.
|
||||
|RThis is a dark red text.|n This is normal text.
|
||||
|
|
@ -49,9 +49,9 @@ Here is an example of the tags in action:
|
|||
"normal". So `|g` is a bright green and `|G` is "normal" (darker) green.
|
||||
- `|[#` is used to add a background colour to the text. The case again specifies if it is "bright"
|
||||
or "normal", so `|[c` starts a bright cyan background and `|[C` a darker cyan background.
|
||||
- `|!#` is used to add foreground color without any enforced brightness/normal information.
|
||||
These are normal-intensity and are thus always given as uppercase, such as
|
||||
`|!R` for red. The difference between e.g. `|!R` and `|R` is that
|
||||
- `|!#` is used to add foreground color without any enforced brightness/normal information.
|
||||
These are normal-intensity and are thus always given as uppercase, such as
|
||||
`|!R` for red. The difference between e.g. `|!R` and `|R` is that
|
||||
`|!R` will "inherit" the brightness setting from previously set color tags, whereas `|R` will
|
||||
always reset to the normal-intensity red. The `|#` format contains an implicit `|h`/`|H` tag in it:
|
||||
disabling highlighting when switching to a normal color, and enabling it for bright ones. So `|btest
|
||||
|
|
@ -67,7 +67,7 @@ set bright/normal explicitly. Technically, `|h|!G` is identical to `|g`.
|
|||
|
||||
> Note: The ANSI standard does not actually support bright backgrounds like `|[r` - the standard
|
||||
only supports "normal" intensity backgrounds. To get around this Evennia instead implements these
|
||||
as [Xterm256 colours](./TextTags#xterm256-colours) behind the scenes. If the client does not support
|
||||
as [Xterm256 colours](#xterm256-colours) behind the scenes. If the client does not support
|
||||
Xterm256 the ANSI colors will be used instead and there will be no visible difference between using
|
||||
upper- and lower-case background tags.
|
||||
|
||||
|
|
@ -83,11 +83,11 @@ ansi art that uses `|` with a letter directly following it.
|
|||
|
||||
Use the command
|
||||
|
||||
@color ansi
|
||||
@color ansi
|
||||
|
||||
to get a list of all supported ANSI colours and the tags used to produce them.
|
||||
|
||||
A few additional ANSI codes are supported:
|
||||
A few additional ANSI codes are supported:
|
||||
|
||||
- `|/` A line break. You cannot put the normal Python `\n` line breaks in text entered inside the
|
||||
game (Evennia will filter this for security reasons). This is what you use instead: use the `|/`
|
||||
|
|
@ -100,7 +100,7 @@ space.
|
|||
- `|*` This will invert the current text/background colours. Can be useful to mark things (but see
|
||||
below).
|
||||
|
||||
##### Caveats of `|*`
|
||||
### Caveats of `|*`
|
||||
|
||||
The `|*` tag (inverse video) is an old ANSI standard and should usually not be used for more than to
|
||||
mark short snippets of text. If combined with other tags it comes with a series of potentially
|
||||
|
|
@ -113,11 +113,11 @@ until you declare another tag. This is an example:
|
|||
Normal text, |*reversed text|*, still reversed text.
|
||||
```
|
||||
|
||||
that is, it will not reverse to normal at the second `|*`. You need to reset it manually:
|
||||
that is, it will not reverse to normal at the second `|*`. You need to reset it manually:
|
||||
|
||||
```
|
||||
Normal text, |*reversed text|n, normal again.
|
||||
```
|
||||
```
|
||||
|
||||
* The `|*` tag does not take "bright" colors into account:
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ four gray tones between solid black and white (`|000`, `|111`, `|222`, `|333` an
|
|||
- `|[=#` - this works in the same way but produces background gray scale tones.
|
||||
|
||||
If you have a client that supports Xterm256, you can use
|
||||
|
||||
|
||||
@color xterm256
|
||||
|
||||
to get a table of all the 256 colours and the codes that produce them. If the table looks broken up
|
||||
|
|
@ -178,6 +178,6 @@ to activate some features manually.
|
|||
|
||||
## More reading
|
||||
|
||||
There is an [Understanding Color Tags](../Howto/Understanding-Color-Tags) tutorial which expands on the
|
||||
There is an [Understanding Color Tags](../Howto/Understanding-Color-Tags.md) tutorial which expands on the
|
||||
use of ANSI color tags and the pitfalls of mixing ANSI and Xterms256 color tags in the same context.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
# Core Concepts
|
||||
|
||||
This documentation cover more over-arching concepts of Evennia, often involving many [Core Components](../Components/Components-Overview) acting together.
|
||||
This documentation cover more over-arching concepts of Evennia, often involving many [Core Components](../Components/Components-Overview.md) acting together.
|
||||
|
||||
## General concepts
|
||||
|
||||
- [Asynchronous processing](./Async-Process)
|
||||
- [On Soft-Code](./Soft-Code)
|
||||
- [Using MUX as standard for default commands](./Using-MUX-as-a-Standard)
|
||||
- [Asynchronous processing](./Async-Process.md)
|
||||
- [On Soft-Code](./Soft-Code.md)
|
||||
- [Using MUX as standard for default commands](./Using-MUX-as-a-Standard.md)
|
||||
|
||||
## Access
|
||||
|
||||
- [Multisession modes](./Multisession-modes)
|
||||
- [Permissions](./Building-Permissions)
|
||||
- [Banning](./Banning)
|
||||
- [Multisession modes](./Multisession-modes.md)
|
||||
- [Permissions](./Building-Permissions.md)
|
||||
- [Banning](./Banning.md)
|
||||
|
||||
## Extending the Server
|
||||
- [Custom Protocols](./Custom-Protocols)
|
||||
- [Bootstrap](./Bootstrap-&-Evennia)
|
||||
- [Creating new models](./New-Models)
|
||||
- [Custom Protocols](./Custom-Protocols.md)
|
||||
- [Bootstrap](./Bootstrap-&-Evennia.md)
|
||||
- [Creating new models](./New-Models.md)
|
||||
|
||||
## Text processing
|
||||
|
||||
- [Change the language of the server](./Internationalization)
|
||||
- [Server text-encoding](./Text-Encodings)
|
||||
- [Text tags](./TextTags)
|
||||
- [Change the language of the server](./Internationalization.md)
|
||||
- [Server text-encoding](./Text-Encodings.md)
|
||||
- [Text tags](./TextTags.md)
|
||||
|
||||
## Web features
|
||||
|
||||
- [Web features](./Web-Features)
|
||||
- [Web features](./Web-Features.md)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
their own custom client protocol.*
|
||||
|
||||
|
||||
A [PortalSession](../Components/Sessions#Portal-and-Server-Sessions) is the basic data object representing an
|
||||
A [PortalSession](../Components/Sessions.md#portal-and-server-sessions) is the basic data object representing an
|
||||
external
|
||||
connection to the Evennia [Portal](../Components/Portal-And-Server) -- usually a human player running a mud client
|
||||
connection to the Evennia [Portal](../Components/Portal-And-Server.md) -- usually a human player running a mud client
|
||||
of some kind. The way they connect (the language the player's client and Evennia use to talk to
|
||||
each other) is called the connection *Protocol*. The most common such protocol for MUD:s is the
|
||||
*Telnet* protocol. All Portal Sessions are stored and managed by the Portal's *sessionhandler*.
|
||||
|
|
@ -27,7 +27,7 @@ You <->
|
|||
InputFunc
|
||||
```
|
||||
|
||||
(See the [Message Path](./Messagepath) for the bigger picture of how data flows through Evennia). The
|
||||
(See the [Message Path](./Messagepath.md) for the bigger picture of how data flows through Evennia). The
|
||||
parts that needs to be customized to make your own custom protocol is the `Protocol + PortalSession`
|
||||
(which translates between data coming in/out over the wire to/from Evennia internal representation)
|
||||
as well as the `InputFunc` (which handles incoming data).
|
||||
|
|
@ -219,11 +219,11 @@ in our case means sending "foo" across the network.
|
|||
### Receiving data
|
||||
|
||||
Just because the protocol is there, does not mean Evennia knows what to do with it. An
|
||||
[Inputfunc](../Components/Inputfuncs) must exist to receive it. In the case of the `text` input exemplified above,
|
||||
[Inputfunc](../Components/Inputfuncs.md) must exist to receive it. In the case of the `text` input exemplified above,
|
||||
Evennia alredy handles this input - it will parse it as a Command name followed by its inputs. So
|
||||
handle that you need to simply add a cmdset with commands on your receiving Session (and/or the
|
||||
Object/Character it is puppeting). If not you may need to add your own Inputfunc (see the
|
||||
[Inputfunc](../Components/Inputfuncs) page for how to do this.
|
||||
[Inputfunc](../Components/Inputfuncs.md) page for how to do this.
|
||||
|
||||
These might not be as clear-cut in all protocols, but the principle is there. These four basic
|
||||
components - however they are accessed - links to the *Portal Session*, which is the actual common
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ Guest accounts are turned off by default. To activate, add this to your `game/se
|
|||
GUEST_ENABLED = True
|
||||
|
||||
Henceforth users can use `connect guest` (in the default command set) to login with a guest account.
|
||||
You may need to change your [Connection Screen](../Components/Connection-Screen) to inform them of this
|
||||
You may need to change your [Connection Screen](../Components/Connection-Screen.md) to inform them of this
|
||||
possibility. Guest accounts work differently from normal accounts - they are automatically *deleted*
|
||||
whenever the user logs off or the server resets (but not during a reload). They are literally re-
|
||||
usable throw-away accounts.
|
||||
|
||||
You can add a few more variables to your `settings.py` file to customize your guests:
|
||||
|
||||
- `BASE_GUEST_TYPECLASS` - the python-path to the default [typeclass](../Components/Typeclasses) for guests.
|
||||
- `BASE_GUEST_TYPECLASS` - the python-path to the default [typeclass](../Components/Typeclasses.md) for guests.
|
||||
Defaults to `"typeclasses.accounts.Guest"`.
|
||||
- `PERMISSION_GUEST_DEFAULT` - [permission level](../Components/Locks) for guest accounts. Defaults to `"Guests"`,
|
||||
- `PERMISSION_GUEST_DEFAULT` - [permission level](../Components/Locks.md) for guest accounts. Defaults to `"Guests"`,
|
||||
which is the lowest permission level in the hierarchy.
|
||||
- `GUEST_START_LOCATION` - the `#dbref` to the starting location newly logged-in guests should
|
||||
appear at. Defaults to `"#2` (Limbo).
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ depending on when a given language was last updated. Below are all languages
|
|||
(besides English) with some level of support. Generally, any language not
|
||||
updated after May 2021 will be missing some translations.
|
||||
|
||||
```eval_rst
|
||||
```{eval-rst}
|
||||
|
||||
+---------------+----------------------+--------------+
|
||||
| Language Code | Language | Last updated |
|
||||
|
|
@ -56,7 +56,7 @@ Here `'en'` (the default English) should be changed to the abbreviation for one
|
|||
of the supported languages found in `locale/` (and in the list above). Restart
|
||||
the server to activate i18n.
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
|
||||
Even for a 'fully translated' language you will still see English text
|
||||
in many places when you start Evennia. This is because we expect you (the
|
||||
|
|
@ -67,7 +67,7 @@ the server to activate i18n.
|
|||
|
||||
```
|
||||
|
||||
```sidebar:: Windows users
|
||||
```{sidebar} Windows users
|
||||
|
||||
If you get errors concerning `gettext` or `xgettext` on Windows,
|
||||
see the `Django documentation <https://docs.djangoproject.com/en/3.2/topics/i18n/translation/#gettext-on-windows>`_
|
||||
|
|
@ -88,7 +88,7 @@ translation bad ... You are welcome to help improve the situation!
|
|||
|
||||
To start a new translation you need to first have cloned the Evennia repositry
|
||||
with GIT and activated a python virtualenv as described on the
|
||||
[Setup Quickstart](../Setup/Setup-Quickstart) page.
|
||||
[Setup Quickstart](../Setup/Setup-Quickstart.md) page.
|
||||
|
||||
Go to `evennia/evennia/` - that is, not your game dir, but inside the `evennia/`
|
||||
repo itself. If you see the `locale/` folder you are in the right place. Make
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ The client sends data to Evennia in two ways.
|
|||
- When first connecting, the client can send data to the server about its
|
||||
capabilities. This is things like "I support xterm256 but not unicode" and is
|
||||
mainly used when a Telnet client connects. This is called a "handshake" and
|
||||
will generally set some flags on the [Portal Session](../Components/Portal-And-Server) that
|
||||
will generally set some flags on the [Portal Session](../Components/Portal-And-Server.md) that
|
||||
are later synced to the Server Session. Since this is not something the player
|
||||
controls, we'll not explore this further here.
|
||||
- The client can send an *inputcommand* to the server. Traditionally this only
|
||||
|
|
@ -34,7 +34,7 @@ The client sends data to Evennia in two ways.
|
|||
the client may send commands based on a timer or some trigger.
|
||||
|
||||
Exactly how the inputcommand looks when it travels from the client to Evennia
|
||||
depends on the [Protocol](./Custom-Protocols) used:
|
||||
depends on the [Protocol](./Custom-Protocols.md) used:
|
||||
- Telnet: A string. If GMCP or MSDP OOB protocols are used, this string will
|
||||
be formatted in a special way, but it's still a raw string. If Telnet SSL is
|
||||
active, the string will be encrypted.
|
||||
|
|
@ -73,7 +73,7 @@ it belongs. This is then sent over the AMP connection.
|
|||
### ServerSessionHandler (ingoing)
|
||||
|
||||
On the Server side, the AMP unpickles the data and associates the session id with the server-side
|
||||
[Session](../Components/Sessions). Data and Session are passed to the server-side `SessionHandler.data_in`. This
|
||||
[Session](../Components/Sessions.md). Data and Session are passed to the server-side `SessionHandler.data_in`. This
|
||||
in turn calls `ServerSession.data_in()`
|
||||
|
||||
### ServerSession (ingoing)
|
||||
|
|
@ -101,7 +101,7 @@ not found, an error will be raised.
|
|||
|
||||
### Inputfunc
|
||||
|
||||
The [Inputfunc](../Components/Inputfuncs) must be on the form `func(session, *args, **kwargs)`. An exception is
|
||||
The [Inputfunc](../Components/Inputfuncs.md) must be on the form `func(session, *args, **kwargs)`. An exception is
|
||||
the `default` inputfunc which has form `default(session, cmdname, *args, **kwargs)`, where `cmdname`
|
||||
is the un-matched inputcommand string.
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ In the *ServerSessionhandler*, the keywords from the `msg` method are collated i
|
|||
This will intelligently convert different input to the same form. So `msg("Hello")` will end up as
|
||||
an outputcommand `("text", ("Hello",), {})`.
|
||||
|
||||
This is also the point where [Inlinefuncs](./TextTags#inline-functions) are parsed, depending on the
|
||||
This is also the point where the [FuncParser](../Components/FuncParser.md)) is applied, depending on the
|
||||
session to receive the data. Said data is pickled together with the Session id then sent over the
|
||||
AMP bridge.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ sufficient for most use cases. But if you aim to build a large stand-alone syste
|
|||
your storage requirements into those may be more complex than you bargain for. Examples may be to
|
||||
store guild data for guild members to be able to change, tracking the flow of money across a game-
|
||||
wide economic system or implement other custom game systems that requires the storage of custom data
|
||||
in a quickly accessible way. Whereas [Tags](../Components/Tags) or [Scripts](../Components/Scripts) can handle many situations,
|
||||
in a quickly accessible way. Whereas [Tags](../Components/Tags.md) or [Scripts](../Components/Scripts.md) can handle many situations,
|
||||
sometimes things may be easier to handle by adding your own database model.
|
||||
|
||||
## Overview of database tables
|
||||
|
|
@ -81,7 +81,7 @@ you put `myapp` and don't forget the comma at the end of the tuple):
|
|||
evennia migrate
|
||||
|
||||
This will add your new database table to the database. If you have put your game under version
|
||||
control (if not, [you should](../Coding/Version-Control)), don't forget to `git add myapp/*` to add all items
|
||||
control (if not, [you should](../Coding/Version-Control.md)), don't forget to `git add myapp/*` to add all items
|
||||
to version control.
|
||||
|
||||
## Defining your models
|
||||
|
|
@ -113,7 +113,7 @@ We create four fields: two character fields of limited length and one text field
|
|||
maximum length. Finally we create a field containing the current time of us creating this object.
|
||||
|
||||
> The `db_date_created` field, with exactly this name, is *required* if you want to be able to store
|
||||
instances of your custom model in an Evennia [Attribute](../Components/Attributes). It will automatically be set
|
||||
instances of your custom model in an Evennia [Attribute](../Components/Attributes.md). It will automatically be set
|
||||
upon creation and can after that not be changed. Having this field will allow you to do e.g.
|
||||
`obj.db.myinstance = mydatastore`. If you know you'll never store your model instances in Attributes
|
||||
the `db_date_created` field is optional.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ window pane.
|
|||
## Briefly on input/outputcommands
|
||||
|
||||
Inside Evennia, all server-client communication happens in the same way (so plain text is also an
|
||||
'OOB message' as far as Evennia is concerned). The message follows the [Message Path](./Messagepath).
|
||||
'OOB message' as far as Evennia is concerned). The message follows the [Message Path](./Messagepath.md).
|
||||
You should read up on that if you are unfamiliar with it. As the message travels along the path it
|
||||
has a standardized internal form: a tuple with a string, a tuple and a dict:
|
||||
|
||||
|
|
@ -16,9 +16,9 @@ has a standardized internal form: a tuple with a string, a tuple and a dict:
|
|||
|
||||
This is often referred to as an *inputcommand* or *outputcommand*, depending on the direction it's
|
||||
traveling. The end point for an inputcommand, (the 'Evennia-end' of the message path) is a matching
|
||||
[Inputfunc](../Components/Inputfuncs). This function is called as `cmdname(session, *args, **kwargs)` where
|
||||
[Inputfunc](../Components/Inputfuncs.md). This function is called as `cmdname(session, *args, **kwargs)` where
|
||||
`session` is the Session-source of the command. Inputfuncs can easily be added by the developer to
|
||||
support/map client commands to actions inside Evennia (see the [inputfunc](../Components/Inputfuncs) page for more
|
||||
support/map client commands to actions inside Evennia (see the [inputfunc](../Components/Inputfuncs.md) page for more
|
||||
details).
|
||||
|
||||
When a message is outgoing (at the 'Client-end' of the message path) the outputcommand is handled by
|
||||
|
|
@ -26,7 +26,7 @@ a matching *Outputfunc*. This is responsible for converting the internal Evennia
|
|||
form suitable to send over the wire to the Client. Outputfuncs are hard-coded. Which is chosen and
|
||||
how it processes the outgoing data depends on the nature of the client it's connected to. The only
|
||||
time one would want to add new outputfuncs is as part of developing support for a new Evennia
|
||||
[Protocol](./Custom-Protocols).
|
||||
[Protocol](./Custom-Protocols.md).
|
||||
|
||||
## Sending and receiving an OOB message
|
||||
|
||||
|
|
@ -59,12 +59,12 @@ drop any other types of outputfuncs.
|
|||
you turn off telnet completely and only rely on the webclient, you should never rely on non-`text`
|
||||
OOB messages always reaching all targets.
|
||||
|
||||
[Inputfuncs](../Components/Inputfuncs) lists the default inputfuncs available to handle incoming OOB messages. To
|
||||
[Inputfuncs](../Components/Inputfuncs.md) lists the default inputfuncs available to handle incoming OOB messages. To
|
||||
accept more you need to add more inputfuncs (see that page for more info).
|
||||
|
||||
## Supported OOB protocols
|
||||
|
||||
Evennia supports clients using one of the following protocols:
|
||||
Evennia supports clients using one of the following protocols:
|
||||
|
||||
### Telnet
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ come `foo_bar`. To send a GMCP command that turns into an Evennia inputcommand w
|
|||
underscore, use the `Core` package. So `Core.Cmdname` becomes just `cmdname` in Evennia and vice
|
||||
versa.
|
||||
|
||||
On the wire, a GMCP instruction for `("cmdname", ("arg",), {})` will look like this:
|
||||
On the wire, a GMCP instruction for `("cmdname", ("arg",), {})` will look like this:
|
||||
|
||||
IAC SB GMCP "cmdname" "arg" IAC SE
|
||||
|
||||
|
|
@ -105,7 +105,6 @@ where all the capitalized words are telnet character constants specified in
|
|||
these in the listings below.
|
||||
|
||||
Input/Outputfunc | GMCP-Command
|
||||
------------------
|
||||
`[cmd_name, [], {}]` | Cmd.Name
|
||||
`[cmd_name, [arg], {}]` | Cmd.Name arg
|
||||
`[cmd_na_me, [args],{}]` | Cmd.Na.Me [args]
|
||||
|
|
@ -116,15 +115,14 @@ Since Evennia already supplies default inputfuncs that don't match the names exp
|
|||
common GMCP implementations we have a few hard-coded mappings for those:
|
||||
|
||||
GMCP command name | Input/Outputfunc name
|
||||
-----------------
|
||||
"Core.Hello" | "client_options"
|
||||
"Core.Supports.Get" | "client_options"
|
||||
"Core.Commands.Get" | "get_inputfuncs"
|
||||
"Core.Hello" | "client_options"
|
||||
"Core.Supports.Get" | "client_options"
|
||||
"Core.Commands.Get" | "get_inputfuncs"
|
||||
"Char.Value.Get" | "get_value"
|
||||
"Char.Repeat.Update" | "repeat"
|
||||
"Char.Monitor.Update" | "monitor"
|
||||
|
||||
#### Telnet + MSDP
|
||||
#### Telnet + MSDP
|
||||
|
||||
[MSDP](http://tintin.sourceforge.net/msdp/), the *Mud Server Data Protocol*, is a competing standard
|
||||
to GMCP. The MSDP protocol page specifies a range of "recommended" available MSDP command names.
|
||||
|
|
@ -143,7 +141,6 @@ The various available MSDP constants like `VAR` (variable), `VAL` (value), `ARRA
|
|||
and `TABLEOPEN`/`TABLECLOSE` are specified in `evennia/server/portal/telnet_oob`.
|
||||
|
||||
Outputfunc/Inputfunc | MSDP instruction
|
||||
-------------------------
|
||||
`[cmdname, [], {}]` | VAR cmdname VAL
|
||||
`[cmdname, [arg], {}]` | VAR cmdname VAL arg
|
||||
`[cmdname, [args],{}]` | VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
|
||||
|
|
@ -157,7 +154,7 @@ different `VAR ... VAL` (outside a table) will come out as a second, different c
|
|||
|
||||
### SSH
|
||||
|
||||
SSH only supports the `text` input/outputcommand.
|
||||
SSH only supports the `text` input/outputcommand.
|
||||
|
||||
### Web client
|
||||
|
||||
|
|
|
|||
|
|
@ -90,5 +90,5 @@ Adding advanced and flexible building commands to your game is easy and will pro
|
|||
satisfy most creative builders. However, if you really, *really* want to offer online coding, there
|
||||
is of course nothing stopping you from adding that to Evennia, no matter our recommendations. You
|
||||
could even re-implement MUX' softcode in Python should you be very ambitious. The
|
||||
[in-game-python](../Contribs/Dialogues-in-events) is an optional
|
||||
[in-game-python](../Contribs/Dialogues-in-events.md) is an optional
|
||||
pseudo-softcode plugin aimed at developers wanting to script their game from inside it.
|
||||
|
|
|
|||
|
|
@ -2,18 +2,19 @@
|
|||
|
||||
Evennia understands various extra information embedded in text:
|
||||
|
||||
- [Colors](./Colors) - Using `|r`, `|n` etc can be used to mark parts of text with a color. The color will
|
||||
- [Colors](./Colors.md) - Using `|r`, `|n` etc can be used to mark parts of text with a color. The color will
|
||||
become ANSI/XTerm256 color tags for Telnet connections and CSS information for the webclient.
|
||||
- [Clickable links](./Clickable-Links) - This allows you to provide a text the user can click to execute an
|
||||
- [Clickable links](./Clickable-Links.md) - This allows you to provide a text the user can click to execute an
|
||||
in-game command. This is on the form `|lc command |lt text |le`.
|
||||
- [FuncParser callables](../Components/FuncParser) - These are full-fledged function calls on the form `$funcname(args, kwargs)`
|
||||
- [FuncParser callables](../Components/FuncParser.md) - These are full-fledged function calls on the form `$funcname(args, kwargs)`
|
||||
that lead to calls to Python functions. The parser can be run with different available callables in different
|
||||
circumstances. The parser is run on all outgoing messages if `settings.FUNCPARSER_PARSE_OUTGOING_MESSAGES_ENABLED=True`
|
||||
(disabled by default).
|
||||
|
||||
```toctree::
|
||||
```{toctree}
|
||||
:hidden"
|
||||
|
||||
Colors.md
|
||||
Clickable-Links.md
|
||||
../Components/FuncParser.md
|
||||
Colors.md
|
||||
Clickable-Links.md
|
||||
../Components/FuncParser.md
|
||||
```
|
||||
|
|
@ -13,7 +13,7 @@ sets for administration and building.
|
|||
|
||||
Evennia is *not* a MUX system though. It works very differently in many ways. For example, Evennia
|
||||
deliberately lacks an online softcode language (a policy explained on our [softcode policy
|
||||
page](Soft-Code)). Evennia also does not shy from using its own syntax when deemed appropriate: the
|
||||
page](./Soft-Code.md)). Evennia also does not shy from using its own syntax when deemed appropriate: the
|
||||
MUX syntax has grown organically over a long time and is, frankly, rather arcane in places. All in
|
||||
all the default command syntax should at most be referred to as "MUX-like" or "MUX-inspired".
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Example: To override or modify `evennia/web/website/template/website/index.html`
|
|||
add/modify `mygame/web/template_overrides/website/index.html`.
|
||||
|
||||
The detailed description on how to customize the website is best described in tutorial form. See the
|
||||
[Web Tutorial](../Howto/Starting/Part5/Web-Tutorial) for more information.
|
||||
[Web Tutorial](../Howto/Starting/Part5/Web-Tutorial.md) for more information.
|
||||
|
||||
### Overloading Django views
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ you will also log all requests in `mygame/server/logs/http_requests.log`.
|
|||
|
||||
Evennia comes with a MUD client accessible from a normal web browser. During
|
||||
development you can try it at `http://localhost:4001/webclient`.
|
||||
[See the Webclient page](../Components/Webclient) for more details.
|
||||
[See the Webclient page](../Components/Webclient.md) for more details.
|
||||
|
||||
|
||||
## The Django 'Admin' Page
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Many MUD codebases hardcode zones as part of the engine and database. Evennia d
|
|||
distinction due to the fact that rooms themselves are meant to be customized to any level anyway.
|
||||
Below is a suggestion for how to implement zones in Evennia.
|
||||
|
||||
All objects in Evennia can hold any number of [Tags](../Components/Tags). Tags are short labels that you attach to
|
||||
All objects in Evennia can hold any number of [Tags](../Components/Tags.md). Tags are short labels that you attach to
|
||||
objects. They make it very easy to retrieve groups of objects. An object can have any number of
|
||||
different tags. So let's attach the relevant tag to our forest:
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ Henceforth you can then easily retrieve only objects with a given tag:
|
|||
|
||||
The tagging or aliasing systems above don't instill any sort of functional difference between a
|
||||
magical forest room and a normal one - they are just arbitrary ways to mark objects for quick
|
||||
retrieval later. Any functional differences must be expressed using [Typeclasses](../Components/Typeclasses).
|
||||
retrieval later. Any functional differences must be expressed using [Typeclasses](../Components/Typeclasses.md).
|
||||
|
||||
Of course, an alternative way to implement zones themselves is to have all rooms/objects in a zone
|
||||
inherit from a given typeclass parent - and then limit your searches to objects inheriting from that
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# A voice operated elevator using events
|
||||
|
||||
|
||||
- Previous tutorial: [Adding dialogues in events](./Dialogues-in-events)
|
||||
- Previous tutorial: [Adding dialogues in events](./Dialogues-in-events.md)
|
||||
|
||||
This tutorial will walk you through the steps to create a voice-operated elevator, using the [in-
|
||||
game Python
|
||||
|
|
@ -97,7 +97,7 @@ things to decorate it a bit.
|
|||
But what we want now is to be able to say "1", "2" or "3" and have the elevator move in that
|
||||
direction.
|
||||
|
||||
If you have read [the previous tutorial about adding dialogues in events](./Dialogues-in-events), you
|
||||
If you have read [the previous tutorial about adding dialogues in events](./Dialogues-in-events.md), you
|
||||
may remember what we need to do. If not, here's a summary: we need to run some code when somebody
|
||||
speaks in the room. So we need to create a callback (the callback will contain our lines of code).
|
||||
We just need to know on which event this should be set. You can enter `call here` to see the
|
||||
|
|
@ -433,4 +433,4 @@ to consider adding the code in the source itself. Another possibility is to cal
|
|||
with the expected behavior, which makes porting code very easy. This side of chained events will be
|
||||
shown in the next tutorial.
|
||||
|
||||
- Previous tutorial: [Adding dialogues in events](./Dialogues-in-events)
|
||||
- Previous tutorial: [Adding dialogues in events](./Dialogues-in-events.md)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Arxcode installing help
|
||||
|
||||
## Introduction
|
||||
## Introduction
|
||||
|
||||
[Arx - After the Reckoning](https://play.arxmush.org/) is a big and very popular
|
||||
[Evennia](https://www.evennia.com)-based game. Arx is heavily roleplaying-centric, relying on game
|
||||
|
|
@ -10,20 +10,20 @@ Arx on github](https://github.com/Arx-Game/arxcode). This is a treasure-trove fo
|
|||
to pick ideas or even get a starting game to build on. These instructions are based on the Arx-code
|
||||
released as of *Aug 12, 2018*.
|
||||
|
||||
If you are not familiar with what Evennia is, you can read
|
||||
[an introduction here](../Evennia-Introduction).
|
||||
If you are not familiar with what Evennia is, you can read
|
||||
[an introduction here](../Evennia-Introduction.md).
|
||||
|
||||
It's not too hard to run Arx from the sources (of course you'll start with an empty database) but
|
||||
since part of Arx has grown organically, it doesn't follow standard Evennia paradigms everywhere.
|
||||
This page covers one take on installing and setting things up while making your new Arx-based game
|
||||
better match with the vanilla Evennia install.
|
||||
better match with the vanilla Evennia install.
|
||||
|
||||
## Installing Evennia
|
||||
|
||||
Firstly, set aside a folder/directory on your drive for everything to follow.
|
||||
Firstly, set aside a folder/directory on your drive for everything to follow.
|
||||
|
||||
You need to start by installing [Evennia](https://www.evennia.com) by following most of the
|
||||
[Getting Started Instructions](../Setup/Setup-Quickstart) for your OS. The difference is that you need to `git clone
|
||||
You need to start by installing [Evennia](https://www.evennia.com) by following most of the
|
||||
[Getting Started Instructions](../Setup/Setup-Quickstart.md) for your OS. The difference is that you need to `git clone
|
||||
https://github.com/TehomCD/evennia.git` instead of Evennia's repo because Arx uses TehomCD's older
|
||||
Evennia 0.8 [fork](https://github.com/TehomCD/evennia), notably still using Python2. This detail is
|
||||
important if referring to newer Evennia documentation.
|
||||
|
|
@ -31,10 +31,10 @@ important if referring to newer Evennia documentation.
|
|||
If you are new to Evennia it's *highly* recommended that you run through the
|
||||
instructions in full - including initializing and starting a new empty game and connecting to it.
|
||||
That way you can be sure Evennia works correctly as a base line. If you have trouble, make sure to
|
||||
read the [Troubleshooting instructions](./Getting-Started#troubleshooting) for your
|
||||
read the [Troubleshooting instructions](../Setup/Extended-Installation.md#troubleshooting) for your
|
||||
operating system. You can also drop into our
|
||||
[forums](https://groups.google.com/forum/#%21forum/evennia), join `#evennia` on `irc.freenode.net`
|
||||
or chat from the linked [Discord Server](https://discord.gg/NecFePw).
|
||||
or chat from the linked [Discord Server](https://discord.gg/NecFePw).
|
||||
|
||||
After installing you should have a `virtualenv` running and you should have the following file
|
||||
structure in your set-aside folder:
|
||||
|
|
@ -49,35 +49,35 @@ mygame/
|
|||
Here `mygame` is the empty game you created during the Evennia install, with `evennia --init`. Go to
|
||||
that and run `evennia stop` to make sure your empty game is not running. We'll instead let Evenna
|
||||
run Arx, so in principle you could erase `mygame` - but it could also be good to have a clean game
|
||||
to compare to.
|
||||
to compare to.
|
||||
|
||||
## Installing Arxcode
|
||||
|
||||
### Clone the arxcode repo
|
||||
|
||||
Cd to the root of your directory and clone the released source code from github:
|
||||
Cd to the root of your directory and clone the released source code from github:
|
||||
|
||||
git clone https://github.com/Arx-Game/arxcode.git myarx
|
||||
git clone https://github.com/Arx-Game/arxcode.git myarx
|
||||
|
||||
A new folder `myarx` should appear next to the ones you already had. You could rename this to
|
||||
something else if you want.
|
||||
something else if you want.
|
||||
|
||||
Cd into `myarx`. If you wonder about the structure of the game dir, you can
|
||||
[read more about it here](../Howto/Starting/Part1/Gamedir-Overview).
|
||||
Cd into `myarx`. If you wonder about the structure of the game dir, you can
|
||||
[read more about it here](../Howto/Starting/Part1/Gamedir-Overview.md).
|
||||
|
||||
### Clean up settings
|
||||
|
||||
Arx has split evennia's normal settings into `base_settings.py` and `production_settings.py`. It
|
||||
also has its own solution for managing 'secret' parts of the settings file. We'll keep most of Arx
|
||||
way but remove the secret-handling and replace it with the normal Evennia method.
|
||||
way but remove the secret-handling and replace it with the normal Evennia method.
|
||||
|
||||
Cd into `myarx/server/conf/` and open the file `settings.py` in a text editor. The top part (within
|
||||
`"""..."""`) is just help text. Wipe everything underneath that and make it look like this instead
|
||||
(don't forget to save):
|
||||
(don't forget to save):
|
||||
|
||||
```
|
||||
from base_settings import *
|
||||
|
||||
|
||||
TELNET_PORTS = [4000]
|
||||
SERVERNAME = "MyArx"
|
||||
GAME_SLOGAN = "The cool game"
|
||||
|
|
@ -97,7 +97,7 @@ the game a name. The slogan changes the sub-text shown under the name of your ga
|
|||
header. You can tweak these to your own liking later.
|
||||
|
||||
Next, create a new, empty file `secret_settings.py` in the same location as the `settings.py` file.
|
||||
This can just contain the following:
|
||||
This can just contain the following:
|
||||
|
||||
```python
|
||||
SECRET_KEY = "sefsefiwwj3 jnwidufhjw4545_oifej whewiu hwejfpoiwjrpw09&4er43233fwefwfw"
|
||||
|
|
@ -105,35 +105,35 @@ SECRET_KEY = "sefsefiwwj3 jnwidufhjw4545_oifej whewiu hwejfpoiwjrpw09&4er43233fw
|
|||
```
|
||||
|
||||
Replace the long random string with random ASCII characters of your own. The secret key should not
|
||||
be shared.
|
||||
be shared.
|
||||
|
||||
Next, open `myarx/server/conf/base_settings.py` in your text editor. We want to remove/comment out
|
||||
all mentions of the `decouple` package, which Evennia doesn't use (we use `private_settings.py` to
|
||||
hide away settings that should not be shared).
|
||||
hide away settings that should not be shared).
|
||||
|
||||
Comment out `from decouple import config` by adding a `#` to the start of the line: `# from decouple
|
||||
import config`. Then search for `config(` in the file and comment out all lines where this is used.
|
||||
Many of these are specific to the server environment where the original Arx runs, so is not that
|
||||
relevant to us.
|
||||
relevant to us.
|
||||
|
||||
### Install Arx dependencies
|
||||
### Install Arx dependencies
|
||||
|
||||
Arx has some further dependencies beyond vanilla Evennia. Start by `cd`:ing to the root of your
|
||||
`myarx` folder.
|
||||
`myarx` folder.
|
||||
|
||||
> If you run *Linux* or *Mac*: Edit `myarx/requirements.txt` and comment out the line
|
||||
> `pypiwin32==219` - it's only needed on Windows and will give an error on other platforms.
|
||||
> `pypiwin32==219` - it's only needed on Windows and will give an error on other platforms.
|
||||
|
||||
Make sure your `virtualenv` is active, then run
|
||||
|
||||
pip install -r requirements.txt
|
||||
|
||||
The needed Python packages will be installed for you.
|
||||
The needed Python packages will be installed for you.
|
||||
|
||||
### Adding logs/ folder
|
||||
|
||||
The Arx repo does not contain the `myarx/server/logs/` folder Evennia expects for storing server
|
||||
logs. This is simple to add:
|
||||
logs. This is simple to add:
|
||||
|
||||
# linux/mac
|
||||
mkdir server/logs
|
||||
|
|
@ -142,7 +142,7 @@ logs. This is simple to add:
|
|||
|
||||
### Setting up the database and starting
|
||||
|
||||
From the `myarx` folder, run
|
||||
From the `myarx` folder, run
|
||||
|
||||
evennia migrate
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ This creates the database and will step through all database migrations needed.
|
|||
If all goes well Evennia will now start up, running Arx! You can connect to it on `localhost` (or
|
||||
`127.0.0.1` if your platform doesn't alias `localhost`), port `4000` using a Telnet client.
|
||||
Alternatively, you can use your web browser to browse to `http://localhost:4001` to see the game's
|
||||
website and get to the web client.
|
||||
website and get to the web client.
|
||||
|
||||
When you log in you'll get the standard Evennia greeting (since the database is empty), but you can
|
||||
try `help` to see that it's indeed Arx that is running.
|
||||
|
|
@ -164,7 +164,7 @@ The first time you start Evennia after creating the database with the `evennia m
|
|||
it should create a few starting objects for you - your superuser account, which it will prompt you
|
||||
to enter, a starting room (Limbo), and a character object for you. If for some reason this does not
|
||||
occur, you may have to follow the steps below. For the first time Superuser login you may have to
|
||||
run steps 7-8 and 10 to create and connect to your in-came Character.
|
||||
run steps 7-8 and 10 to create and connect to your in-came Character.
|
||||
|
||||
1. Login to the game website with your Superuser account.
|
||||
2. Press the `Admin` button to get into the (Django-) Admin Interface.
|
||||
|
|
@ -172,17 +172,17 @@ run steps 7-8 and 10 to create and connect to your in-came Character.
|
|||
4. Add a new Account named for the new staffer. Use a place holder password and dummy e-mail
|
||||
address.
|
||||
5. Flag account as `Staff` and apply the `Admin` permission group (This assumes you have already set
|
||||
up an Admin Group in Django).
|
||||
6. Add Tags named `player` and `developer`.
|
||||
up an Admin Group in Django).
|
||||
6. Add Tags named `player` and `developer`.
|
||||
7. Log into the game using the web client (or a third-party telnet client) using your superuser
|
||||
account. Move to where you want the new staffer character to appear.
|
||||
account. Move to where you want the new staffer character to appear.
|
||||
8. In the game client, run `@create/drop <staffername>:typeclasses.characters.Character`, where
|
||||
`<staffername>` is usually the same name you used for the Staffer account you created in the
|
||||
Admin earlier (if you are creating a Character for your superuser, use your superuser account
|
||||
name).
|
||||
This creates a new in-game Character and places it in your current location.
|
||||
9. Have the new Admin player log into the game.
|
||||
10. Have the new Admin puppet the character with `@ic StafferName`.
|
||||
10. Have the new Admin puppet the character with `@ic StafferName`.
|
||||
11. Have the new Admin change their password - `@password <old password> = <new password>`.
|
||||
|
||||
Now that you have a Character and an Account object, there's a few additional things you may need to
|
||||
|
|
@ -225,14 +225,14 @@ cd Source
|
|||
mkdir Arx
|
||||
cd Arx
|
||||
|
||||
Replace the SSH git clone links below with your own github forks.
|
||||
If you don't plan to change Evennia at all, you can use the
|
||||
Replace the SSH git clone links below with your own github forks.
|
||||
If you don't plan to change Evennia at all, you can use the
|
||||
evennia/evennia.git repo instead of a forked one.
|
||||
|
||||
git clone git@github.com:<youruser>/evennia.git
|
||||
git clone git@github.com:<youruser>/arxcode.git
|
||||
|
||||
Evennia is a package itself, so we want to install it and all of its
|
||||
Evennia is a package itself, so we want to install it and all of its
|
||||
prerequisites, after switching to the appropriately-tagged branch for
|
||||
Arxcode.
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ cd ../arxcode
|
|||
pip install -r requirements.txt
|
||||
|
||||
The git repo doesn't include the empty log directory and Evennia is unhappy if you
|
||||
don't have it, so while still in the arxcode directory...
|
||||
don't have it, so while still in the arxcode directory...
|
||||
|
||||
mkdir server/logs
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Contrib modules
|
||||
|
||||
Contribs are found in [evennia/contrib/](api:evennia.contrib) and are optional game-specific code-snippets
|
||||
Contribs are found in [evennia/contrib/](evennia.contrib) and are optional game-specific code-snippets
|
||||
or even full systems you can use for your game. They are contributed by the Evennia community and
|
||||
released under the same license as Evennia itself. Each contrib has its own installation instructions.
|
||||
Bugs are reported to the Evennia [issue tracker](github:issue) as usual.
|
||||
|
|
@ -46,7 +46,7 @@ Contribs modifying locations, movement or helping to creating rooms.
|
|||
Adds an XYZgrid to Evennia, with map-display and pathfinding. Created via map
|
||||
strings and maintained outside of the game via Evennia launch commands.
|
||||
|
||||
- [XYZGrid documentation](./XYZGrid)
|
||||
- [XYZGrid documentation](./XYZGrid.md)
|
||||
|
||||
### Extended Room
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ An expanded Room typeclass with multiple descriptions for time and season as wel
|
|||
|
||||
Build a game area based on a 2D "graphical" unicode map. Supports asymmetric exits.
|
||||
|
||||
- [Static in-game map](./Static-In-Game-Map)
|
||||
- [Static in-game map](./Static-In-Game-Map.md)
|
||||
|
||||
### Simple Door
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ Custom Exit class that takes different time to pass depending on if you are walk
|
|||
|
||||
Make infinitely large wilderness areas with dynamically created locations.
|
||||
|
||||
- [Dynamic in-game map](./Dynamic-In-Game-Map)
|
||||
- [Dynamic in-game map](./Dynamic-In-Game-Map.md)
|
||||
|
||||
----
|
||||
|
||||
|
|
@ -100,9 +100,9 @@ A safe and effective barter-system for any game. Allows safe trading of any good
|
|||
|
||||
A full, extendable crafting system.
|
||||
|
||||
- [Crafting overview](./Crafting)
|
||||
- [Crafting API documentation](api:evennia.contrib.crafting.crafting)
|
||||
- [Example of a sword crafting tree](api:evennia.contrib.crafting.example_recipes)
|
||||
- [Crafting overview](./Crafting.md)
|
||||
- [Crafting API documentation](evennia.contrib.crafting.crafting)
|
||||
- [Example of a sword crafting tree](evennia.contrib.crafting.example_recipes)
|
||||
|
||||
### Dice
|
||||
|
||||
|
|
@ -174,15 +174,15 @@ A simple system for creating an EvMenu that presents a player with a highly cust
|
|||
|
||||
Allow Builders to add Python-scripted events to their objects (OBS-not for untrusted users!)
|
||||
|
||||
- [A voice-operated elevator using events](./A-voice-operated-elevator-using-events)
|
||||
- [Dialogues using events](./Dialogues-in-events)
|
||||
- [A voice-operated elevator using events](./A-voice-operated-elevator-using-events.md)
|
||||
- [Dialogues using events](./Dialogues-in-events.md)
|
||||
|
||||
### Menu-builder
|
||||
|
||||
A tool for building using an in-game menu instead of the normal build commands. Meant to
|
||||
be expanded for the needs of your game.
|
||||
|
||||
- [Building Menus](./Building-menus)
|
||||
- [Building Menus](./Building-menus.md)
|
||||
|
||||
### Security/Auditing
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ A folder of basic example objects, commands and scripts.
|
|||
|
||||
The Evennia single-player sole quest. Made to be analyzed to learn.
|
||||
|
||||
- [The tutorial world introduction](../Howto/Starting/Part1/Tutorial-World-Introduction)
|
||||
- [The tutorial world introduction](../Howto/Starting/Part1/Tutorial-World-Introduction.md)
|
||||
|
||||
----
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ is maintained by Tehom in its own repository so bug reports should be directed t
|
|||
|
||||
- [Arxcode repository on github](https://github.com/Arx-Game/arxcode)
|
||||
- [Arxcode issue tracker](https://github.com/Arx-Game/arxcode/issues)
|
||||
- [Arxcode installation help](./Arxcode-installing-help) - this may not always be fully up-to-date with
|
||||
- [Arxcode installation help](./Arxcode-installing-help.md) - this may not always be fully up-to-date with
|
||||
latest Evennia. Report your findings!
|
||||
|
||||
### Evscaperoom
|
||||
|
|
@ -310,7 +310,7 @@ is maintained by Tehom in its own repository so bug reports should be directed t
|
|||
A full engine for making multiplayer 'escape-rooms' completely in code.
|
||||
This is based on the 2019 MUD Game jam winner *Evscaperoom*.
|
||||
|
||||
- [contrib/evscaperoom](api:evennia.contrib.evscaperoom) - game engine to make your own escape rooms.
|
||||
- [contrib/evscaperoom](evennia.contrib.evscaperoom) - game engine to make your own escape rooms.
|
||||
- [https://demo.evennia.com](https://demo.evennia.com) - a full installation of the original game can
|
||||
be played by entering the *evscaperoom* exit in the first Limbo room.
|
||||
- https://github.com/Griatch/evscaperoom - the original game's source code (warning for spoilers if you
|
||||
|
|
@ -319,17 +319,17 @@ This is based on the 2019 MUD Game jam winner *Evscaperoom*.
|
|||
|
||||
|
||||
|
||||
```toctree::
|
||||
:hidden:
|
||||
```{toctree}
|
||||
:hidden:
|
||||
|
||||
./Crafting
|
||||
../api/evennia.contrib.crafting.crafting
|
||||
../api/evennia.contrib.crafting.example_recipes
|
||||
./A-voice-operated-elevator-using-events
|
||||
./Dialogues-in-events
|
||||
./Dynamic-In-Game-Map
|
||||
./Static-In-Game-Map
|
||||
../Howto/Starting/Part1/Tutorial-World-Introduction
|
||||
./Building-menus
|
||||
./Crafting
|
||||
../api/evennia.contrib.crafting.crafting
|
||||
../api/evennia.contrib.crafting.example_recipes
|
||||
./A-voice-operated-elevator-using-events
|
||||
./Dialogues-in-events
|
||||
./Dynamic-In-Game-Map
|
||||
./Static-In-Game-Map
|
||||
../Howto/Starting/Part1/Tutorial-World-Introduction
|
||||
./Building-menus
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
# Crafting system contrib
|
||||
|
||||
_Contrib by Griatch 2020_
|
||||
```versionadded:: 1.0
|
||||
```{versionadded} 1.0
|
||||
```
|
||||
|
||||
This contrib implements a full Crafting system that can be expanded and modified to fit your game.
|
||||
|
||||
- See the [evennia/contrib/crafting/crafting.py API](api:evennia.contrib.crafting.crafting) for installation
|
||||
- See the [evennia/contrib/crafting/crafting.py API](evennia.contrib.crafting.crafting) for installation
|
||||
instructrions.
|
||||
- See the [sword example](api:evennia.contrib.crafting.example_recipes) for an example of how to design
|
||||
- See the [sword example](evennia.contrib.crafting.example_recipes) for an example of how to design
|
||||
a crafting tree for crafting a sword from base elements.
|
||||
|
||||
From in-game it uses the new `craft` command:
|
||||
|
|
@ -45,7 +45,7 @@ result = craft(caller, "recipename", *inputs)
|
|||
|
||||
```
|
||||
Here, `caller` is the one doing the crafting and `*inputs` is any combination of consumables and/or tool
|
||||
Objects. The system will identify which is which by the [Tags](../Components/Tags) on them (see below)
|
||||
Objects. The system will identify which is which by the [Tags](../Components/Tags.md) on them (see below)
|
||||
The `result` is always a list.
|
||||
|
||||
## Adding new recipes
|
||||
|
|
@ -84,7 +84,7 @@ class WoodenPuppetRecipe(CraftingRecipe):
|
|||
|
||||
```
|
||||
|
||||
This specifies which tags to look for in the inputs. It defines a [Prototype](../Components/Prototypes)
|
||||
This specifies which tags to look for in the inputs. It defines a [Prototype](../Components/Prototypes.md)
|
||||
for the recipe to use to spawn the result on the fly (a recipe could spawn more than one result if needed).
|
||||
Instead of specifying the full prototype-dict, you could also just provide a list of `prototype_key`s to
|
||||
existing prototypes you have.
|
||||
|
|
@ -93,7 +93,7 @@ After reloading the server, this recipe would now be available to use. To try it
|
|||
create materials and tools to insert into the recipe.
|
||||
|
||||
|
||||
The recipe analyzes inputs, looking for [Tags](../Components/Tags) with specific tag-categories.
|
||||
The recipe analyzes inputs, looking for [Tags](../Components/Tags.md) with specific tag-categories.
|
||||
The tag-category used can be set per-recipe using the (`.consumable_tag_category` and
|
||||
`.tool_tag_category` respectively). The defaults are `crafting_material` and `crafting_tool`. For
|
||||
the puppet we need one object with the `wood` tag and another with the `knife` tag:
|
||||
|
|
@ -152,7 +152,7 @@ in `settings.CRAFTING_RECIPE_MODULES`.
|
|||
|
||||
Even without modifying more than the class properties, there are a lot of options to set on
|
||||
the `CraftingRecipe` class. Easiest is to refer to the
|
||||
[CraftingRecipe api documentation](evennia.contrib.crafting.crafting.html#evennia.contrib.crafting.crafting.CraftingRecipe).
|
||||
[CraftingRecipe api documentation](evennia.contrib.crafting.crafting.CraftingRecipe).
|
||||
For example, you can customize the validation-error messages, decide if the ingredients have
|
||||
to be exactly right, if a failure still consumes the ingredients or not, and much more.
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ if we succed. We would of course make this a lot more immersive and detailed in
|
|||
principle you could customize each recipe just the way you want it, but you could also inherit from
|
||||
a central parent like this to cut down on work.
|
||||
|
||||
The [sword recipe example module](api:evennia.contrib.crafting.example_recipes) also shows an example
|
||||
The [sword recipe example module](evennia.contrib.crafting.example_recipes) also shows an example
|
||||
of a random skill-check being implemented in a parent and then inherited for multiple use.
|
||||
|
||||
## Even more customization
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
## Introduction
|
||||
|
||||
An often desired feature in a MUD is to show an in-game map to help navigation. The [Static in-game
|
||||
map](Static-In-Game-Map) tutorial solves this by creating a *static* map, meaning the map is pre-
|
||||
map](./Static-In-Game-Map.md) tutorial solves this by creating a *static* map, meaning the map is pre-
|
||||
drawn once and for all - the rooms are then created to match that map. When walking around, parts of
|
||||
the static map is then cut out and displayed next to the room description.
|
||||
|
||||
|
|
@ -20,9 +20,9 @@ world to be 'logically' impossible with rooms looping to themselves or exits lea
|
|||
side of the map. Exits can also be named anything, from "jumping out the window" to "into the fifth
|
||||
dimension". This tutorial assumes you can only move in the cardinal directions (N, E, S and W).
|
||||
2. Rooms must be connected and linked together for the map to be generated correctly. Vanilla
|
||||
Evennia comes with a admin command [@tunnel](../Components/Default-Command-Help#tunnel-cmdtunnel) that allows a
|
||||
Evennia comes with a admin command [tunnel](evennia.commands.default.building.CmdTunnel) that allows a
|
||||
user to create rooms in the cardinal directions, but additional work is needed to assure that rooms
|
||||
are connected. For example, if you `@tunnel east` and then immediately do `@tunnel west` you'll find
|
||||
are connected. For example, if you `tunnel east` and then immediately do `tunnel west` you'll find
|
||||
that you have created two completely stand-alone rooms. So care is needed if you want to create a
|
||||
"logical" layout. In this tutorial we assume you have such a grid of rooms that we can generate the
|
||||
map from.
|
||||
|
|
@ -361,7 +361,7 @@ looping rooms that will show on your in-game map.
|
|||
|
||||
The above example will display the map above the room description. You could also use an
|
||||
[EvTable](github:evennia.utils.evtable) to place description and map next to each other. Some other
|
||||
things you can do is to have a [Command](../Components/Commands) that displays with a larger radius, maybe with a
|
||||
things you can do is to have a [Command](../Components/Commands.md) that displays with a larger radius, maybe with a
|
||||
legend and other features.
|
||||
|
||||
Below is the whole `map.py` for your reference. You need to update your `Room` typeclass (see above)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
## Introduction
|
||||
|
||||
This tutorial describes the creation of an in-game map display based on a pre-drawn map. It also
|
||||
details how to use the [Batch code processor](../Components/Batch-Code-Processor) for advanced building. There is
|
||||
also the [Dynamic in-game map tutorial](./Dynamic-In-Game-Map) that works in the opposite direction,
|
||||
details how to use the [Batch code processor](../Components/Batch-Code-Processor.md) for advanced building. There is
|
||||
also the [Dynamic in-game map tutorial](./Dynamic-In-Game-Map.md) that works in the opposite direction,
|
||||
by generating a map from an existing grid of rooms.
|
||||
|
||||
Evennia does not require its rooms to be positioned in a "logical" way. Your exits could be named
|
||||
|
|
@ -41,7 +41,7 @@ map we designed before.
|
|||
```
|
||||
|
||||
We will henceforth assume your game folder is name named `mygame` and that you haven't modified the
|
||||
default commands. We will also not be using [Colors](../Concepts/TextTags#colored-text) for our map since they
|
||||
default commands. We will also not be using [Colors](../Concepts/Colors.md) for our map since they
|
||||
don't show in the documentation wiki.
|
||||
|
||||
## Planning the Map
|
||||
|
|
@ -83,23 +83,23 @@ planning at this stage can solve many problems before they happen.
|
|||
In this section we will try to create an actual "map" object that an account can pick up and look
|
||||
at.
|
||||
|
||||
Evennia offers a range of [default commands](api:evennia.commands.default#modules) for
|
||||
[creating objects and rooms in-game](../Howto/Starting/Part1/Building-Quickstart). While readily accessible, these commands are made to do very
|
||||
Evennia offers a range of [default commands](../Components/Default-Commands.md) for
|
||||
[creating objects and rooms in-game](../Howto/Starting/Part1/Building-Quickstart.md). While readily accessible, these commands are made to do very
|
||||
specific, restricted things and will thus not offer as much flexibility to experiment (for an
|
||||
advanced exception see [in-line functions](../Concepts/TextTags#new-inlinefuncs)). Additionally, entering long
|
||||
advanced exception see [the FuncParser](../Components/FuncParser.md)). Additionally, entering long
|
||||
descriptions and properties over and over in the game client can become tedious; especially when
|
||||
testing and you may want to delete and recreate things over and over.
|
||||
|
||||
To overcome this, Evennia offers [batch processors](../Components/Batch-Processors) that work as input-files
|
||||
To overcome this, Evennia offers [batch processors](../Components/Batch-Processors.md) that work as input-files
|
||||
created out-of-game. In this tutorial we'll be using the more powerful of the two available batch
|
||||
processors, the [Batch Code Processor ](../Components/Batch-Code-Processor), called with the `@batchcode` command.
|
||||
processors, the [Batch Code Processor ](../Components/Batch-Code-Processor.md), called with the `@batchcode` command.
|
||||
This is a very powerful tool. It allows you to craft Python files to act as blueprints of your
|
||||
entire game world. These files have access to use Evennia's Python API directly. Batchcode allows
|
||||
for easy editing and creation in whatever text editor you prefer, avoiding having to manually build
|
||||
the world line-by-line inside the game.
|
||||
|
||||
> Important warning: `@batchcode`'s power is only rivaled by the `@py` command. Batchcode is so
|
||||
powerful it should be reserved only for the [superuser](../Concepts/Building-Permissions). Think carefully
|
||||
powerful it should be reserved only for the [superuser](../Concepts/Building-Permissions.md). Think carefully
|
||||
before you let others (such as `Developer`- level staff) run `@batchcode` on their own - make sure
|
||||
you are okay with them running *arbitrary Python code* on your server.
|
||||
|
||||
|
|
@ -412,5 +412,5 @@ easily new game defining features can be added to Evennia.
|
|||
|
||||
You can easily build from this tutorial by expanding the map and creating more rooms to explore. Why
|
||||
not add more features to your game by trying other tutorials: [Add weather to your world](Weather-
|
||||
Tutorial), [fill your world with NPC's](../Howto/Tutorial-Aggressive-NPCs) or
|
||||
[implement a combat system](../Howto/Starting/Part3/Turn-based-Combat-System).
|
||||
Tutorial), [fill your world with NPC's](../Howto/Tutorial-Aggressive-NPCs.md) or
|
||||
[implement a combat system](../Howto/Starting/Part3/Turn-based-Combat-System.md).
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# XYZGrid contrib
|
||||
|
||||
```versionadded:: 1.0
|
||||
```{versionadded} 1.0
|
||||
```
|
||||
|
||||
This optional contrib adds a 'coordinate grid' to Evennia. It allows for
|
||||
|
|
@ -66,7 +66,7 @@ Exits: northeast and east
|
|||
available for use as prototype-parents when spawning the grid.
|
||||
4. Run `evennia xyzgrid help` for available options.
|
||||
5. (Optional): By default, the xyzgrid will only spawn module-based
|
||||
[prototypes](../Components/Prototypes). This is an optimization and usually makes sense
|
||||
[prototypes](../Components/Prototypes.md). This is an optimization and usually makes sense
|
||||
since the grid is entirely defined outside the game anyway. If you want to
|
||||
also make use of in-game (db-) created prototypes, add
|
||||
`XYZGRID_USE_DB_PROTOTYPES = True` to settings.
|
||||
|
|
@ -79,11 +79,11 @@ The grid contrib consists of multiple components.
|
|||
1. The `XYMap` - This class parses modules with special _Map strings_
|
||||
and _Map legends_ into one Python object. It has helpers for pathfinding and
|
||||
visual-range handling.
|
||||
2. The `XYZGrid` - This is a singleton [Script](../Components/Scripts) that
|
||||
2. The `XYZGrid` - This is a singleton [Script](../Components/Scripts.md) that
|
||||
stores all `XYMaps` in the game. It is the central point for managing the 'grid'
|
||||
of the game.
|
||||
3. `XYZRoom` and `XYZExit`are custom typeclasses that use
|
||||
[Tags](../Components/Tags)
|
||||
[Tags](../Components/Tags.md)
|
||||
to know which X,Y,Z coordinate they are located at. The `XYZGrid` is
|
||||
abstract until it is used to _spawn_ these database entities into
|
||||
something you can actually interract with in the game. The `XYZRoom`
|
||||
|
|
@ -102,7 +102,7 @@ After installation, do the following from your command line (where the
|
|||
$ evennia xyzgrid init
|
||||
|
||||
use `evennia xyzgrid help` to see all options)
|
||||
This will create a new `XYZGrid` [Script](../Components/Scripts) if one didn't already exist.
|
||||
This will create a new `XYZGrid` [Script](../Components/Scripts.md) if one didn't already exist.
|
||||
The `evennia xyzgrid` is a custom launch option added only for this contrib.
|
||||
|
||||
The xyzgrid-contrib comes with a full grid example. Let's add it:
|
||||
|
|
@ -120,7 +120,7 @@ about each map with the `show` subcommand:
|
|||
$ evennia xyzgrid show "the small cave"
|
||||
|
||||
If you want to peek at how the grid's code, open
|
||||
[evennia/contrib/xyzgrid/example.py](api:evennia.contrib.xyzgrid.example).
|
||||
[evennia/contrib/xyzgrid/example.py](evennia.contrib.xyzgrid.example).
|
||||
(We'll explain the details in later sections).
|
||||
|
||||
So far the grid is 'abstract' and has no actual in-game presence. Let's
|
||||
|
|
@ -430,9 +430,9 @@ LEGEND = {
|
|||
The legend is optional, and any symbol not explicitly given in your legend will
|
||||
fall back to its value in the default legend [outlined below](#default-legend).
|
||||
|
||||
- [MapNode](api:evennia.contrib.xyzgrid.xymap_legend#evennia.contrib.xyzgrid.xymap_legend.MapNode)
|
||||
- [MapNode](evennia.contrib.xyzgrid.xymap_legend.MapNode)
|
||||
is the base class for all nodes.
|
||||
- [MapLink](api:evennia.contrib.xyzgrid.xymap_legend#evennia.contrib.xyzgrid.xymap_legend.MapLink)
|
||||
- [MapLink](evennia.contrib.xyzgrid.xymap_legend.MapLink)
|
||||
is the base class for all links.
|
||||
|
||||
As the _Map String_ is parsed, each found symbol is looked up in the legend and
|
||||
|
|
@ -445,7 +445,7 @@ with a full set of map elements that use these properties in various ways
|
|||
(described in the next section).
|
||||
|
||||
Some useful properties of the
|
||||
[MapNode](api:evennia.contrib.xyzgrid.xymap_legend#evennia.contrib.xyzgrid.xymap_legend.MapNode)
|
||||
[MapNode](evennia.contrib.xyzgrid.xymap_legend.MapNode)
|
||||
class (see class doc for hook methods):
|
||||
|
||||
- `symbol` (str) - The character to parse from the map into this node. By default this
|
||||
|
|
@ -473,7 +473,7 @@ class (see class doc for hook methods):
|
|||
useful for various reasons, mostly map-transitions).
|
||||
|
||||
Some useful properties of the
|
||||
[MapLink](api:evennia.contrib.xyzgrid.xymap_legend#evennia.contrib.xyzgrid.xymap_legend.MapLink)
|
||||
[MapLink](evennia.contrib.xyzgrid.xymap_legend.MapLink)
|
||||
class (see class doc for hook methods):
|
||||
|
||||
- `symbol` (str) - The character to parse from the map into this node. This must
|
||||
|
|
@ -551,7 +551,7 @@ actually visualized when displaying the map to players in-game. This could have
|
|||
colors etc. All classes are found in `evennia.contrib.xyzgrid.xymap_legend` and
|
||||
their names are included to make it easy to know what to override.
|
||||
|
||||
```eval_rst
|
||||
```{eval-rst}
|
||||
============= ============== ==== =================== =========================================
|
||||
symbol display-symbol type class description
|
||||
============= ============== ==== =================== =========================================
|
||||
|
|
@ -921,11 +921,11 @@ across the map boundary.
|
|||
|
||||
### Prototypes
|
||||
|
||||
[Prototypes](../Components/Prototypes) are dicts that describe how to _spawn_ a new instance
|
||||
[Prototypes](../Components/Prototypes.md) are dicts that describe how to _spawn_ a new instance
|
||||
of an object. Each of the _nodes_ and _links_ above have a default prototype
|
||||
that allows the `evennia xyzgrid spawn` command to convert them to
|
||||
a [XYZRoom](api:evennia.contrib.xyzgrid.xyzroom#XYZRoom)
|
||||
or an [XYZExit](api:evennia.contrib.xyzgrid.xyzroom#XYZExit) respectively.
|
||||
a [XYZRoom](evennia.contrib.xyzgrid.xyzroom.XYZRoom)
|
||||
or an [XYZExit](evennia.contrib.xyzgrid.xyzroom.XYZRoom) respectively.
|
||||
|
||||
The default prototypes are found in `evennia.contrib.xyzgrid.prototypes` (added
|
||||
during installation of this contrib), with `prototype_key`s `"xyz_room"` and
|
||||
|
|
@ -1167,7 +1167,7 @@ a location if they know that location's name. Here are some details about
|
|||
|
||||
## XYZGrid
|
||||
|
||||
The `XYZGrid` is a [Global Script](../Components/Scripts) that holds all `XYMap` objects on
|
||||
The `XYZGrid` is a [Global Script](../Components/Scripts.md) that holds all `XYMap` objects on
|
||||
the grid. There should be only one XYZGrid created at any time.
|
||||
|
||||
To access the grid in-code, there are several ways:
|
||||
|
|
@ -1216,17 +1216,17 @@ know how to call find the pathfinder though:
|
|||
- `xymap.get_shortest_path(start_xy, end_xy)`
|
||||
- `xymap.get_visual_range(xy, dist=2, **kwargs)`
|
||||
|
||||
See the [XYMap](api:evennia.contrib.xyzgrid.xymap#XYMap) documentation for
|
||||
See the [XYMap](xymap) documentation for
|
||||
details.
|
||||
|
||||
|
||||
## XYZRoom and XYZExit
|
||||
|
||||
These are new custom [Typeclasses](../Components/Typeclasses) located in
|
||||
These are new custom [Typeclasses](../Components/Typeclasses.md) located in
|
||||
`evennia.contrib.xyzgrid.xyzroom`. They extend the base `DefaultRoom` and
|
||||
`DefaultExit` to be aware of their `X`, `Y` and `Z` coordinates.
|
||||
|
||||
```warning::
|
||||
```{warning}
|
||||
|
||||
You should usually **not** create XYZRooms/Exits manually. They are intended
|
||||
to be created/deleted based on the layout of the grid. So to add a new room, add
|
||||
|
|
@ -1253,7 +1253,7 @@ Useful (extra) properties on `XYZRoom`, `XYZExit`:
|
|||
- `xyz_destination` (only for `XYZExits`) - this gives the xyz-coordinate of
|
||||
the exit's destination.
|
||||
|
||||
The coordinates are stored as [Tags](../Components/Tags) where both rooms and exits tag
|
||||
The coordinates are stored as [Tags](../Components/Tags.md) where both rooms and exits tag
|
||||
categories `room_x_coordinate`, `room_y_coordinate` and `room_z_coordinate`
|
||||
while exits use the same in addition to tags for their destination, with tag
|
||||
categories `exit_dest_x_coordinate`, `exit_dest_y_coordinate` and
|
||||
|
|
@ -1293,7 +1293,7 @@ exit = XYZExit.objects.get_xyz_exit(xyz=(0, 12, 'foo'), xyz_destination=(5, 2, '
|
|||
You can customize the XYZRoom/Exit by having the grid spawn your own subclasses
|
||||
of them. To do this you need to override the prototype used to spawn rooms on
|
||||
the grid. Easiest is to modify the base prototype-parents in settings (see the
|
||||
[Extending the base prototypes](#extending-the-base-prototypes) section above).
|
||||
[XYZRoom and XYZExit](#xyzroom-and-xyzexit) section above).
|
||||
|
||||
## Working with the grid
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -90,9 +90,9 @@ a new `README.md` file within that directory.
|
|||
amount of game-style-specific code. Assume your code will be applied to a very different game than
|
||||
you had in mind when creating it.
|
||||
* To make the licensing situation clear we assume all contributions are released with the same
|
||||
[license as Evennia](./Licensing). If this is not possible for some reason, talk to us and we'll
|
||||
[license as Evennia](./Licensing.md). If this is not possible for some reason, talk to us and we'll
|
||||
handle it on a case-by-case basis.
|
||||
* Your contribution must be covered by [unit tests](Coding/Unit-Testing). Having unit tests will both help
|
||||
* Your contribution must be covered by [unit tests](Coding/Unit-Testing.md). Having unit tests will both help
|
||||
make your code more stable and make sure small changes does not break it without it being noticed,
|
||||
it will also help us test its functionality and merge it quicker. If your contribution is a single
|
||||
module, you can add your unit tests to `evennia/contribs/tests.py`. If your contribution is bigger
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
# API Summary
|
||||
|
||||
[evennia](api:evennia) - library root
|
||||
- [evennia.accounts](api:evennia.accounts) - the out-of-character entities representing players
|
||||
- [evennia.commands](api:evennia.commands) - handle all inputs. Also includes default commands
|
||||
- [evennia.comms](api:evennia.comms) - in-game channels and messaging
|
||||
- [evennia.contrib](api:evennia.contrib) - game-specific tools and code contributed by the community
|
||||
- [evennia.help](api:evennia.help) - in-game help system
|
||||
- [evennia.locks](api:evennia.locks) - limiting access to various systems and resources
|
||||
- [evennia.objects](api:evennia.objects) - all in-game entities, like Rooms, Characters, Exits etc
|
||||
- [evennia.prototypes](api:evennia.prototypes) - customize entities using dicts
|
||||
- [evennia.scripts](api:evennia.scripts) - all out-of-character game objects
|
||||
- [evennia.server](api:evennia.server) - core Server and Portal programs, also network protocols
|
||||
- [evennia.typeclasses](api:evennia.typeclasses) - core database-python bridge
|
||||
- [evennia.utils](api:evennia.utils) - lots of useful coding tools and utilities
|
||||
- [evennia.web](api:evennia.web) - webclient, website and other web resources
|
||||
[evennia](api/evennia-api.md) - library source tree
|
||||
- [evennia.accounts](evennia.accounts) - the out-of-character entities representing players
|
||||
- [evennia.commands](evennia.commands) - handle all inputs. Also includes default commands
|
||||
- [evennia.comms](evennia.comms) - in-game channels and messaging
|
||||
- [evennia.contrib](evennia.contrib) - game-specific tools and code contributed by the community
|
||||
- [evennia.help](evennia.help) - in-game help system
|
||||
- [evennia.locks](evennia.locks) - limiting access to various systems and resources
|
||||
- [evennia.objects](evennia.objects) - all in-game entities, like Rooms, Characters, Exits etc
|
||||
- [evennia.prototypes](evennia.prototypes) - customize entities using dicts
|
||||
- [evennia.scripts](evennia.scripts) - all out-of-character game objects
|
||||
- [evennia.server](evennia.server) - core Server and Portal programs, also network protocols
|
||||
- [evennia.typeclasses](evennia.typeclasses) - core database-python bridge
|
||||
- [evennia.utils](evennia.utils) - lots of useful coding tools and utilities
|
||||
- [evennia.web](evennia.web) - webclient, website and other web resources
|
||||
|
||||
|
||||
## Shortcuts
|
||||
|
|
@ -28,71 +28,70 @@ The flat API is defined in `__init__.py` [viewable here](github:evennia/__init__
|
|||
|
||||
### Search functions
|
||||
|
||||
- [evennia.search_account](api:evennia.utils.search#evennia.utils.search.search_account)
|
||||
- [evennia.search_object](api:evennia.utils.search#evennia.utils.search.search_object)
|
||||
- [evennia.search_object_by_tag](api:evennia.utils.search#evennia.utils.search_object_by_tag)
|
||||
- [evennia.search_script](api:evennia.utils.search#evennia.utils.search_script)
|
||||
- [evennia.search_channel](api:evennia.utils.search#evennia.utils.search_channel)
|
||||
- [evennia.search_message](api:evennia.utils.search#evennia.utils.search_message)
|
||||
- [evennia.search_help](api:evennia.utils.search#evennia.utils.search.search_help)
|
||||
- [evennia.search_account](evennia.utils.search.search_account)
|
||||
- [evennia.search_object](evennia.utils.search.search_object)
|
||||
- [evennia.search_tag](evennia.utils.search.search_tag)
|
||||
- [evennia.search_script](evennia.utils.search.search_script)
|
||||
- [evennia.search_channel](evennia.utils.search.search_channel)
|
||||
- [evennia.search_message](evennia.utils.search.search_message)
|
||||
- [evennia.search_help](evennia.utils.search.search_help_entry)
|
||||
|
||||
### Create functions
|
||||
|
||||
- [evennia.create_account](api:evennia.utils.create#evennia.utils.create.create_account)
|
||||
- [evennia.create_object](api:evennia.utils.create#evennia.utils.create.create_object)
|
||||
- [evennia.create_script](api:evennia.utils.create#evennia.utils.create.create_script)
|
||||
- [evennia.create_channel](api:evennia.utils.create#evennia.utils.create.create_channel)
|
||||
- [evennia.create_help_entry](api:evennia.utils.create#evennia.utils.create.create_help_entry)
|
||||
- [evennia.create_message](api:evennia.utils.create#evennia.utils.create.create_message)
|
||||
- [evennia.create_account](evennia.utils.create.create_account)
|
||||
- [evennia.create_object](evennia.utils.create.create_object)
|
||||
- [evennia.create_script](evennia.utils.create.create_script)
|
||||
- [evennia.create_channel](evennia.utils.create.create_channel)
|
||||
- [evennia.create_help_entry](evennia.utils.create.create_help_entry)
|
||||
- [evennia.create_message](evennia.utils.create.create_message)
|
||||
|
||||
### Typeclasses
|
||||
|
||||
- [evennia.Defaultaccount](api:evennia.accounts.accounts#evennia.accounts.accounts.DefaultAccount) - player account class ([docs](Components/Accounts))
|
||||
- [evennia.DefaultGuest](api:evennia.accounts.accounts#evennia.accounts.accounts.DefaultGuest) - base guest account class
|
||||
- [evennia.DefaultObject](api:evennia.objects.objects#evennia.objects.objects.DefaultObject) - base class for all objects ([docs](Components/Objects))
|
||||
- [evennia.DefaultCharacter](api:evennia.objects.objects#evennia.objects.objects.DefaultCharacter) - base class for in-game characters ([docs](Components/Objects#Character))
|
||||
- [evennia.DefaultRoom](api:evennia.objects.objects#evennia.objects.objects.DefaultRoom) - base class for rooms ([docs](Components/Objects#Room))
|
||||
- [evennia.DefaultExit](api:evennia.objects.objects#evennia.objects.objects.DefaultExit) - base class for exits ([docs](Components/Objects#Exit))
|
||||
- [evennia.DefaultScript](api:evennia.scripts.scripts#evennia.scripts.scripts.DefaultScript) - base class for OOC-objects ([docs](Components/Scripts))
|
||||
- [evennia.DefaultChannel](api:evennia.comms.comms#evennia.comms.comms.DefaultChannel) - base class for in-game channels ([docs](Components/Channels))
|
||||
- [evennia.Defaultaccount](evennia.accounts.accounts.DefaultAccount) - player account class ([docs](Components/Accounts.md))
|
||||
- [evennia.DefaultGuest](evennia.accounts.accounts.DefaultGuest) - base guest account class
|
||||
- [evennia.DefaultObject](evennia.objects.objects.DefaultObject) - base class for all objects ([docs](Components/Objects.md))
|
||||
- [evennia.DefaultCharacter](evennia.objects.objects.DefaultCharacter) - base class for in-game characters ([docs](Components/Objects.md#characters))
|
||||
- [evennia.DefaultRoom](evennia.objects.objects.DefaultRoom) - base class for rooms ([docs](Components/Objects.md#rooms))
|
||||
- [evennia.DefaultExit](evennia.objects.objects.DefaultExit) - base class for exits ([docs](Components/Objects.md#exits))
|
||||
- [evennia.DefaultScript](evennia.scripts.scripts.DefaultScript) - base class for OOC-objects ([docs](Components/Scripts.md))
|
||||
- [evennia.DefaultChannel](evennia.comms.comms.DefaultChannel) - base class for in-game channels ([docs](Components/Channels.md))
|
||||
|
||||
### Commands
|
||||
|
||||
- [evennia.Command](api:evennia.commands.command#evennia.commands.command.Command) - base [Command](Components/Commands) class. See also `evennia.default_cmds.MuxCommand`
|
||||
- [evennia.CmdSet](api:evennia.commands.cmdset#evennia.commands.cmdset.CmdSet) - base [Cmdset](Components/Command-Sets) class
|
||||
- [evennia.default_cmds](api:Default-Command-Help) - access all default command classes as properties
|
||||
- [evennia.Command](evennia.commands.command.Command) - base [Command](Components/Commands.md) class. See also `evennia.default_cmds.MuxCommand`
|
||||
- [evennia.CmdSet](evennia.commands.cmdset.CmdSet) - base [CmdSet](Components/Command-Sets.md) class
|
||||
- [evennia.default_cmds](Components/Default-Commands.md) - access all default command classes as properties
|
||||
|
||||
- [evennia.syscmdkeys](api:Commands#System-Commands) - access system command keys as properties
|
||||
- [evennia.syscmdkeys](Components/Commands.md#system-commands) - access system command keys as properties
|
||||
|
||||
### Utilities
|
||||
|
||||
- [evennia.utils.utils](api:evennia.utils.utils) - mixed useful utilities
|
||||
- [evennia.gametime](api:evennia.utils.gametime) - server run- and game time ([docs](Components/Coding-Utils#gametime))
|
||||
- [evennia.logger](api:evennia.utils.logger) - logging tools
|
||||
- [evennia.ansi](api:evennia.utils.ansi) - ansi coloring tools
|
||||
- [evennia.spawn](api:evennia.prototypes.spawner#evennia.prototypes.spawner.Spawn) - spawn/prototype system ([docs](Components/Prototypes))
|
||||
- [evennia.lockfuncs](api:evennia.locks.lockfuncs) - default lock functions for access control ([docs](Components/Locks))
|
||||
- [evennia.EvMenu](api:evennia.utils.evmenu#evennia.utils.evmenu.EvMenu) - menu system ([docs](Components/EvMenu))
|
||||
- [evennia.EvTable](api:evennia.utils.evtable#evennia.utils.evtable.EvTable) - text table creater
|
||||
- [evennia.EvForm](api:evennia.utils.evform#evennia.utils.evform.EvForm) - text form creator
|
||||
- [evennia.utils.utils](evennia.utils.utils) - mixed useful utilities
|
||||
- [evennia.gametime](evennia.utils.gametime.TimeScript) - server run- and game time ([docs](Components/Coding-Utils.md#game-time))
|
||||
- [evennia.logger](evennia.utils.logger) - logging tools
|
||||
- [evennia.ansi](evennia.utils.ansi) - ansi coloring tools
|
||||
- [evennia.spawn](evennia.prototypes.spawner.spawn) - spawn/prototype system ([docs](Components/Prototypes.md))
|
||||
- [evennia.lockfuncs](evennia.locks.lockfuncs) - default lock functions for access control ([docs](Components/Locks.md))
|
||||
- [evennia.EvMenu](evennia.utils.evmenu.EvMenu) - menu system ([docs](Components/EvMenu.md))
|
||||
- [evennia.EvTable](evennia.utils.evtable.EvTable) - text table creater
|
||||
- [evennia.EvForm](evennia.utils.evform.EvForm) - text form creator
|
||||
- Evennia.EvMore - text paginator
|
||||
- [evennia.EvEditor](api:evennia.utils.eveditor#evennia.utils.eveditor.EvEditor) - in game text line editor ([docs](Components/EvEditor))
|
||||
- [evennia.utils.funcparser.Funcparser](api:evennia.utils.funcparser) - inline parsing of functions ([docs](Components/FuncParser))
|
||||
- [evennia.EvEditor](evennia.utils.eveditor.EvEditor) - in game text line editor ([docs](Components/EvEditor.md))
|
||||
- [evennia.utils.funcparser.Funcparser](evennia.utils.funcparser.FuncParser) - inline parsing of functions ([docs](Components/FuncParser.md))
|
||||
|
||||
### Global singleton handlers
|
||||
|
||||
- [evennia.TICKER_HANDLER](api:evennia.scripts.tickerhandler) - allow objects subscribe to tickers ([docs](Components/TickerHandler))
|
||||
- [evennia.MONITOR_HANDLER](api:evennia.scripts.monitorhandler) - monitor changes ([docs](Components/MonitorHandler))
|
||||
- [evennia.CHANNEL_HANDLER](api:evennia.comms.channelhandler) - maintains channels
|
||||
- [evennia.SESSION_HANDLER](api:evennia.server.serverhandler) - manages all sessionsmain session handler
|
||||
- [evennia.TICKER_HANDLER](evennia.scripts.tickerhandler.TickerHandler) - allow objects subscribe to tickers ([docs](Components/TickerHandler.md))
|
||||
- [evennia.MONITOR_HANDLER](evennia.scripts.monitorhandler.MonitorHandler) - monitor changes ([docs](Components/MonitorHandler.md))
|
||||
- [evennia.SESSION_HANDLER](evennia.server.sessionhandler.SessionHandler) - manages all sessionsmain session handler
|
||||
|
||||
### Database core models (for more advanced lookups)
|
||||
|
||||
- [evennia.ObjectDB](api:evennia.objects.models#evennia.objects.models.ObjectDB)
|
||||
- [evennia.accountDB](api:evennia.accounts.models#evennia.accounts.models.AccountDB)
|
||||
- [evennia.ScriptDB](api:evennia.scripts.models#evennia.scripts.models.ScriptDB)
|
||||
- [evennia.ChannelDB](api:evennia.channels.models#evennia.channels.models.ChannelDB)
|
||||
- [evennia.Msg](api:evennia.comms.models#evennia.comms.models.Msg)
|
||||
- [evennia.ObjectDB](evennia.objects.models.ObjectDB)
|
||||
- [evennia.accountDB](evennia.accounts.models.AccountDB)
|
||||
- [evennia.ScriptDB](evennia.scripts.models.ScriptDB)
|
||||
- [evennia.ChannelDB](evennia.comms.models.ChannelDB)
|
||||
- [evennia.Msg](evennia.comms.models.Msg)
|
||||
- evennia.managers - contains shortcuts to all database managers
|
||||
|
||||
### Contributions
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Evennia is *fully persistent*, that means things you drop on the ground somewher
|
|||
there a dozen server reboots later. Through Django we support a large variety of different database
|
||||
systems (a database is created for you automatically if you use the defaults).
|
||||
|
||||
We also include a growing list of *optional* [contribs](Contribs/Contrib-Overview) you can use for your game
|
||||
We also include a growing list of *optional* [contribs](Contribs/Contrib-Overview.md) you can use for your game
|
||||
would you want something to build from.
|
||||
|
||||
Using the full power of Python throughout the server offers some distinct advantages. All your
|
||||
|
|
@ -38,7 +38,7 @@ implementations indeed.
|
|||
Out of the box, Evennia gives you a 'talker'-type of game; you can walk around, chat, build rooms and objects,
|
||||
do basic roleplaying and administration. The server ships with a default set of player commands that are
|
||||
similar to the MUX command set. We *do not* aim specifically to be a MUX server, but we had to pick some
|
||||
default to go with (see [this](Concepts/Soft-Code) for more about our original motivations). It's easy to
|
||||
default to go with (see [this](Concepts/Soft-Code.md) for more about our original motivations). It's easy to
|
||||
remove or add commands, or to have the command syntax mimic other systems, like Diku, LP, MOO and so on.
|
||||
Or why not create a new and better command system of your own design.
|
||||
|
||||
|
|
@ -49,11 +49,11 @@ connect to the demo via your telnet client you can do so at `demo.evennia.com`,
|
|||
|
||||
Once you installed Evennia yourself it comes with its own tutorial - this shows off some of the
|
||||
possibilities _and_ gives you a small single-player quest to play. The tutorial takes only one
|
||||
single in-game command to install as explained [here](Howto/Starting/Part1/Tutorial-World-Introduction).
|
||||
single in-game command to install as explained [here](Howto/Starting/Part1/Tutorial-World-Introduction.md).
|
||||
|
||||
## What you need to know to work with Evennia
|
||||
|
||||
Assuming you have Evennia working (see the [quick start instructions](Setup/Setup-Quickstart)) and have
|
||||
Assuming you have Evennia working (see the [quick start instructions](Setup/Setup-Quickstart.md)) and have
|
||||
gotten as far as to start the server and connect to it with the client of your choice, here's what
|
||||
you need to know depending on your skills and needs.
|
||||
|
||||
|
|
@ -71,11 +71,11 @@ Evennia's source code is extensively documented and is [viewable
|
|||
online](https://github.com/evennia/evennia). We also have a comprehensive [online
|
||||
manual](https://evennia.com/docs) with lots of examples. But while Python is
|
||||
considered a very easy programming language to get into, you do have a learning curve to climb if
|
||||
you are new to programming. Evennia's [Starting-tutorial](Howto/Starting/Part1/Starting-Part1) has a [basic introduction
|
||||
to Python](Howto/Starting/Part1/Python-basic-introduction) but you should probably also sit down
|
||||
you are new to programming. Evennia's [Starting-tutorial](Howto/Starting/Part1/Starting-Part1.md) has a [basic introduction
|
||||
to Python](Howto/Starting/Part1/Python-basic-introduction.md) but you should probably also sit down
|
||||
with a full Python beginner's tutorial at some point (there are plenty of them on
|
||||
the web if you look around). See also our [link
|
||||
page](Links#wiki-litterature) for some reading suggestions. To efficiently code your dream game in
|
||||
page](./Links.md) for some reading suggestions. To efficiently code your dream game in
|
||||
Evennia you don't need to be a Python guru, but you do need to be able to read example code
|
||||
containing at least these basic Python features:
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ programming](https://www.tutorialspoint.com/python/python_classes_objects.htm),
|
|||
[Classes](https://docs.python.org/tutorial/classes.html), their methods and properties
|
||||
|
||||
Obviously, the more things you feel comfortable with, the easier time you'll have to find your way.
|
||||
With just basic knowledge you should be able to define your own [Commands](Components/Commands), create custom
|
||||
[Objects](Components/Objects) as well as make your world come alive with basic [Scripts](Components/Scripts). You can
|
||||
With just basic knowledge you should be able to define your own [Commands](Components/Commands.md), create custom
|
||||
[Objects](Components/Objects.md) as well as make your world come alive with basic [Scripts](Components/Scripts.md). You can
|
||||
definitely build a whole advanced and customized game from extending Evennia's examples only.
|
||||
|
||||
### I know my Python stuff and I am willing to use it!
|
||||
|
|
@ -110,8 +110,8 @@ presence (a website and a mud web client) to play around with ...
|
|||
|
||||
### Where to from here?
|
||||
|
||||
From here you can continue browsing the [online documentation]([online documentation](index:Evennia-documentation)) to
|
||||
find more info about Evennia. Or you can jump into the [Tutorials](Howto/Howto-Overview) and get your hands
|
||||
From here you can continue browsing the [online documentation](./index.md) to
|
||||
find more info about Evennia. Or you can jump into the [Tutorials](Howto/Howto-Overview.md) and get your hands
|
||||
dirty with code right away. You can also read the lead developer's [dev blog](https://evennia.blogspot.com/) for many tidbits and snippets about Evennia's development and
|
||||
structure.
|
||||
|
||||
|
|
@ -124,9 +124,9 @@ chat](https://webchat.freenode.net/?channels=evennia&uio=MT1mYWxzZSY5PXRydWUmMTE
|
|||
on IRC. This allows you to chat directly with other developers new and old as well as with the devs
|
||||
of Evennia itself. This chat is logged (you can find links on https://www.evennia.com) and can also
|
||||
be searched from the same place for discussion topics you are interested in.
|
||||
2. Read the [Game Planning](Howto/Starting/Part2/Game-Planning) wiki page. It gives some ideas for your work flow and the
|
||||
2. Read the [Game Planning](Howto/Starting/Part2/Game-Planning.md) wiki page. It gives some ideas for your work flow and the
|
||||
state of mind you should aim for - including cutting down the scope of your game for its first
|
||||
release.
|
||||
3. Do the [Tutorial for basic MUSH-like game](Howto/Starting/Part3/Tutorial-for-basic-MUSH-like-game) carefully from
|
||||
3. Do the [Tutorial for basic MUSH-like game](Howto/Starting/Part3/Tutorial-for-basic-MUSH-like-game.md) carefully from
|
||||
beginning to end and try to understand what does what. Even if you are not interested in a MUSH for
|
||||
your own game, you will end up with a small (very small) game that you can build or learn from.
|
||||
|
|
|
|||
|
|
@ -1,105 +1,106 @@
|
|||
# Glossary
|
||||
|
||||
|
||||
This explains common recurring terms used in the Evennia docs. It will be expanded as needed.
|
||||
This explains common recurring terms used in the Evennia docs. It will be expanded as needed.
|
||||
|
||||
- _[account](./Glossary#account)_ - the player's account on the game
|
||||
- _[admin-site](./Glossary#admin-site)_ - the Django web page for manipulating the database
|
||||
- _[attribute](./Glossary#attribute)_ - persistent, custom data stored on typeclasses
|
||||
- _[channel](./Glossary#channel)_ - game communication channels
|
||||
- _[character](./Glossary#character)_ - the player's avatar in the game, controlled from
|
||||
_[account](./Glossary#account)_
|
||||
- _[core](./Glossary#core)_ - a term used for the code distributed with Evennia proper
|
||||
- _[django](./Glossary#django)_ - web framework Evennia uses for database access and web integration
|
||||
- _[field](./Glossary#field)_ - a _[typeclass](./Glossary#typeclass)_ property representing a database
|
||||
- _[account](./Glossary.md#account)_ - the player's account on the game
|
||||
- _[admin-site](./Glossary.md#admin-site)_ - the Django web page for manipulating the database
|
||||
- _[attribute](./Glossary.md#attribute)_ - persistent, custom data stored on typeclasses
|
||||
- _[channel](./Glossary.md#channel)_ - game communication channels
|
||||
- _[character](./Glossary.md#character)_ - the player's avatar in the game, controlled from
|
||||
_[account](./Glossary.md#account)_
|
||||
- _[contrib](./Glossary.md#contrib)_ - a term used for optional code contributed by the community.
|
||||
- _[core](./Glossary.md#core)_ - a term used for the code distributed with Evennia proper
|
||||
- _[django](./Glossary.md#django)_ - web framework Evennia uses for database access and web integration
|
||||
- _[field](./Glossary.md#field)_ - a _[typeclass](./Glossary.md#typeclass)_ property representing a database
|
||||
column
|
||||
- _[git](./Glossary#git)_ - the version-control system we use
|
||||
- _[github](./Glossary#github)_ - the online hosting of our source code
|
||||
- _[migrate](./Glossary#migrate)_ - updating the database schema
|
||||
- _[git](./Glossary.md#git)_ - the version-control system we use
|
||||
- _[github](./Glossary.md#github)_ - the online hosting of our source code
|
||||
- _[migrate](./Glossary.md#migrate)_ - updating the database schema
|
||||
- _[multisession mode`](#multisession-mode)_ - a setting defining how users connect to Evennia
|
||||
- _[object](./Glossary#object)_ - Python instance, general term or in-game
|
||||
_[typeclass](./Glossary#typeclass)_
|
||||
- _[pip](./Glossary#pip)_ - the Python installer
|
||||
- _[object](./Glossary.md#object)_ - Python instance, general term or in-game
|
||||
_[typeclass](./Glossary.md#typeclass)_
|
||||
- _[pip](./Glossary.md#pip)_ - the Python installer
|
||||
- _player_ - the human connecting to the game with their client
|
||||
- _[puppet](./Glossary#puppet)_ - when an [account](./Glossary#account) controls an in-game
|
||||
[object](./Glossary#object)
|
||||
- _[property](./Glossary#property)_ - a python property
|
||||
- _evenv_ - see _[virtualenv](./Glossary#virtualenv)_
|
||||
- _[repository](./Glossary#repository)_ - a store of source code + source history
|
||||
- _[script](./Glossary#script)_ - a building block for custom storage, systems and time-keepint
|
||||
- _[session](./Glossary#session)_ - represents one client connection
|
||||
- _[ticker](./Glossary#ticker)_ - Allows to run events on a steady 'tick'
|
||||
- _[twisted](./Glossary#twisted)_ - networking engine responsible for Evennia's event loop and
|
||||
- _[puppet](./Glossary.md#puppet)_ - when an [account](./Glossary.md#account) controls an in-game
|
||||
[object](./Glossary.md#object)
|
||||
- _[property](./Glossary.md#property)_ - a python property
|
||||
- _evenv_ - see _[virtualenv](./Glossary.md#virtualenv)_
|
||||
- _[repository](./Glossary.md#repository)_ - a store of source code + source history
|
||||
- _[script](./Glossary.md#script)_ - a building block for custom storage, systems and time-keepint
|
||||
- _[session](./Glossary.md#session)_ - represents one client connection
|
||||
- _[ticker](./Glossary.md#ticker)_ - Allows to run events on a steady 'tick'
|
||||
- _[twisted](./Glossary.md#twisted)_ - networking engine responsible for Evennia's event loop and
|
||||
communications
|
||||
- _[typeclass](./Glossary#typeclass)_ - Evennia's database-connected Python class
|
||||
- _upstream_ - see _[github](./Glossary#github)_
|
||||
- _[virtualenv](./Glossary#virtualenv)_ - a Python program and way to make an isolated Python install
|
||||
- _[typeclass](./Glossary.md#typeclass)_ - Evennia's database-connected Python class
|
||||
- _upstream_ - see _[github](./Glossary.md#github)_
|
||||
- _[virtualenv](./Glossary.md#virtualenv)_ - a Python program and way to make an isolated Python install
|
||||
|
||||
|
||||
---
|
||||
|
||||
### _account_
|
||||
## _account_
|
||||
|
||||
The term 'account' refers to the [player's](./Glossary#player) unique account on the game. It is
|
||||
represented by the `Account` [typeclass](./Glossary#typeclass) and holds things like email, password,
|
||||
The term 'account' refers to the [player's](./Glossary.md#account) unique account on the game. It is
|
||||
represented by the `Account` [typeclass](./Glossary.md#typeclass) and holds things like email, password,
|
||||
configuration etc.
|
||||
|
||||
When a player connects to the game, they connect to their account. The account has *no*
|
||||
representation in the game world. Through their Account they can instead choose to
|
||||
[puppet](./Glossary#puppet) one (or more, depending on game mode) [Characters](./Glossary#character) in
|
||||
[puppet](./Glossary.md#puppet) one (or more, depending on game mode) [Characters](./Glossary.md#character) in
|
||||
the game.
|
||||
|
||||
In the default [multisession mode](Components/Sessions#multisession-mode) of Evennia, you immediately start
|
||||
In the default [multisession mode](Components/Sessions.md#multisession-mode) of Evennia, you immediately start
|
||||
puppeting a Character with the same name as your Account when you log in - mimicking how older
|
||||
servers used to work.
|
||||
|
||||
### _admin-site_
|
||||
## _admin-site_
|
||||
|
||||
This usually refers to [Django's](./Glossary#django) *Admin site* or database-administration web page
|
||||
This usually refers to [Django's](./Glossary.md#django) *Admin site* or database-administration web page
|
||||
([link to Django docs](https://docs.djangoproject.com/en/2.1/ref/contrib/admin/)). The admin site is
|
||||
an automatically generated web interface to the database (it can be customized extensively). It's
|
||||
reachable from the `admin` link on the default Evennia website you get with your server.
|
||||
|
||||
### _attribute_
|
||||
## _attribute_
|
||||
|
||||
The term _Attribute_ should not be confused with ([properties](./Glossary#property) or
|
||||
[fields](./Glossary#field). The `Attribute` represents arbitrary pieces of data that can be attached
|
||||
to any [typeclassed](./Glossary#typeclass) entity in Evennia. Attributes allows storing new persistent
|
||||
data on typeclasses without changing their underlying database schemas.
|
||||
[Read more about Attributes here](Components/Attributes).
|
||||
The term _Attribute_ should not be confused with ([properties](./Glossary.md#property) or
|
||||
[fields](./Glossary.md#field). The `Attribute` represents arbitrary pieces of data that can be attached
|
||||
to any [typeclassed](./Glossary.md#typeclass) entity in Evennia. Attributes allows storing new persistent
|
||||
data on typeclasses without changing their underlying database schemas.
|
||||
[Read more about Attributes here](Components/Attributes.md).
|
||||
|
||||
### _channel_
|
||||
## _channel_
|
||||
|
||||
A _Channel_ refers to an in-game communication channel. It's an entity that people subscribe to and
|
||||
which re-distributes messages between all subscribers. Such subscribers default to being
|
||||
[Accounts](./Glossary#account), for out-of-game communication but could also be [Objects (usually
|
||||
Characters)](Glossary#character) if one wanted to adopt Channels for things like in-game walkie-
|
||||
[Accounts](./Glossary.md#account), for out-of-game communication but could also be [Objects (usually
|
||||
Characters)](./Glossary.md#character) if one wanted to adopt Channels for things like in-game walkie-
|
||||
talkies or phone systems. It is represented by the `Channel` typeclass. [You can read more about the
|
||||
comm system here](Communications#channels).
|
||||
comm system here](Components/Channels.md).
|
||||
|
||||
### _character_
|
||||
## _character_
|
||||
|
||||
The _Character_ is the term we use for the default avatar being [puppeted](./Glossary#puppet) by the
|
||||
[account](./Glossary#account) in the game world. It is represented by the `Character` typeclass (which
|
||||
is a child of [Object](./Glossary#object)). Many developers use children of this class to represent
|
||||
monsters and other NPCs. You can [read more about it here](Components/Objects#subclasses-of-object).
|
||||
The _Character_ is the term we use for the default avatar being [puppeted](./Glossary.md#puppet) by the
|
||||
[account](./Glossary.md#account) in the game world. It is represented by the `Character` typeclass (which
|
||||
is a child of [Object](./Glossary.md#object)). Many developers use children of this class to represent
|
||||
monsters and other NPCs. You can [read more about it here](Components/Objects.md#subclasses-of-object).
|
||||
|
||||
### _django_
|
||||
## _django_
|
||||
|
||||
[Django](https://www.djangoproject.com/) is a professional and very popular Python web framework,
|
||||
similar to Rails for the Ruby language. It is one of Evennia's central library dependencies (the
|
||||
other one is [Twisted](./Glossary#twisted)). Evennia uses Django for two main things - to map all
|
||||
other one is [Twisted](./Glossary.md#twisted)). Evennia uses Django for two main things - to map all
|
||||
database operations to Python and for structuring our web site.
|
||||
|
||||
|
||||
Through Django, we can work with any supported database (SQlite3, Postgres, MySQL ...) using generic
|
||||
Python instead of database-specific SQL: A database table is represented in Django as a Python class
|
||||
(called a *model*). An Python instance of such a class represents a row in that table.
|
||||
|
||||
There is usually no need to know the details of Django's database handling in order to use Evennia -
|
||||
it will handle most of the complexity for you under the hood using what we call
|
||||
[typeclasses](./Glossary#typeclass). But should you need the power of Django you can always get it.
|
||||
[typeclasses](./Glossary.md#typeclass). But should you need the power of Django you can always get it.
|
||||
Most commonly people want to use "raw" Django when doing more advanced/custom database queries than
|
||||
offered by Evennia's [default search functions](Howto/Starting/Part1/Searching-Things). One will then need
|
||||
offered by Evennia's [default search functions](Howto/Starting/Part1/Searching-Things.md). One will then need
|
||||
to read about Django's _querysets_. Querysets are Python method calls on a special form that lets
|
||||
you build complex queries. They get converted into optimized SQL queries under the hood, suitable
|
||||
for your current database. [Here is our tutorial/explanation of Django queries](Tutorial-Searching-
|
||||
|
|
@ -115,27 +116,32 @@ when a user goes that URL in their browser, enters data into a form etc. The ret
|
|||
to show. Django also offers templating with features such as being able to add special markers in
|
||||
HTML where it will insert the values of Python variables on the fly (like showing the current player
|
||||
count on the web page). [Here is one of our tutorials on wiring up such a web page](Add-a-simple-
|
||||
new-web-page). Django also comes with the [admin site](./Glossary#admin-site), which automatically
|
||||
new-web-page). Django also comes with the [admin site](./Glossary.md#admin-site), which automatically
|
||||
maps the database into a form accessible from a web browser.
|
||||
|
||||
### _core_
|
||||
## _core_
|
||||
|
||||
This term is sometimes used to represent the main Evennia library code suite, *excluding* its
|
||||
[contrib](./Glossary#contrib) directory. It can sometimes come up in code reviews, such as
|
||||
[contribs](./Glossary.md#contrib) directory. It can sometimes come up in code reviews, such as
|
||||
|
||||
> Evennia is game-agnostic but this feature is for a particular game genre. So it does not belong in
|
||||
core. Better make it a contrib.
|
||||
|
||||
## _contrib_
|
||||
|
||||
### _field_
|
||||
Game-specific code and examples are distributed in evennia's [contribs/](Contribs/Contrib-Overview.md) folder.
|
||||
This is game-specific, optional code created by the Evennia community.
|
||||
|
||||
A _field_ or _database field_ in Evennia refers to a [property](./Glossary#property) on a
|
||||
[typeclass](./Glossary#typeclass) directly linked to an underlying database column. Only a few fixed
|
||||
## _field_
|
||||
|
||||
A _field_ or _database field_ in Evennia refers to a [property](./Glossary.md#property) on a
|
||||
[typeclass](./Glossary.md#typeclass) directly linked to an underlying database column. Only a few fixed
|
||||
properties per typeclass are database fields but they are often tied to the core functionality of
|
||||
that base typeclass (for example [Objects](./Glossary#object) store its location as a field). In all
|
||||
other cases, [attributes](./Glossary#attribute) are used to add new persistent data to the typeclass.
|
||||
[Read more about typeclass properties here](Components/Typeclasses#about-typeclass-properties).
|
||||
that base typeclass (for example [Objects](./Glossary.md#object) store its location as a field). In all
|
||||
other cases, [attributes](./Glossary.md#attribute) are used to add new persistent data to the typeclass.
|
||||
[Read more about typeclass properties here](Components/Typeclasses.md#about-typeclass-properties).
|
||||
|
||||
### _git_
|
||||
## _git_
|
||||
|
||||
[Git](https://git-scm.com/) is a [version control](https://en.wikipedia.org/wiki/Version_control)
|
||||
tool. It allows us to track the development of the Evennia code by dividing it into units called
|
||||
|
|
@ -143,12 +149,12 @@ tool. It allows us to track the development of the Evennia code by dividing it i
|
|||
come back to it later if later changes caused problems. By tracking commits we know what 'version'
|
||||
of the code we are currently using.
|
||||
|
||||
Evennia's source code + its source history is jointly called a [repository](./Glossary#repository).
|
||||
This is centrally stored at our online home on [GitHub](./Glossary#github). Everyone using or
|
||||
Evennia's source code + its source history is jointly called a [repository](./Glossary.md#repository).
|
||||
This is centrally stored at our online home on [GitHub](./Glossary.md#github). Everyone using or
|
||||
developing Evennia makes a 'clone' of this repository to their own computer - everyone
|
||||
automatically gets everything that is online, including all the code history.
|
||||
|
||||
> Don't confuse Git and [GitHub](./Glossary#github). The former is the version control system. The
|
||||
> Don't confuse Git and [GitHub](./Glossary.md#github). The former is the version control system. The
|
||||
latter is a website (run by a company) that allows you to upload source code controlled by Git for
|
||||
others to see (among other things).
|
||||
|
||||
|
|
@ -161,59 +167,59 @@ Developers using Evennia often uses Git on their own games in the same way - to
|
|||
and to help collaboration with team mates. This is done completely independently of Evennia's Git
|
||||
usage.
|
||||
|
||||
Common usage (for non-Evennia developers):
|
||||
Common usage (for non-Evennia developers):
|
||||
- `git clone <github-url>` - clone an online repository to your computer. This is what you do when
|
||||
you 'download' Evennia. You only need to do this once.
|
||||
- `git pull` (inside local copy of repository) - sync your local repository with what is online.
|
||||
|
||||
> Full usage of Git is way beyond the scope of this glossary. See
|
||||
[Tutorial - version control](Coding/Version-Control) for more info and links to the Git documentation.
|
||||
> Full usage of Git is way beyond the scope of this glossary. See
|
||||
[Tutorial - version control](Coding/Version-Control.md) for more info and links to the Git documentation.
|
||||
|
||||
### _migrate_
|
||||
## _migrate_
|
||||
|
||||
This term is used for upgrading the database structure (it's _schema_ )to a new version. Most often
|
||||
this is due to Evennia's [upstream](./Glossary#github) schema changing. When that happens you need to
|
||||
migrate that schema to the new version as well. Once you have used [git](./Glossary#git) to pull the
|
||||
this is due to Evennia's [upstream](./Glossary.md#github) schema changing. When that happens you need to
|
||||
migrate that schema to the new version as well. Once you have used [git](./Glossary.md#git) to pull the
|
||||
latest changes, just `cd` into your game dir and run
|
||||
|
||||
evennia migrate
|
||||
evennia migrate
|
||||
|
||||
That should be it (see [virtualenv](./Glossary#virtualenv) if you get a warning that the `evennia`
|
||||
command is not available). See also [Updating your game](Coding/Updating-Your-Game) for more details.
|
||||
That should be it (see [virtualenv](./Glossary.md#virtualenv) if you get a warning that the `evennia`
|
||||
command is not available). See also [Updating your game](Coding/Updating-Your-Game.md) for more details.
|
||||
|
||||
> Technically, migrations are shipped as little Python snippets of code that explains which database
|
||||
actions must be taken to upgrade from one version of the schema to the next. When you run the
|
||||
command above, those snippets are run in sequence.
|
||||
|
||||
### _multisession mode_
|
||||
## _multisession mode_
|
||||
|
||||
This term refers to the `MULTISESSION_MODE` setting, which has a value of 0 to 3. The mode alters
|
||||
how players can connect to the game, such as how many Sessions a player can start with one account
|
||||
and how many Characters they can control at the same time. It is [described in detail
|
||||
here](Sessions#multisession-mode).
|
||||
here](Components/Sessions.md#multisession-mode).
|
||||
|
||||
### _github_
|
||||
## _github_
|
||||
|
||||
[Github](https://github.com/evennia) is where Evennia's source code and documentation is hosted.
|
||||
This online [repository](./Glossary#repository) of code we also sometimes refer to as _upstream_.
|
||||
This online [repository](./Glossary.md#repository) of code we also sometimes refer to as _upstream_.
|
||||
|
||||
GitHub is a business, offering free hosting to Open-source projects like Evennia. Despite the
|
||||
similarity in name, don't confuse GitHub the website with [Git](./Glossary#git), the versioning
|
||||
system. Github hosts Git [repositories](./Glossary#repository) online and helps with collaboration and
|
||||
similarity in name, don't confuse GitHub the website with [Git](./Glossary.md#git), the versioning
|
||||
system. Github hosts Git [repositories](./Glossary.md#repository) online and helps with collaboration and
|
||||
infrastructure. Git itself is a separate project.
|
||||
|
||||
### _object_
|
||||
## _object_
|
||||
|
||||
In general Python (and other [object-oriented languages](https://en.wikipedia.org/wiki/Object-
|
||||
oriented_programming)), an `object` is what we call the instance of a *class*. But one of Evennia's
|
||||
core [typeclasses](./Glossary#typeclasss) is also called "Object". To separate these in the docs we
|
||||
core [typeclasses](./Glossary.md#typeclass) is also called "Object". To separate these in the docs we
|
||||
try to use `object` to refer to the general term and capitalized `Object` when we refer to the
|
||||
typeclass.
|
||||
|
||||
The `Object` is a typeclass that represents all *in-game* entities, including
|
||||
[Characters](./Glossary#character), rooms, trees, weapons etc. [Read more about Objects here](Components/Objects).
|
||||
[Characters](./Glossary.md#character), rooms, trees, weapons etc. [Read more about Objects here](Components/Objects.md).
|
||||
|
||||
### _pip_
|
||||
## _pip_
|
||||
|
||||
_[pip](https://pypi.org/project/pip/)_ comes with Python and is the main tool for installing third-
|
||||
party Python packages from the web. Once a python package is installed you can do `import
|
||||
|
|
@ -232,94 +238,99 @@ means that if the code in `<folder>` changes, the installed Python package is im
|
|||
If not using `-e`, one would need to run `pip install --upgrade <folder>` every time to make the
|
||||
changes available when you import this package into your code. Evennia is installed this way.
|
||||
|
||||
For development, `pip` is usually used together with a [virtualenv](./Glossary#virtualenv) to install
|
||||
For development, `pip` is usually used together with a [virtualenv](./Glossary.md#virtualenv) to install
|
||||
all packages and dependencies needed for a project in one, isolated location on the hard drive.
|
||||
|
||||
### _puppet_
|
||||
## _puppet_
|
||||
|
||||
An [account](./Glossary#account) can take control and "play as" any [Object](./Glossary#object). When
|
||||
An [account](./Glossary.md#account) can take control and "play as" any [Object](./Glossary.md#object). When
|
||||
doing so, we call this _puppeting_, (like [puppeteering](https://en.wikipedia.org/wiki/Puppeteer)).
|
||||
Normally the entity being puppeted is of the [Character](./Glossary#character) subclass but it does
|
||||
Normally the entity being puppeted is of the [Character](./Glossary.md#character) subclass but it does
|
||||
not have to be.
|
||||
|
||||
### _property_
|
||||
## _property_
|
||||
|
||||
A _property_ is a general term used for properties on any Python object. The term also sometimes
|
||||
refers to the `property` built-in function of Python ([read more here](https://www.python-
|
||||
course.eu/python3_properties.php)). Note the distinction between properties,
|
||||
[fields](./Glossary#field) and [Attributes](./Glossary#attribute).
|
||||
[fields](./Glossary.md#field) and [Attributes](./Glossary.md#attribute).
|
||||
|
||||
### _repository_
|
||||
## _repository_
|
||||
|
||||
A _repository_ is a version control/[git](./Glossary#git) term. It represents a folder containing
|
||||
A _repository_ is a version control/[git](./Glossary.md#git) term. It represents a folder containing
|
||||
source code plus its versioning history.
|
||||
|
||||
> In Git's case, that history is stored in a hidden folder `.git`. If you ever feel the need to look
|
||||
into this folder you probably already know enough Git to know why.
|
||||
|
||||
The `evennia` folder you download from us with `git clone` is a repository. The code on
|
||||
[GitHub](./Glossary#github) is often referred to as the 'online repository' (or the _upstream_
|
||||
[GitHub](./Glossary.md#github) is often referred to as the 'online repository' (or the _upstream_
|
||||
repository). If you put your game dir under version control, that of course becomes a repository as
|
||||
well.
|
||||
|
||||
### _script_
|
||||
## _script_
|
||||
|
||||
When we refer to _Scripts_, we generally refer to the `Script` [typeclass](Components/Typeclasses). Scripts are
|
||||
the mavericks of Evennia - they are like [Objects](./Glossary#object) but without any in-game
|
||||
When we refer to _Scripts_, we generally refer to the `Script` [typeclass](Components/Typeclasses.md). Scripts are
|
||||
the mavericks of Evennia - they are like [Objects](./Glossary.md#object) but without any in-game
|
||||
existence. They are useful as custom places to store data but also as building blocks in persistent
|
||||
game systems. Since the can be initialized with timing capabilities they can also be used for long-
|
||||
time persistent time keeping (for fast updates other types of timers may be better though).
|
||||
[Read more about Scripts here](Components/Scripts)
|
||||
time persistent time keeping (for fast updates other types of timers may be better though).
|
||||
[Read more about Scripts here](Components/Scripts.md)
|
||||
|
||||
### _session_
|
||||
## _session_
|
||||
|
||||
A [Session](Components/Sessions) is a Python object representing a single client connection to the server. A
|
||||
A [Session](Components/Sessions.md) is a Python object representing a single client connection to the server. A
|
||||
given human player could connect to the game from different clients and each would get a Session
|
||||
(even if you did not allow them to actually log in and get access to an
|
||||
[account](./Glossary#account)).
|
||||
[account](./Glossary.md#account)).
|
||||
|
||||
Sessions are _not_ [typeclassed](./Glossary#typeclass) and has no database persistence. But since they
|
||||
Sessions are _not_ [typeclassed](./Glossary.md#typeclass) and has no database persistence. But since they
|
||||
always exist (also when not logged in), they share some common functionality with typeclasses that
|
||||
can be useful for certain game states.
|
||||
|
||||
### _ticker_
|
||||
## _tag_
|
||||
|
||||
The [Ticker handler](Components/TickerHandler) runs Evennia's optional 'ticker' system. In other engines, such
|
||||
A [Tag](Components/Tags.md) is used to group and categorize other database entitiess together in an efficient way
|
||||
so they can be efficiently searched later.
|
||||
|
||||
## _ticker_
|
||||
|
||||
The [Ticker handler](Components/TickerHandler.md) runs Evennia's optional 'ticker' system. In other engines, such
|
||||
as [DIKU](https://en.wikipedia.org/wiki/DikuMUD), all game events are processed only at specific
|
||||
intervals called 'ticks'. Evennia has no such technical limitation (events are processed whenever
|
||||
needed) but using a fixed tick can still be useful for certain types of game systems, like combat.
|
||||
Ticker Handler allows you to emulate any number of tick rates (not just one) and subscribe actions
|
||||
to be called when those ticks come around.
|
||||
|
||||
### _typeclass_
|
||||
## _typeclass_
|
||||
|
||||
The [typeclass](Components/Typeclasses) is an Evennia-specific term. A typeclass allows developers to work with
|
||||
The [typeclass](Components/Typeclasses.md) is an Evennia-specific term. A typeclass allows developers to work with
|
||||
database-persistent objects as if they were normal Python objects. It makes use of specific
|
||||
[Django](./Glossary#django) features to link a Python class to a database table. Sometimes we refer to
|
||||
[Django](./Glossary.md#django) features to link a Python class to a database table. Sometimes we refer to
|
||||
such code entities as _being typeclassed_.
|
||||
|
||||
Evennia's main typeclasses are [Account](./Glossary#account), [Object](./Glossary#object),
|
||||
[Script](./Glossary#script) and [Channel](./Glossary#channel). Children of the base class (such as
|
||||
[Character](./Glossary#character)) will use the same database table as the parent, but can have vastly
|
||||
different Python capabilities (and persistent features through [Attributes](./Glossary#attributes) and
|
||||
[Tags](./Glossary#tags). A typeclass can be coded and treated pretty much like any other Python class
|
||||
Evennia's main typeclasses are [Account](./Glossary.md#account), [Object](./Glossary.md#object),
|
||||
[Script](./Glossary.md#script) and [Channel](./Glossary.md#channel). Children of the base class (such as
|
||||
[Character](./Glossary.md#character)) will use the same database table as the parent, but can have vastly
|
||||
different Python capabilities (and persistent features through [Attributes](./Glossary.md#attribute) and
|
||||
[Tags](./Glossary.md#tag). A typeclass can be coded and treated pretty much like any other Python class
|
||||
except it must inherit (at any distance) from one of the base typeclasses. Also, creating a new
|
||||
instance of a typeclass will add a new row to the database table to which it is linked.
|
||||
|
||||
The [core](./Glossary#core) typeclasses in the Evennia library are all named `DefaultAccount`,
|
||||
The [core](./Glossary.md#core) typeclasses in the Evennia library are all named `DefaultAccount`,
|
||||
`DefaultObject` etc. When you initialize your [game dir] you automatically get empty children of
|
||||
these, called `Account`, `Object` etc that you can start working with.
|
||||
|
||||
### _twisted_
|
||||
## _twisted_
|
||||
|
||||
[Twisted](https://twistedmatrix.com/trac/) is a heavy-duty asynchronous networking engine. It is one
|
||||
of Evennia's two major library dependencies (the other one is [Django](./Glossary#django)). Twisted is
|
||||
of Evennia's two major library dependencies (the other one is [Django](./Glossary.md#django)). Twisted is
|
||||
what "runs" Evennia - it handles Evennia's event loop. Twisted also has the building blocks we need
|
||||
to construct network protocols and communicate with the outside world; such as our MUD-custom
|
||||
version of Telnet, Telnet+SSL, SSH, webclient-websockets etc. Twisted also runs our integrated web
|
||||
server, serving the Django-based website for your game.
|
||||
|
||||
### _virtualenv_
|
||||
## _virtualenv_
|
||||
|
||||
The standard [virtualenv](https://virtualenv.pypa.io/en/stable/) program comes with Python. It is
|
||||
used to isolate all Python packages needed by a given Python project into one folder (we call that
|
||||
|
|
@ -328,18 +339,18 @@ referred to as "a virtualenv". If you ever try to run the `evennia` program and
|
|||
something like "the command 'evennia' is not available" - it's probably because your virtualenv is
|
||||
not 'active' yet (see below).
|
||||
|
||||
Usage:
|
||||
Usage:
|
||||
- `virtualenv <name>` - initialize a new virtualenv `<name>` in a new folder `<name>` in the current
|
||||
location. Called `evenv` in these docs.
|
||||
- `virtualenv -p path/to/alternate/python_executable <name>` - create a virtualenv using another
|
||||
Python version than default.
|
||||
- `source <folder_name>/bin/activate`(linux/mac) - activate the virtualenv in `<folder_name>`.
|
||||
- `<folder_name>\Scripts\activate` (windows)
|
||||
- `<folder_name>\Scripts\activate` (windows)
|
||||
- `deactivate` - turn off the currently activated virtualenv.
|
||||
|
||||
A virtualenv is 'activated' only for the console/terminal it was started in, but it's safe to
|
||||
activate the same virtualenv many times in different windows if you want. Once activated, all Python
|
||||
packages now installed with [pip](./Glossary#pip) will install to `evenv` rather than to a global
|
||||
packages now installed with [pip](./Glossary.md#pip) will install to `evenv` rather than to a global
|
||||
location like `/usr/local/bin` or `C:\Program Files`.
|
||||
|
||||
> Note that if you have root/admin access you *could* install Evennia globally just fine, without
|
||||
|
|
@ -355,11 +366,11 @@ your computer, you'll need to install it again in your virtualenv.
|
|||
care less if your virtualenv is active or not. So you could use `git` without the virtualenv being
|
||||
active, for example.
|
||||
|
||||
When your virtualenv is active you should see your console/terminal prompt change to
|
||||
When your virtualenv is active you should see your console/terminal prompt change to
|
||||
|
||||
(evenv) ...
|
||||
|
||||
... or whatever name you gave the virtualenv when you initialized it.
|
||||
... or whatever name you gave the virtualenv when you initialized it.
|
||||
|
||||
> We sometimes say that we are "in" the virtualenv when it's active. But just to be clear - you
|
||||
never have to actually `cd` into the `evenv` folder. You can activate it from anywhere and will
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# How To Get And Give Help
|
||||
|
||||
|
||||
### How to *get* Help
|
||||
## How to *get* Help
|
||||
|
||||
If you cannot find what you are looking for in the documentation, here's what to do:
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ have busy personal lives. So you might have to hang around for a while - you'll
|
|||
eventually!
|
||||
|
||||
|
||||
### How to *give* Help
|
||||
## How to *give* Help
|
||||
|
||||
Evennia is open-source and non-commercial. It relies on the time donated by its users and developers in order to progress.
|
||||
|
||||
|
|
@ -29,21 +29,21 @@ Evennia is open-source and non-commercial. It relies on the time donated by its
|
|||
- Take part in the Evennia community! Join the [chat][chat] or [forum][group].
|
||||
- Report problems you find or features you'd like to our [issue tracker](github:issue).
|
||||
|
||||
```important::
|
||||
```{important}
|
||||
Just the simple act of us know you are out there using Evennia helps a lot!
|
||||
```
|
||||
|
||||
If you'd like to help develop Evennia more hands-on, here are some ways to get going:
|
||||
|
||||
- Look through this [online documentation](./index#Evennia-documentation) and see if you can help improve or expand the
|
||||
documentation (even small things like fixing typos!). [See here](./Contributing-Docs) on how you
|
||||
- Look through this [online documentation](./index.md#evennia-documentation) and see if you can help improve or expand the
|
||||
documentation (even small things like fixing typos!). [See here](./Contributing-Docs.md) on how you
|
||||
contribute to the docs.
|
||||
- Send a message to our [discussion group][group] and/or our [IRC chat][chat] asking about what
|
||||
needs doing, along with what your interests and skills are.
|
||||
- Take a look at our [issue tracker][issues] and see if there's something you feel like taking on.
|
||||
[here are bugs][issues-master] that need fixes. At any given time there may also be some
|
||||
[bounties][issues-bounties] open.
|
||||
- Check out the [Contributing](./Contributing) page on how to practically contribute with code using
|
||||
- Check out the [Contributing](./Contributing.md) page on how to practically contribute with code using
|
||||
github.
|
||||
|
||||
... And finally, if you want to help motivate and support development you can also drop some coins
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
**Before doing this tutorial you will probably want to read the intro in
|
||||
[Basic Web tutorial](Starting/Part5/Web-Tutorial).** Reading the three first parts of the
|
||||
[Basic Web tutorial](Starting/Part5/Web-Tutorial.md).** Reading the three first parts of the
|
||||
[Django tutorial](https://docs.djangoproject.com/en/1.9/intro/tutorial01/) might help as well.
|
||||
|
||||
This tutorial will provide a step-by-step process to installing a wiki on your website.
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ Before we continue, let’s make a brief detour. Evennia is very flexible about
|
|||
more flexible about using and adding commands to those objects. Here are some ground rules well
|
||||
worth remembering for the remainder of this article:
|
||||
|
||||
- The [Account](../Components/Accounts) represents the real person logging in and has no game-world existence.
|
||||
- Any [Object](../Components/Objects) can be puppeted by an Account (with proper permissions).
|
||||
- [Characters](../Components/Objects#characters), [Rooms](../Components/Objects#rooms), and [Exits](../Components/Objects#exits) are just
|
||||
- The [Account](../Components/Accounts.md) represents the real person logging in and has no game-world existence.
|
||||
- Any [Object](../Components/Objects.md) can be puppeted by an Account (with proper permissions).
|
||||
- [Characters](../Components/Objects.md#characters), [Rooms](../Components/Objects.md#rooms), and [Exits](../Components/Objects.md#exits) are just
|
||||
children of normal Objects.
|
||||
- Any Object can be inside another (except if it creates a loop).
|
||||
- Any Object can store custom sets of commands on it. Those commands can:
|
||||
|
|
@ -121,7 +121,7 @@ about the missiles being fired and has different `key` and `aliases`. We leave
|
|||
that up to you to create as an exercise. You could have it print "WOOSH! The
|
||||
mech launches missiles against <target>!", for example.
|
||||
|
||||
Now we shove our commands into a command set. A [Command Set](../Components/Command-Sets) (CmdSet) is a container
|
||||
Now we shove our commands into a command set. A [Command Set](../Components/Command-Sets.md) (CmdSet) is a container
|
||||
holding any number of commands. The command set is what we will store on the mech.
|
||||
|
||||
```python
|
||||
|
|
@ -174,7 +174,7 @@ This is great for testing. The way we added it, the MechCmdSet will even go away
|
|||
server. Now we want to make the mech an actual object “type” so we can create mechs without those
|
||||
extra steps. For this we need to create a new Typeclass.
|
||||
|
||||
A [Typeclass](../Components/Typeclasses) is a near-normal Python class that stores its existence to the database
|
||||
A [Typeclass](../Components/Typeclasses.md) is a near-normal Python class that stores its existence to the database
|
||||
behind the scenes. A Typeclass is created in a normal Python source file:
|
||||
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -7,28 +7,28 @@ exists before answering - maybe you can clarify that answer rather than to make
|
|||
|
||||
## Table of Contents
|
||||
|
||||
- [Removing default commands](./Coding-FAQ#removing-default-commands)
|
||||
- [Preventing character from moving based on a condition](./Coding-FAQ#preventing-character-from-
|
||||
- [Removing default commands](./Coding-FAQ.md#removing-default-commands)
|
||||
- [Preventing character from moving based on a condition](./Coding-FAQ.md#preventing-character-from-
|
||||
moving-based-on-a-condition)
|
||||
- [Reference initiating object in an EvMenu command](./Coding-FAQ#reference-initiating-object-in-an-
|
||||
- [Reference initiating object in an EvMenu command](./Coding-FAQ.md#reference-initiating-object-in-an-
|
||||
evmenu-command)
|
||||
- [Adding color to default Evennia Channels](./Coding-FAQ#adding-color-to-default-evennia-channels)
|
||||
- [Selectively turn off commands in a room](./Coding-FAQ#selectively-turn-off-commands-in-a-room)
|
||||
- [Select Command based on a condition](./Coding-FAQ#select-command-based-on-a-condition)
|
||||
- [Automatically updating code when reloading](./Coding-FAQ#automatically-updating-code-when-
|
||||
- [Adding color to default Evennia Channels](./Coding-FAQ.md#adding-color-to-default-evennia-channels)
|
||||
- [Selectively turn off commands in a room](./Coding-FAQ.md#selectively-turn-off-commands-in-a-room)
|
||||
- [Select Command based on a condition](./Coding-FAQ.md#select-command-based-on-a-condition)
|
||||
- [Automatically updating code when reloading](./Coding-FAQ.md#automatically-updating-code-when-
|
||||
reloading)
|
||||
- [Changing all exit messages](./Coding-FAQ#changing-all-exit-messages)
|
||||
- [Add parsing with the "to" delimiter](./Coding-FAQ#add-parsing-with-the-to-delimiter)
|
||||
- [Store last used session IP address](./Coding-FAQ#store-last-used-session-ip-address)
|
||||
- [Use wide characters with EvTable](./Coding-FAQ#non-latin-characters-in-evtable)
|
||||
- [Changing all exit messages](./Coding-FAQ.md#changing-all-exit-messages)
|
||||
- [Add parsing with the "to" delimiter](./Coding-FAQ.md#add-parsing-with-the-to-delimiter)
|
||||
- [Store last used session IP address](./Coding-FAQ.md#store-last-used-session-ip-address)
|
||||
- [Use wide characters with EvTable](./Coding-FAQ.md#non-latin-characters-in-evtable)
|
||||
|
||||
## Removing default commands
|
||||
**Q:** How does one *remove* (not replace) e.g. the default `get` [Command](../Components/Commands) from the
|
||||
Character [Command Set](../Components/Command-Sets)?
|
||||
**Q:** How does one *remove* (not replace) e.g. the default `get` [Command](../Components/Commands.md) from the
|
||||
Character [Command Set](../Components/Command-Sets.md)?
|
||||
|
||||
**A:** Go to `mygame/commands/default_cmdsets.py`. Find the `CharacterCmdSet` class. It has one
|
||||
method named `at_cmdset_creation`. At the end of that method, add the following line:
|
||||
`self.remove(default_cmds.CmdGet())`. See the [Adding Commands Tutorial](Starting/Part1/Adding-Commands)
|
||||
`self.remove(default_cmds.CmdGet())`. See the [Adding Commands Tutorial](Starting/Part1/Adding-Commands.md)
|
||||
for more info.
|
||||
|
||||
## Preventing character from moving based on a condition
|
||||
|
|
@ -36,7 +36,7 @@ for more info.
|
|||
combat, immobilized, etc.)
|
||||
|
||||
**A:** The `at_before_move` hook is called by Evennia just before performing any move. If it returns
|
||||
`False`, the move is aborted. Let's say we want to check for an [Attribute](../Components/Attributes) `cantmove`.
|
||||
`False`, the move is aborted. Let's say we want to check for an [Attribute](../Components/Attributes.md) `cantmove`.
|
||||
Add the following code to the `Character` class:
|
||||
|
||||
```python
|
||||
|
|
@ -52,7 +52,7 @@ def at_before_move(self, destination):
|
|||
**Q:** An object has a Command on it starts up an EvMenu instance. How do I capture a reference to
|
||||
that object for use in the menu?
|
||||
|
||||
**A:** When an [EvMenu](../Components/EvMenu) is started, the menu object is stored as `caller.ndb._menutree`.
|
||||
**A:** When an [EvMenu](../Components/EvMenu.md) is started, the menu object is stored as `caller.ndb._menutree`.
|
||||
This is a good place to store menu-specific things since it will clean itself up when the menu
|
||||
closes. When initiating the menu, any additional keywords you give will be available for you as
|
||||
properties on this menu object:
|
||||
|
|
@ -100,7 +100,7 @@ CHANNEL_COLORS`.
|
|||
**Q:** I want certain commands to turn off in a given room. They should still work normally for
|
||||
staff.
|
||||
|
||||
**A:** This is done using a custom cmdset on a room [locked with the 'call' lock type](../Components/Locks). Only
|
||||
**A:** This is done using a custom cmdset on a room [locked with the 'call' lock type](../Components/Locks.md). Only
|
||||
if this lock is passed will the commands on the room be made available to an object inside it. Here
|
||||
is an example of a room where certain commands are disabled for non-staff:
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ superusers).
|
|||
command to only be available on a full moon, from midnight to three in-game time.
|
||||
|
||||
**A:** This is easiest accomplished by putting the "werewolf" command on the Character as normal,
|
||||
but to [lock](../Components/Locks) it with the "cmd" type lock. Only if the "cmd" lock type is passed will the
|
||||
but to [lock](../Components/Locks.md) it with the "cmd" type lock. Only if the "cmd" lock type is passed will the
|
||||
command be available.
|
||||
|
||||
```python
|
||||
|
|
@ -156,8 +156,8 @@ class CmdWerewolf(Command):
|
|||
def func(self):
|
||||
# ...
|
||||
```
|
||||
Add this to the [default cmdset as usual](Starting/Part1/Adding-Commands). The `is_full_moon` [lock
|
||||
function](Locks#lock-functions) does not yet exist. We must create that:
|
||||
Add this to the [default cmdset as usual](Starting/Part1/Adding-Commands.md). The `is_full_moon` [lock
|
||||
function](../Components/Locks.md#lock-functions) does not yet exist. We must create that:
|
||||
|
||||
```python
|
||||
# in mygame/server/conf/lockfuncs.py
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ a while. Such effects are called *cooldowns*.
|
|||
|
||||
This page exemplifies a very resource-efficient way to do cooldowns. A more
|
||||
'active' way is to use asynchronous delays as in the [command duration
|
||||
tutorial](Command-Duration#Blocking-Commands), the two might be useful to
|
||||
tutorial](./Command-Duration.md#blocking-commands), the two might be useful to
|
||||
combine if you want to echo some message to the user after the cooldown ends.
|
||||
|
||||
## Non-persistent cooldown
|
||||
|
|
@ -88,7 +88,7 @@ database, you need to use the caster for the storage.
|
|||
self.caller.db.firestorm_lastcast = now
|
||||
```
|
||||
|
||||
Since we are storing as an [Attribute](../Components/Attributes), we need to identify the
|
||||
Since we are storing as an [Attribute](../Components/Attributes.md), we need to identify the
|
||||
variable as `firestorm_lastcast` so we are sure we get the right one (we'll
|
||||
likely have other skills with cooldowns after all). But this method of
|
||||
using cooldowns also has the advantage of working *between* commands - you can
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
Before reading this tutorial, if you haven't done so already, you might want to
|
||||
read [the documentation on commands](../Components/Commands) to get a basic understanding of
|
||||
read [the documentation on commands](../Components/Commands.md) to get a basic understanding of
|
||||
how commands work in Evennia.
|
||||
|
||||
In some types of games a command should not start and finish immediately.
|
||||
|
|
@ -40,7 +40,7 @@ class CmdTest(Command):
|
|||
> Important: The `yield` functionality will *only* work in the `func` method of
|
||||
> Commands. It only works because Evennia has especially
|
||||
> catered for it in Commands. If you want the same functionality elsewhere you
|
||||
> must use the [interactive decorator](../Concepts/Async-Process#The-@interactive-decorator).
|
||||
> must use the [interactive decorator](../Concepts/Async-Process.md#the-interactive-decorator).
|
||||
|
||||
The important line is the `yield 10`. It tells Evennia to "pause" the command
|
||||
and to wait for 10 seconds to execute the rest. If you add this command and
|
||||
|
|
@ -187,7 +187,7 @@ start crafting a shield at the same time, or if you just did a huge power-swing
|
|||
should not be able to do it again immediately.
|
||||
|
||||
The simplest way of implementing blocking is to use the technique covered in the [Command
|
||||
Cooldown](Command-Cooldown) tutorial. In that tutorial we implemented cooldowns by having the
|
||||
Cooldown](./Command-Cooldown.md) tutorial. In that tutorial we implemented cooldowns by having the
|
||||
Command store the current time. Next time the Command was called, we compared the current time to
|
||||
the stored time to determine if enough time had passed for a renewed use. This is a *very*
|
||||
efficient, reliable and passive solution. The drawback is that there is nothing to tell the Player
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ You can combine the sending of normal text with the sending (updating of the pro
|
|||
self.msg("This is a text", prompt="This is a prompt")
|
||||
```
|
||||
|
||||
You can update the prompt on demand, this is normally done using [OOB](../Concepts/OOB)-tracking of the relevant
|
||||
You can update the prompt on demand, this is normally done using [OOB](../Concepts/OOB.md)-tracking of the relevant
|
||||
Attributes (like the character's health). You could also make sure that attacking commands update
|
||||
the prompt when they cause a change in health, for example.
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ instance.
|
|||
## Coordinates as tags
|
||||
|
||||
The first concept might be the most surprising at first glance: we will create coordinates as
|
||||
[tags](../Components/Tags).
|
||||
[tags](../Components/Tags.md).
|
||||
|
||||
> Why not attributes, wouldn't that be easier?
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
|
||||
Evennia allows for exits to have any name. The command "kitchen" is a valid exit name as well as
|
||||
"jump out the window" or "north". An exit actually consists of two parts: an [Exit Object](../Components/Objects)
|
||||
and an [Exit Command](../Components/Commands) stored on said exit object. The command has the same key and aliases
|
||||
"jump out the window" or "north". An exit actually consists of two parts: an [Exit Object](../Components/Objects.md)
|
||||
and an [Exit Command](../Components/Commands.md) stored on said exit object. The command has the same key and aliases
|
||||
as the object, which is why you can see the exit in the room and just write its name to traverse it.
|
||||
|
||||
If you try to enter the name of a non-existing exit, it is thus the same as trying a non-exising
|
||||
|
|
@ -24,7 +24,7 @@ error message just told us that we couldn't go there.
|
|||
|
||||
## Adding default error commands
|
||||
|
||||
To solve this you need to be aware of how to [write and add new commands](Starting/Part1/Adding-Commands).
|
||||
To solve this you need to be aware of how to [write and add new commands](Starting/Part1/Adding-Commands.md).
|
||||
What you need to do is to create new commands for all directions you want to support in your game.
|
||||
In this example all we'll do is echo an error message, but you could certainly consider more
|
||||
advanced uses. You add these commands to the default command set. Here is an example of such a set
|
||||
|
|
@ -90,7 +90,7 @@ commands:
|
|||
You cannot move east.
|
||||
|
||||
Further expansions by the exit system (including manipulating the way the Exit command itself is
|
||||
created) can be done by modifying the [Exit typeclass](../Components/Typeclasses) directly.
|
||||
created) can be done by modifying the [Exit typeclass](../Components/Typeclasses.md) directly.
|
||||
|
||||
## Additional Comments
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ So why didn't we create a single error command above? Something like this:
|
|||
The anwer is that this would *not* work and understanding why is important in order to not be
|
||||
confused when working with commands and command sets.
|
||||
|
||||
The reason it doesn't work is because Evennia's [command system](../Components/Commands) compares commands *both*
|
||||
The reason it doesn't work is because Evennia's [command system](../Components/Commands.md) compares commands *both*
|
||||
by `key` and by `aliases`. If *either* of those match, the two commands are considered *identical*
|
||||
as far as cmdset merging system is concerned.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ all that important for a text-based game. The main advantages of Python are an e
|
|||
development cycle and easy ways to create game systems. Doing the same with C can take many times
|
||||
more code and be harder to make stable and maintainable.
|
||||
|
||||
### Core Differences
|
||||
## Core Differences
|
||||
|
||||
- As mentioned, the main difference between Evennia and a Diku-derived codebase is that Evennia is
|
||||
written purely in Python. Since Python is an interpreted language there is no compile stage. It is
|
||||
|
|
@ -28,7 +28,7 @@ while writing to a flatfile it may become corrupt and the data lost. A proper da
|
|||
not susceptible to this - at no point is the data in a state where it cannot be recovered. Databases
|
||||
are also highly optimized for querying large data sets efficiently.
|
||||
|
||||
### Some Familiar Things
|
||||
## Some Familiar Things
|
||||
|
||||
Diku expresses the character object referenced normally by:
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ class CmdMyCmd(Command):
|
|||
"""
|
||||
This is a Command Evennia Object
|
||||
"""
|
||||
|
||||
|
||||
[...]
|
||||
|
||||
def func(self):
|
||||
|
|
@ -136,7 +136,7 @@ Puff~
|
|||
Puff the Fractal Dragon is here, contemplating a higher reality.
|
||||
~
|
||||
Is that some type of differential curve involving some strange, and unknown
|
||||
calculus that she seems to be made out of?
|
||||
calculus that she seems to be made out of?
|
||||
~
|
||||
516106 0 0 0 2128 0 0 0 1000 E
|
||||
34 9 -10 6d6+340 5d5+5
|
||||
|
|
@ -145,7 +145,7 @@ calculus that she seems to be made out of?
|
|||
BareHandAttack: 12
|
||||
E
|
||||
T 95
|
||||
```
|
||||
```
|
||||
Each line represents something that the MUD reads in and does something with it. This isn't easy to
|
||||
read, but let's see if we can emulate this as a dictionary to be stored on a database script created
|
||||
in Evennia.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ to use. So the *Player* usually operates by making use of the tools prepared for
|
|||
|
||||
For a *Player*, collaborating on a game need not be too different between MUSH and Evennia. The
|
||||
building and description of the game world can still happen mostly in-game using build commands,
|
||||
using text tags and [inline functions](../Concepts/TextTags#inline-functions) to prettify and customize the
|
||||
using text tags and [inline functions](../Components/FuncParser.md) to prettify and customize the
|
||||
experience. Evennia offers external ways to build a world but those are optional. There is also
|
||||
nothing *in principle* stopping a Developer from offering a softcode-like language to Players if
|
||||
that is deemed necessary.
|
||||
|
|
@ -88,7 +88,7 @@ based inheritance of MUSH.
|
|||
|
||||
There are other differences for sure, but that should give some feel for things. Enough with the
|
||||
theory. Let's get down to more practical matters next. To install, see the
|
||||
[Getting Started instructions](../Setup/Setup-Quickstart).
|
||||
[Getting Started instructions](../Setup/Setup-Quickstart.md).
|
||||
|
||||
## A first step making things more familiar
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ developer changing the underlying Python code.
|
|||
## Next steps
|
||||
|
||||
If you are a *Developer* and are interested in making a more MUSH-like Evennia game, a good start is
|
||||
to look into the Evennia [Tutorial for a first MUSH-like game](Starting/Part3/Tutorial-for-basic-MUSH-like-game).
|
||||
to look into the Evennia [Tutorial for a first MUSH-like game](Starting/Part3/Tutorial-for-basic-MUSH-like-game.md).
|
||||
That steps through building a simple little game from scratch and helps to acquaint you with the
|
||||
various corners of Evennia. There is also the [Tutorial for running roleplaying sessions](Evennia-
|
||||
for-roleplaying-sessions) that can be of interest.
|
||||
|
|
@ -211,8 +211,8 @@ for-roleplaying-sessions) that can be of interest.
|
|||
An important aspect of making things more familiar for *Players* is adding new and tweaking existing
|
||||
commands. How this is done is covered by the [Tutorial on adding new commands](Adding-Command-
|
||||
Tutorial). You may also find it useful to shop through the `evennia/contrib/` folder. The
|
||||
[Tutorial world](Starting/Part1/Tutorial-World-Introduction) is a small single-player quest you can try (it’s not very MUSH-
|
||||
like but it does show many Evennia concepts in action). Beyond that there are [many more tutorials](./Howto-Overview)
|
||||
[Tutorial world](Starting/Part1/Tutorial-World-Introduction.md) is a small single-player quest you can try (it’s not very MUSH-
|
||||
like but it does show many Evennia concepts in action). Beyond that there are [many more tutorials](./Howto-Overview.md)
|
||||
to try out. If you feel you want a more visual overview you can also look at
|
||||
[Evennia in pictures](https://evennia.blogspot.se/2016/05/evennia-in-pictures.html).
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ defaults for our particular use-case. Below we will flesh out these components f
|
|||
|
||||
## Starting out
|
||||
|
||||
We will assume you start from scratch. You need Evennia installed, as per the [Setup Quickstart](../Setup/Setup-Quickstart)
|
||||
We will assume you start from scratch. You need Evennia installed, as per the [Setup Quickstart](../Setup/Setup-Quickstart.md)
|
||||
instructions. Initialize a new game directory with `evennia init
|
||||
<gamedirname>`. In this tutorial we assume your game dir is simply named `mygame`. You can use the
|
||||
default database and keep all other settings to default for now. Familiarize yourself with the
|
||||
`mygame` folder before continuing. You might want to browse the
|
||||
[First Steps Coding](Starting/Part1/Starting-Part1) tutorial, just to see roughly where things are modified.
|
||||
[First Steps Coding](Starting/Part1/Starting-Part1.md) tutorial, just to see roughly where things are modified.
|
||||
|
||||
## The Game Master role
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ to show your renewed GM status to the other accounts.
|
|||
|
||||
### The permission hierarchy
|
||||
|
||||
Evennia has the following [permission hierarchy](../Concepts/Building-Permissions#assigning-permissions) out of
|
||||
Evennia has the following [permission hierarchy](../Concepts/Building-Permissions.md#assigning-permissions) out of
|
||||
the box: *Players, Helpers, Builders, Admins* and finally *Developers*. We could change these but
|
||||
then we'd need to update our Default commands to use the changes. We want to keep this simple, so
|
||||
instead we map our different roles on top of this permission ladder.
|
||||
|
|
@ -60,7 +60,7 @@ everyone.
|
|||
5. `Developers`-level permission are the server administrators, the ones with the ability to
|
||||
restart/shutdown the server as well as changing the permission levels.
|
||||
|
||||
> The [superuser](../Concepts/Building-Permissions#the-super-user) is not part of the hierarchy and actually
|
||||
> The [superuser](../Concepts/Building-Permissions.md#the-super-user) is not part of the hierarchy and actually
|
||||
completely bypasses it. We'll assume server admin(s) will "just" be Developers.
|
||||
|
||||
### How to grant permissions
|
||||
|
|
@ -102,7 +102,7 @@ its name will have the string`(GM)` added to the end.
|
|||
#### Character modification
|
||||
|
||||
Let's first start by customizing the Character. We recommend you browse the beginning of the
|
||||
[Account](../Components/Accounts) page to make sure you know how Evennia differentiates between the OOC "Account
|
||||
[Account](../Components/Accounts.md) page to make sure you know how Evennia differentiates between the OOC "Account
|
||||
objects" (not to be confused with the `Accounts` permission, which is just a string specifying your
|
||||
access) and the IC "Character objects".
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ Above, we change how the Character's name is displayed: If the account controlli
|
|||
a GM, we attach the string `(GM)` to the Character's name so everyone can tell who's the boss. If we
|
||||
ourselves are Developers or GM's we will see database ids attached to Characters names, which can
|
||||
help if doing database searches against Characters of exactly the same name. We base the "gm-
|
||||
ingness" on having an flag (an [Attribute](../Components/Attributes)) named `is_gm`. We'll make sure new GM's
|
||||
ingness" on having an flag (an [Attribute](../Components/Attributes.md)) named `is_gm`. We'll make sure new GM's
|
||||
actually get this flag below.
|
||||
|
||||
> **Extra exercise:** This will only show the `(GM)` text on *Characters* puppeted by a GM account,
|
||||
|
|
@ -151,7 +151,7 @@ that is, it will show only to those in the same location. If we wanted it to als
|
|||
|
||||
#### New @gm/@ungm command
|
||||
|
||||
We will describe in some detail how to create and add an Evennia [command](../Components/Commands) here with the
|
||||
We will describe in some detail how to create and add an Evennia [command](../Components/Commands.md) here with the
|
||||
hope that we don't need to be as detailed when adding commands in the future. We will build on
|
||||
Evennia's default "mux-like" commands here.
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ We will here show two examples using the *EvTable* and *EvForm* utilities.Later
|
|||
Commands to edit and display the output from those utilities.
|
||||
|
||||
> Note that due to the limitations of the wiki, no color is used in any of the examples. See
|
||||
> [the text tag documentation](../Concepts/TextTags) for how to add color to the tables and forms.
|
||||
> [the text tag documentation](../Concepts/TextTags.md) for how to add color to the tables and forms.
|
||||
|
||||
#### Making a sheet with EvTable
|
||||
|
||||
|
|
@ -686,7 +686,7 @@ implemented.
|
|||
## Rooms
|
||||
|
||||
Evennia comes with rooms out of the box, so no extra work needed. A GM will automatically have all
|
||||
needed building commands available. A fuller go-through is found in the [Building tutorial](Starting/Part1/Building-Quickstart).
|
||||
needed building commands available. A fuller go-through is found in the [Building tutorial](Starting/Part1/Building-Quickstart.md).
|
||||
Here are some useful highlights:
|
||||
|
||||
* `@dig roomname;alias = exit_there;alias, exit_back;alias` - this is the basic command for digging
|
||||
|
|
@ -704,7 +704,7 @@ access after the fact.
|
|||
|
||||
## Channels
|
||||
|
||||
Evennia comes with [Channels](../Components/Communications#Channels) in-built and they are described fully in the
|
||||
Evennia comes with [Channels](../Components/Channels.md) in-built and they are described fully in the
|
||||
documentation. For brevity, here are the relevant commands for normal use:
|
||||
|
||||
* `@ccreate new_channel;alias;alias = short description` - Creates a new channel.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ names for its time units or might even use a completely custom calendar. You don
|
|||
game time system at all. But if you do, Evennia offers basic tools to handle these various
|
||||
situations. This tutorial will walk you through these features.
|
||||
|
||||
### A game time with a standard calendar
|
||||
## A game time with a standard calendar
|
||||
|
||||
Many games let their in-game time run faster or slower than real time, but still use our normal
|
||||
real-world calendar. This is common both for games set in present day as well as for games in
|
||||
|
|
@ -21,7 +21,7 @@ automatically handled by the system.
|
|||
Evennia's game time features assume a standard calendar (see the relevant section below for a custom
|
||||
calendar).
|
||||
|
||||
#### Setting up game time for a standard calendar
|
||||
### Setting up game time for a standard calendar
|
||||
|
||||
All is done through the settings. Here are the settings you should use if you want a game time with
|
||||
a standard calendar:
|
||||
|
|
@ -91,14 +91,14 @@ The line that is most relevant here is the game time epoch. You see it shown at
|
|||
this point forward, the game time keeps increasing. If you keep typing `@time`, you'll see the game
|
||||
time updated correctly... and going (by default) twice as fast as the real time.
|
||||
|
||||
#### Time-related events
|
||||
### Time-related events
|
||||
|
||||
The `gametime` utility also has a way to schedule game-related events, taking into account your game
|
||||
time, and assuming a standard calendar (see below for the same feature with a custom calendar). For
|
||||
instance, it can be used to have a specific message every (in-game) day at 6:00 AM showing how the
|
||||
sun rises.
|
||||
|
||||
The function `schedule()` should be used here. It will create a [script](../Components/Scripts) with some
|
||||
The function `schedule()` should be used here. It will create a [script](../Components/Scripts.md) with some
|
||||
additional features to make sure the script is always executed when the game time matches the given
|
||||
parameters.
|
||||
|
||||
|
|
@ -110,12 +110,12 @@ repeatedly.
|
|||
- Additional keyword arguments `sec`, `min`, `hour`, `day`, `month` and `year` to describe the time
|
||||
to schedule. If the parameter isn't given, it assumes the current time value of this specific unit.
|
||||
|
||||
Here is a short example for making the sun rise every day:
|
||||
Here is a short example for making the sun rise every day:
|
||||
|
||||
```python
|
||||
# in a file ingame_time.py in mygame/world/
|
||||
|
||||
from evennia.utils import gametime
|
||||
from evennia.utils import gametime
|
||||
from typeclasses.rooms import Room
|
||||
|
||||
def at_sunrise():
|
||||
|
|
@ -166,7 +166,7 @@ days.
|
|||
Evennia handles custom calendars through an optional *contrib* module, called `custom_gametime`.
|
||||
Contrary to the normal `gametime` module described above it is not active by default.
|
||||
|
||||
#### Setting up the custom calendar
|
||||
### Setting up the custom calendar
|
||||
|
||||
In our first example of the Shire calendar, used by hobbits in books by Tolkien, we don't really
|
||||
need the notion of weeks... but we need the notion of months having 30 days, not 28.
|
||||
|
|
@ -194,7 +194,7 @@ configuration: instead, we skip from days to months directly.
|
|||
In order for this setting to work properly, remember all units have to be multiples of the previous
|
||||
units. If you create "day", it needs to be multiple of hours, for instance.
|
||||
|
||||
So for our example, our settings may look like this:
|
||||
So for our example, our settings may look like this:
|
||||
|
||||
```python
|
||||
# in a file settings.py in mygame/server/conf
|
||||
|
|
@ -263,7 +263,7 @@ Don't forget to add it in your CharacterCmdSet to see this command:
|
|||
```python
|
||||
# in mygame/commands/default_cmdset.py
|
||||
|
||||
from commands.gametime import CmdTime # <-- Add
|
||||
from commands.gametime import CmdTime # <-- Add
|
||||
|
||||
# ...
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
Populates the cmdset
|
||||
"""
|
||||
super().at_cmdset_creation()
|
||||
# ...
|
||||
# ...
|
||||
self.add(CmdTime()) # <- Add
|
||||
```
|
||||
|
||||
|
|
@ -293,9 +293,9 @@ it, you might see something like:
|
|||
You could display it a bit more prettily with names for months and perhaps even days, if you want.
|
||||
And if "months" are called "moons" in your game, this is where you'd add that.
|
||||
|
||||
#### Time-related events in custom gametime
|
||||
## Time-related events in custom gametime
|
||||
|
||||
The `custom_gametime` module also has a way to schedule game-related events, taking into account
|
||||
your game time (and your custom calendar). It can be used to have a specific message every day at
|
||||
6:00 AM, to show the sun rises, for instance. The `custom_gametime.schedule` function works in the
|
||||
same way as described for the default one above.
|
||||
same way as described for the default one above.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
The documents in this section aims to teach how to use Evennia in a tutorial or
|
||||
a step-by-step way. They often give hints on about solving a problem or implementing
|
||||
a particular feature or concept. They will often refer to the
|
||||
[components](../Components/Components-Overview) or [concepts](../Concepts/Concepts-Overview)
|
||||
[components](../Components/Components-Overview.md) or [concepts](../Concepts/Concepts-Overview.md)
|
||||
docs for those that want to dive deeper.
|
||||
|
||||
## The Starting Tutorial
|
||||
|
|
@ -14,92 +14,92 @@ in mind for your own game, this will give you a good start.
|
|||
|
||||
### Part 1: What we have
|
||||
|
||||
1. [Introduction & Overview](Starting/Part1/Starting-Part1)
|
||||
1. [Building stuff](Starting/Part1/Building-Quickstart)
|
||||
1. [The Tutorial World](Starting/Part1/Tutorial-World-Introduction)
|
||||
1. [Python basics](Starting/Part1/Python-basic-introduction)
|
||||
1. [Game dir overview](Starting/Part1/Gamedir-Overview)
|
||||
1. [Python classes and objects](Starting/Part1/Python-classes-and-objects)
|
||||
1. [Accessing the Evennia library](Starting/Part1/Evennia-Library-Overview)
|
||||
1. [Typeclasses - Persistent objects](Starting/Part1/Learning-Typeclasses)
|
||||
1. [Making our first own commands](Starting/Part1/Adding-Commands)
|
||||
1. [Parsing and replacing default Commands](Starting/Part1/More-on-Commands)
|
||||
1. [Creating things](Starting/Part1/Creating-Things)
|
||||
1. [Searching for things](Starting/Part1/Searching-Things)
|
||||
1. [Advanced searching with Django queries](Starting/Part1/Django-queries)
|
||||
1. [Introduction & Overview](Starting/Part1/Starting-Part1.md)
|
||||
1. [Building stuff](Starting/Part1/Building-Quickstart.md)
|
||||
1. [The Tutorial World](Starting/Part1/Tutorial-World-Introduction.md)
|
||||
1. [Python basics](Starting/Part1/Python-basic-introduction.md)
|
||||
1. [Game dir overview](Starting/Part1/Gamedir-Overview.md)
|
||||
1. [Python classes and objects](Starting/Part1/Python-classes-and-objects.md)
|
||||
1. [Accessing the Evennia library](Starting/Part1/Evennia-Library-Overview.md)
|
||||
1. [Typeclasses - Persistent objects](Starting/Part1/Learning-Typeclasses.md)
|
||||
1. [Making our first own commands](Starting/Part1/Adding-Commands.md)
|
||||
1. [Parsing and replacing default Commands](Starting/Part1/More-on-Commands.md)
|
||||
1. [Creating things](Starting/Part1/Creating-Things.md)
|
||||
1. [Searching for things](Starting/Part1/Searching-Things.md)
|
||||
1. [Advanced searching with Django queries](Starting/Part1/Django-queries.md)
|
||||
|
||||
### Part 2: What we want
|
||||
|
||||
1. [Introduction & Overview](Starting/Part2/Starting-Part2)
|
||||
1. [On planning a game](Starting/Part2/Game-Planning)
|
||||
1. [Planning to use some useful Contribs](Starting/Part2/Planning-Some-Useful-Contribs)
|
||||
1. [Introduction & Overview](Starting/Part2/Starting-Part2.md)
|
||||
1. [On planning a game](Starting/Part2/Game-Planning.md)
|
||||
1. [Planning to use some useful Contribs](Starting/Part2/Planning-Some-Useful-Contribs.md)
|
||||
|
||||
### Part3: How we get there
|
||||
|
||||
1. [Introduction & Overview](Starting/Part3/Starting-Part3)
|
||||
1. [Making a custom Character](Starting/Part3/Implementing-a-game-rule-system)
|
||||
1. [Character generation](../Unimplemented)
|
||||
1. [Resolving skills and challenges](../Unimplemented)
|
||||
1. [NPCs and mobiles](./Coordinates)
|
||||
1. [Quests and Zones](../Unimplemented)
|
||||
1. [A Combat system](../Unimplemented)
|
||||
1. [Introduction & Overview](Starting/Part3/Starting-Part3.md)
|
||||
1. [Making a custom Character](Starting/Part3/Implementing-a-game-rule-system.md)
|
||||
1. [Character generation](../Unimplemented.md)
|
||||
1. [Resolving skills and challenges](../Unimplemented.md)
|
||||
1. [NPCs and mobiles](./Coordinates.md)
|
||||
1. [Quests and Zones](../Unimplemented.md)
|
||||
1. [A Combat system](../Unimplemented.md)
|
||||
|
||||
### Part 4: Using what we created
|
||||
|
||||
1. [Introduction & Overview](Starting/Part4/Starting-Part4)
|
||||
1. [Building the tech demo](../Unimplemented)
|
||||
1. [Creating a game world](../Unimplemented)
|
||||
1. [Introduction & Overview](Starting/Part4/Starting-Part4.md)
|
||||
1. [Building the tech demo](../Unimplemented.md)
|
||||
1. [Creating a game world](../Unimplemented.md)
|
||||
|
||||
### Part 5: Showing the world
|
||||
|
||||
1. [Introduction & Overview](Starting/Part5/Starting-Part5)
|
||||
1. [Add a web page](Starting/Part5/Add-a-simple-new-web-page)
|
||||
1. [More on adding web features](Starting/Part5/Web-Tutorial)
|
||||
1. [Taking your game online](../Unimplemented)
|
||||
1. [Next steps](../Unimplemented)
|
||||
1. [Introduction & Overview](Starting/Part5/Starting-Part5.md)
|
||||
1. [Add a web page](Starting/Part5/Add-a-simple-new-web-page.md)
|
||||
1. [More on adding web features](Starting/Part5/Web-Tutorial.md)
|
||||
1. [Taking your game online](../Unimplemented.md)
|
||||
1. [Next steps](../Unimplemented.md)
|
||||
|
||||
|
||||
## FAQs
|
||||
|
||||
- [Coding FAQ](./Coding-FAQ)
|
||||
- [Coding FAQ](./Coding-FAQ.md)
|
||||
|
||||
## Howto's
|
||||
|
||||
- [Giving Exits a default error](./Default-Exit-Errors)
|
||||
- [Add a command prompt](./Command-Prompt)
|
||||
- [Don't allow spamming commands](./Command-Cooldown)
|
||||
- [Commands that take time](./Command-Duration)
|
||||
- [Configuring color](./Manually-Configuring-Color)
|
||||
- [Tweet game stats](./Tutorial-Tweeting-Game-Stats)
|
||||
- [Giving Exits a default error](./Default-Exit-Errors.md)
|
||||
- [Add a command prompt](./Command-Prompt.md)
|
||||
- [Don't allow spamming commands](./Command-Cooldown.md)
|
||||
- [Commands that take time](./Command-Duration.md)
|
||||
- [Configuring color](./Manually-Configuring-Color.md)
|
||||
- [Tweet game stats](./Tutorial-Tweeting-Game-Stats.md)
|
||||
|
||||
## Mobs and NPCs
|
||||
|
||||
- [NPCs that listen to you](./Tutorial-NPCs-listening)
|
||||
- [Mobs that attack you](./Tutorial-Aggressive-NPCs)
|
||||
- [Shopkeepers](./NPC-shop-Tutorial)
|
||||
- [NPCs that listen to you](./Tutorial-NPCs-listening.md)
|
||||
- [Mobs that attack you](./Tutorial-Aggressive-NPCs.md)
|
||||
- [Shopkeepers](./NPC-shop-Tutorial.md)
|
||||
|
||||
## Vehicles
|
||||
|
||||
- [Building a mech](./Building-a-mech-tutorial)
|
||||
- [Building a train](./Tutorial-Vehicles)
|
||||
- [Building a mech](./Building-a-mech-tutorial.md)
|
||||
- [Building a train](./Tutorial-Vehicles.md)
|
||||
|
||||
## Systems
|
||||
|
||||
- [Understanding In-game time](./Gametime-Tutorial)
|
||||
- [Understanding the Help system](./Help-System-Tutorial)
|
||||
- [Adding mass to objects](./Mass-and-weight-for-objects)
|
||||
- [Add weather](./Weather-Tutorial)
|
||||
- [Understanding In-game time](./Gametime-Tutorial.md)
|
||||
- [Understanding the Help system](./Help-System-Tutorial.md)
|
||||
- [Adding mass to objects](./Mass-and-weight-for-objects.md)
|
||||
- [Add weather](./Weather-Tutorial.md)
|
||||
|
||||
## Web-related tutorials
|
||||
|
||||
- [Add a wiki](./Add-a-wiki-on-your-website)
|
||||
- [A web-based character generation](./Web-Character-Generation)
|
||||
- [View Character on website](./Web-Character-View-Tutorial)
|
||||
- [Add a wiki](./Add-a-wiki-on-your-website.md)
|
||||
- [A web-based character generation](./Web-Character-Generation.md)
|
||||
- [View Character on website](./Web-Character-View-Tutorial.md)
|
||||
|
||||
## Deep-dives
|
||||
|
||||
- [Parsing command inputs](./Parsing-commands-tutorial)
|
||||
- [Understanding color-tags](./Understanding-Color-Tags)
|
||||
- [Play paper&pen RPGs online with Evennia](./Evennia-for-roleplaying-sessions)
|
||||
- [Evennia for Diku Users](./Evennia-for-Diku-Users)
|
||||
- [Evennia for MUSH-Users](./Evennia-for-MUSH-Users)
|
||||
- [Parsing command inputs](./Parsing-commands-tutorial.md)
|
||||
- [Understanding color-tags](./Understanding-Color-Tags.md)
|
||||
- [Play paper&pen RPGs online with Evennia](./Evennia-for-roleplaying-sessions.md)
|
||||
- [Evennia for Diku Users](./Evennia-for-Diku-Users.md)
|
||||
- [Evennia for MUSH-Users](./Evennia-for-MUSH-Users.md)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This is a small tutorial for customizing your character objects, using the examp
|
|||
turn on and off ANSI color parsing as an example. `@options NOCOLOR=True` will now do what this
|
||||
tutorial shows, but the tutorial subject can be applied to other toggles you may want, as well.
|
||||
|
||||
In the Building guide's [Colors](../Concepts/TextTags#coloured-text) page you can learn how to add color to your
|
||||
In the Building guide's [Colors](../Concepts/Colors.md) page you can learn how to add color to your
|
||||
game by using special markup. Colors enhance the gaming experience, but not all users want color.
|
||||
Examples would be users working from clients that don't support color, or people with various seeing
|
||||
disabilities that rely on screen readers to play your game. Also, whereas Evennia normally
|
||||
|
|
@ -26,7 +26,7 @@ configuration system for your characters. This is the basic sequence:
|
|||
Create a new module in `mygame/typeclasses` named, for example, `mycharacter.py`. Alternatively you
|
||||
can simply add a new class to 'mygamegame/typeclasses/characters.py'.
|
||||
|
||||
In your new module(or characters.py), create a new [Typeclass](../Components/Typeclasses) inheriting from
|
||||
In your new module(or characters.py), create a new [Typeclass](../Components/Typeclasses.md) inheriting from
|
||||
`evennia.DefaultCharacter`. We will also import `evennia.utils.ansi`, which we will use later.
|
||||
|
||||
```python
|
||||
|
|
@ -39,7 +39,7 @@ In your new module(or characters.py), create a new [Typeclass](../Components/Typ
|
|||
self.db.config_color = True
|
||||
```
|
||||
|
||||
Above we set a simple config value as an [Attribute](../Components/Attributes).
|
||||
Above we set a simple config value as an [Attribute](../Components/Attributes.md).
|
||||
|
||||
Let's make sure that new characters are created of this type. Edit your
|
||||
`mygame/server/conf/settings.py` file and add/change `BASE_CHARACTER_TYPECLASS` to point to your new
|
||||
|
|
@ -158,7 +158,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
|
||||
## More colors
|
||||
|
||||
Apart from ANSI colors, Evennia also supports **Xterm256** colors (See [Colors](../Concepts/TextTags#colored-
|
||||
Apart from ANSI colors, Evennia also supports **Xterm256** colors (See [Colors](../Concepts/TextTags.md#colored-
|
||||
text)). The `msg()` method supports the `xterm256` keyword for manually activating/deactiving
|
||||
xterm256. It should be easy to expand the above example to allow players to customize xterm256
|
||||
regardless of if Evennia thinks their client supports it or not.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ determine a character's burden weight for travel speed... The total mass of an
|
|||
contribute to the force of a weapon swing, or a speeding meteor to give it a potential striking
|
||||
force.
|
||||
|
||||
#### Objects
|
||||
## Objects
|
||||
|
||||
Now that we have reasons for keeping track of object mass, let's look at the default object class
|
||||
inside your mygame/typeclasses/objects.py and see how easy it is to total up mass from an object and
|
||||
|
|
@ -36,7 +36,7 @@ default for Heavy types to something much larger than 1 gram or whatever unit yo
|
|||
non-default mass would be stored on the `mass` [[Attributes]] of the objects.
|
||||
|
||||
|
||||
#### Characters and rooms
|
||||
## Characters and rooms
|
||||
|
||||
You can add a `get_mass` definition to characters and rooms, also.
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ else:
|
|||
pass # Danger! Alarm sounds, cable snaps, elevator stops...
|
||||
```
|
||||
|
||||
#### Inventory
|
||||
## Inventory
|
||||
Example of listing mass of items in your inventory:
|
||||
|
||||
```python
|
||||
|
|
@ -95,4 +95,4 @@ class CmdInventory(MuxCommand):
|
|||
string = f"|wYou are carrying:\n{table}"
|
||||
self.caller.msg(string)
|
||||
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# NPC shop Tutorial
|
||||
|
||||
This tutorial will describe how to make an NPC-run shop. We will make use of the [EvMenu](../Components/EvMenu)
|
||||
This tutorial will describe how to make an NPC-run shop. We will make use of the [EvMenu](../Components/EvMenu.md)
|
||||
system to present shoppers with a menu where they can buy things from the store's stock.
|
||||
|
||||
Our shop extends over two rooms - a "front" room open to the shop's customers and a locked "store
|
||||
|
|
@ -19,13 +19,13 @@ compare it to the `gold` Attribute of the customer. If enough gold is available,
|
|||
deducted and the goods transferred from the store room to the inventory of the customer.
|
||||
- We will lock the store room so that only people with the right key can get in there.
|
||||
|
||||
### The shop menu
|
||||
## The shop menu
|
||||
|
||||
We want to show a menu to the customer where they can list, examine and buy items in the store. This
|
||||
menu should change depending on what is currently for sale. Evennia's *EvMenu* utility will manage
|
||||
the menu for us. It's a good idea to [read up on EvMenu](../Components/EvMenu) if you are not familiar with it.
|
||||
the menu for us. It's a good idea to [read up on EvMenu](../Components/EvMenu.md) if you are not familiar with it.
|
||||
|
||||
#### Designing the menu
|
||||
### Designing the menu
|
||||
|
||||
The shopping menu's design is straightforward. First we want the main screen. You get this when you
|
||||
enter a shop and use the `browse` or `buy` command:
|
||||
|
|
@ -64,7 +64,7 @@ You cannot afford 5 gold for A rusty sword!
|
|||
```
|
||||
After this you should be back to the top level of the shopping menu again and can continue browsing.
|
||||
|
||||
#### Coding the menu
|
||||
### Coding the menu
|
||||
|
||||
EvMenu defines the *nodes* (each menu screen with options) as normal Python functions. Each node
|
||||
must be able to change on the fly depending on what items are currently for sale. EvMenu will
|
||||
|
|
@ -164,10 +164,10 @@ need to return anything. In `buy_ware_result` we determine if the customer can a
|
|||
give proper return messages. This is also where we actually move the bought item into the inventory
|
||||
of the customer.
|
||||
|
||||
#### The command to start the menu
|
||||
### The command to start the menu
|
||||
|
||||
We could *in principle* launch the shopping menu the moment a customer steps into our shop room, but
|
||||
this would probably be considered pretty annoying. It's better to create a [Command](../Components/Commands) for
|
||||
this would probably be considered pretty annoying. It's better to create a [Command](../Components/Commands.md) for
|
||||
customers to explicitly wanting to shop around.
|
||||
|
||||
```python
|
||||
|
|
@ -200,7 +200,7 @@ class CmdBuy(Command):
|
|||
This will launch the menu. The `EvMenu` instance is initialized with the path to this very module -
|
||||
since the only global functions available in this module are our menu nodes, this will work fine
|
||||
(you could also have put those in a separate module). We now just need to put this command in a
|
||||
[CmdSet](../Components/Command-Sets) so we can add it correctly to the game:
|
||||
[CmdSet](../Components/Command-Sets.md) so we can add it correctly to the game:
|
||||
|
||||
```python
|
||||
from evennia import CmdSet
|
||||
|
|
@ -210,7 +210,7 @@ class ShopCmdSet(CmdSet):
|
|||
self.add(CmdBuy())
|
||||
```
|
||||
|
||||
### Building the shop
|
||||
## Building the shop
|
||||
|
||||
There are really only two things that separate our shop from any other Room:
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ There are really only two things that separate our shop from any other Room:
|
|||
the shop.
|
||||
|
||||
For testing we could easily add these features manually to a room using `@py` or other admin
|
||||
commands. Just to show how it can be done we'll instead make a custom [Typeclass](../Components/Typeclasses) for
|
||||
commands. Just to show how it can be done we'll instead make a custom [Typeclass](../Components/Typeclasses.md) for
|
||||
the shop room and make a small command that builders can use to build both the shop and the
|
||||
storeroom at once.
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ default-cmdset) before you can use it. Once having created the shop you can now
|
|||
`@open` a new exit to it. You could also easily expand the above command to automatically create
|
||||
exits to and from the new shop from your current location.
|
||||
|
||||
To avoid customers walking in and stealing everything, we create a [Lock](../Components/Locks) on the storage
|
||||
To avoid customers walking in and stealing everything, we create a [Lock](../Components/Locks.md) on the storage
|
||||
door. It's a simple lock that requires the one entering to carry an object named
|
||||
`<shopname>-storekey`. We even create such a key object and drop it in the shop for the new shop
|
||||
keeper to pick up.
|
||||
|
|
@ -312,7 +312,7 @@ you need to come up with a more robust lock-key solution.
|
|||
You could add better default descriptions as part of the `@buildshop` command or leave descriptions
|
||||
this up to the Builder.
|
||||
|
||||
### The shop is open for business!
|
||||
## The shop is open for business!
|
||||
|
||||
We now have a functioning shop and an easy way for Builders to create it. All you need now is to
|
||||
`@open` a new exit from the rest of the game into the shop and put some sell-able items in the store
|
||||
|
|
@ -328,7 +328,7 @@ would then be gone and the counter be wrong - the shop would pass us the next it
|
|||
|
||||
Fixing these issues are left as an exercise.
|
||||
|
||||
If you want to keep the shop fully NPC-run you could add a [Script](../Components/Scripts) to restock the shop's
|
||||
If you want to keep the shop fully NPC-run you could add a [Script](../Components/Scripts.md) to restock the shop's
|
||||
store room regularly. This shop example could also easily be owned by a human Player (run for them
|
||||
by a hired NPC) - the shop owner would get the key to the store room and be responsible for keeping
|
||||
it well stocked.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
This tutorial will elaborate on the many ways one can parse command arguments. The first step after
|
||||
[adding a command](Starting/Part1/Adding-Commands) usually is to parse its arguments. There are lots of
|
||||
[adding a command](Starting/Part1/Adding-Commands.md) usually is to parse its arguments. There are lots of
|
||||
ways to do it, but some are indeed better than others and this tutorial will try to present them.
|
||||
|
||||
If you're a Python beginner, this tutorial might help you a lot. If you're already familiar with
|
||||
|
|
@ -652,7 +652,7 @@ about... what is this `"book"`?
|
|||
|
||||
To get an object from a string, we perform an Evennia search. Evennia provides a `search` method on
|
||||
all typeclassed objects (you will most likely use the one on characters or accounts). This method
|
||||
supports a very wide array of arguments and has [its own tutorial](Starting/Part1/Searching-Things).
|
||||
supports a very wide array of arguments and has [its own tutorial](Starting/Part1/Searching-Things.md).
|
||||
Some examples of useful cases follow:
|
||||
|
||||
### Local searches
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ A Command is something that handles the input from a user and causes a result to
|
|||
An example is `look`, which examines your current location and tells how it looks like and
|
||||
what is in it.
|
||||
|
||||
```sidebar:: Commands are not typeclassed
|
||||
```{sidebar} Commands are not typeclassed
|
||||
|
||||
If you just came from the previous lesson, you might want to know that Commands and
|
||||
CommandSets are not `typeclassed`. That is, instances of them are not saved to the
|
||||
|
|
@ -181,7 +181,7 @@ class CmdEcho(Command):
|
|||
First we added a docstring. This is always a good thing to do in general, but for a Command class, it will also
|
||||
automatically become the in-game help entry! Next we add the `func` method. It has one active line where it
|
||||
makes use of some of those variables we found the Command offers to us. If you did the
|
||||
[basic Python tutorial](./Python-basic-introduction), you will recognize `.msg` - this will send a message
|
||||
[basic Python tutorial](./Python-basic-introduction.md), you will recognize `.msg` - this will send a message
|
||||
to the object it is attached to us - in this case `self.caller`, that is, us. We grab `self.args` and includes
|
||||
that in the message.
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ A lot of things to dissect here:
|
|||
`self.args.strip()` over and over, we store the stripped version
|
||||
in a _local variable_ `args`. Note that we don't modify `self.args` by doing this, `self.args` will still
|
||||
have the whitespace and is not the same as `args` in this example.
|
||||
```sidebar:: if-statements
|
||||
```{sidebar} if-statements
|
||||
|
||||
The full form of the if statement is
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ class MyCmdSet(CmdSet):
|
|||
|
||||
```
|
||||
|
||||
```sidebar:: Errors in your code
|
||||
```{sidebar} Errors in your code
|
||||
|
||||
With longer code snippets to try, it gets more and more likely you'll
|
||||
make an error and get a `traceback` when you reload. This will either appear
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
# Using the game and building stuff
|
||||
|
||||
In this lesson we will test out what we can do in-game out-of-the-box. Evennia ships with
|
||||
[around 90 default commands](api:evennia.commands.default#modules), and while you can override those as you please,
|
||||
In this lesson we will test out what we can do in-game out-of-the-box. Evennia ships with
|
||||
[around 90 default commands](../../../Components/Default-Commands.md), and while you can override those as you please,
|
||||
they can be quite useful.
|
||||
|
||||
Connect and log into your new game and you will end up in the "Limbo" location. This
|
||||
Connect and log into your new game and you will end up in the "Limbo" location. This
|
||||
is the only room in the game at this point. Let's explore the commands a little.
|
||||
|
||||
The default commands has syntax [similar to MUX](../../../Concepts/Using-MUX-as-a-Standard):
|
||||
The default commands has syntax [similar to MUX](../../../Concepts/Using-MUX-as-a-Standard.md):
|
||||
|
||||
command[/switch/switch...] [arguments ...]
|
||||
|
||||
An example would be
|
||||
An example would be
|
||||
|
||||
create/drop box
|
||||
|
||||
|
|
@ -21,32 +21,32 @@ or more inputs to the commands. It's common to use an equal sign (`=`) when assi
|
|||
an object.
|
||||
|
||||
> Are you used to commands starting with @, like @create? That will work too. Evennia simply ignores
|
||||
> the preceeding @.
|
||||
> the preceeding @.
|
||||
|
||||
## Getting help
|
||||
|
||||
help
|
||||
|
||||
Will give you a list of all commands available to you. Use
|
||||
help
|
||||
|
||||
Will give you a list of all commands available to you. Use
|
||||
|
||||
help <commandname>
|
||||
|
||||
to see the in-game help for that command.
|
||||
|
||||
to see the in-game help for that command.
|
||||
|
||||
## Looking around
|
||||
|
||||
The most common comman is
|
||||
The most common comman is
|
||||
|
||||
look
|
||||
|
||||
This will show you the description of the current location. `l` is an alias.
|
||||
|
||||
This will show you the description of the current location. `l` is an alias.
|
||||
|
||||
When targeting objects in commands you have two special labels you can use, `here` for the current
|
||||
room or `me`/`self` to point back to yourself. So
|
||||
room or `me`/`self` to point back to yourself. So
|
||||
|
||||
look me
|
||||
|
||||
will give you your own description. `look here` is, in this case, the same as plain `look`.
|
||||
will give you your own description. `look here` is, in this case, the same as plain `look`.
|
||||
|
||||
|
||||
## Stepping Down From Godhood
|
||||
|
|
@ -81,9 +81,9 @@ This created a new 'box' (of the default object type) in your inventory. Use the
|
|||
|
||||
name box = very large box;box;very;crate
|
||||
|
||||
```warning:: MUD clients and semi-colon
|
||||
```{warning} MUD clients and semi-colon
|
||||
|
||||
Some traditional MUD clients use the semi-colon `;` to separate client inputs. If so,
|
||||
Some traditional MUD clients use the semi-colon `;` to separate client inputs. If so,
|
||||
the above line will give an error. You need to change your client to use another command-separator
|
||||
or to put it in 'verbatim' mode. If you still have trouble, use the Evennia web client instead.
|
||||
|
||||
|
|
@ -99,8 +99,8 @@ used the `alias` command.
|
|||
|
||||
We are currently carrying the box. Let's drop it (there is also a short cut to create and drop in
|
||||
one go by using the `/drop` switch, for example `create/drop box`).
|
||||
|
||||
drop box
|
||||
|
||||
drop box
|
||||
|
||||
Hey presto - there it is on the ground, in all its normality.
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ Hey presto - there it is on the ground, in all its normality.
|
|||
This will show some technical details about the box object. For now we will ignore what this
|
||||
information means.
|
||||
|
||||
Try to `look` at the box to see the (default) description.
|
||||
Try to `look` at the box to see the (default) description.
|
||||
|
||||
look box
|
||||
You see nothing special.
|
||||
|
|
@ -125,20 +125,20 @@ dropped in the room, then try this:
|
|||
|
||||
lock box = get:false()
|
||||
|
||||
Locks represent a rather [big topic](../../../Components/Locks), but for now that will do what we want. This will lock
|
||||
Locks represent a rather [big topic](../../../Components/Locks.md), but for now that will do what we want. This will lock
|
||||
the box so noone can lift it. The exception is superusers, they override all locks and will pick it
|
||||
up anyway. Make sure you are quelling your superuser powers and try to get the box now:
|
||||
|
||||
> get box
|
||||
You can't get that.
|
||||
|
||||
Think thís default error message looks dull? The `get` command looks for an [Attribute](../../../Components/Attributes)
|
||||
Think thís default error message looks dull? The `get` command looks for an [Attribute](../../../Components/Attributes.md)
|
||||
named `get_err_msg` for returning a nicer error message (we just happen to know this, you would need
|
||||
to peek into the
|
||||
[code](https://github.com/evennia/evennia/blob/master/evennia/commands/default/general.py#L235) for
|
||||
the `get` command to find out.). You set attributes using the `set` command:
|
||||
|
||||
set box/get_err_msg = It's way too heavy for you to lift.
|
||||
set box/get_err_msg = It's way too heavy for you to lift.
|
||||
|
||||
Try to get it now and you should see a nicer error message echoed back to you. To see what this
|
||||
message string is in the future, you can use 'examine.'
|
||||
|
|
@ -149,12 +149,12 @@ Examine will return the value of attributes, including color codes. `examine her
|
|||
the raw description of your current room (including color codes), so that you can copy-and-paste to
|
||||
set its description to something else.
|
||||
|
||||
You create new Commands (or modify existing ones) in Python outside the game. We will get to that
|
||||
later, in the [Commands tutorial](./Adding-Commands).
|
||||
You create new Commands (or modify existing ones) in Python outside the game. We will get to that
|
||||
later, in the [Commands tutorial](./Adding-Commands.md).
|
||||
|
||||
## Get a Personality
|
||||
|
||||
[Scripts](../../../Components/Scripts) are powerful out-of-character objects useful for many "under the hood" things.
|
||||
[Scripts](../../../Components/Scripts.md) are powerful out-of-character objects useful for many "under the hood" things.
|
||||
One of their optional abilities is to do things on a timer. To try out a first script, let's put one
|
||||
on ourselves. There is an example script in `evennia/contrib/tutorial_examples/bodyfunctions.py`
|
||||
that is called `BodyFunctions`. To add this to us we will use the `script` command:
|
||||
|
|
@ -162,16 +162,16 @@ that is called `BodyFunctions`. To add this to us we will use the `script` comma
|
|||
script self = tutorial_examples.bodyfunctions.BodyFunctions
|
||||
|
||||
This string will tell Evennia to dig up the Python code at the place we indicate. It already knows
|
||||
to look in the `contrib/` folder, so we don't have to give the full path.
|
||||
to look in the `contrib/` folder, so we don't have to give the full path.
|
||||
|
||||
> Note also how we use `.` instead of `/` (or `\` on Windows). This is a so-called "Python path". In a Python-path,
|
||||
> Note also how we use `.` instead of `/` (or `\` on Windows). This is a so-called "Python path". In a Python-path,
|
||||
> you separate the parts of the path with `.` and skip the `.py` file-ending. Importantly, it also allows you to point to
|
||||
Python code _inside_ files, like the `BodyFunctions` class inside `bodyfunctions.py` (we'll get to classes later).
|
||||
These "Python-paths" are used extensively throughout Evennia.
|
||||
Python code _inside_ files, like the `BodyFunctions` class inside `bodyfunctions.py` (we'll get to classes later).
|
||||
These "Python-paths" are used extensively throughout Evennia.
|
||||
|
||||
Wait a while and you will notice yourself starting making random observations ...
|
||||
|
||||
script self
|
||||
script self
|
||||
|
||||
This will show details about scripts on yourself (also `examine` works). You will see how long it is
|
||||
until it "fires" next. Don't be alarmed if nothing happens when the countdown reaches zero - this
|
||||
|
|
@ -183,14 +183,14 @@ When you are tired of your character's "insights", kill the script with
|
|||
script/stop self = tutorial_examples.bodyfunctions.BodyFunctions
|
||||
|
||||
You create your own scripts in Python, outside the game; the path you give to `script` is literally
|
||||
the Python path to your script file. The [Scripts](../../../Components/Scripts) page explains more details.
|
||||
the Python path to your script file. The [Scripts](../../../Components/Scripts.md) page explains more details.
|
||||
|
||||
## Pushing Your Buttons
|
||||
|
||||
If we get back to the box we made, there is only so much fun you can have with it at this point. It's
|
||||
just a dumb generic object. If you renamed it to `stone` and changed its description, noone would be
|
||||
the wiser. However, with the combined use of custom [Typeclasses](../../../Components/Typeclasses), [Scripts](../../../Components/Scripts)
|
||||
and object-based [Commands](../../../Components/Commands), you could expand it and other items to be as unique, complex
|
||||
the wiser. However, with the combined use of custom [Typeclasses](../../../Components/Typeclasses.md), [Scripts](../../../Components/Scripts.md)
|
||||
and object-based [Commands](../../../Components/Commands.md), you could expand it and other items to be as unique, complex
|
||||
and interactive as you want.
|
||||
|
||||
Let's take an example. So far we have only created objects that use the default object typeclass
|
||||
|
|
@ -206,18 +206,18 @@ The same way we did with the Script Earler, we specify a "Python-path" to the Py
|
|||
to use for creating the object. There you go - one red button.
|
||||
|
||||
The RedButton is an example object intended to show off a few of Evennia's features. You will find
|
||||
that the [Typeclass](../../../Components/Typeclasses) and [Commands](../../../Components/Commands) controlling it are
|
||||
inside [evennia/contrib/tutorial_examples](api:evennia.contrib.tutorial_examples)
|
||||
that the [Typeclass](../../../Components/Typeclasses.md) and [Commands](../../../Components/Commands.md) controlling it are
|
||||
inside [evennia/contrib/tutorial_examples](../../../api/evennia.contrib.tutorial_examples.md)
|
||||
|
||||
If you wait for a while (make sure you dropped it!) the button will blink invitingly.
|
||||
If you wait for a while (make sure you dropped it!) the button will blink invitingly.
|
||||
|
||||
Why don't you try to push it ...?
|
||||
Why don't you try to push it ...?
|
||||
|
||||
Surely a big red button is meant to be pushed.
|
||||
Surely a big red button is meant to be pushed.
|
||||
|
||||
You know you want to.
|
||||
|
||||
```warning:: Don't press the invitingly blinking red button.
|
||||
```{warning} Don't press the invitingly blinking red button.
|
||||
```
|
||||
|
||||
## Making Yourself a House
|
||||
|
|
@ -242,14 +242,14 @@ also up/down and in/out). It's called `tunnel`:
|
|||
This will create a new room "cliff" with an exit "southwest" leading there and a path "northeast"
|
||||
leading back from the cliff to your current location.
|
||||
|
||||
You can create new exits from where you are, using the `open` command:
|
||||
You can create new exits from where you are, using the `open` command:
|
||||
|
||||
open north;n = house
|
||||
|
||||
This opens an exit `north` (with an alias `n`) to the previously created room `house`.
|
||||
|
||||
If you have many rooms named `house` you will get a list of matches and have to select which one you
|
||||
want to link to.
|
||||
want to link to.
|
||||
|
||||
Follow the north exit to your 'house' or `teleport` to it:
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ _large box_ to our house.
|
|||
very large box is leaving Limbo, heading for house.
|
||||
Teleported very large box -> house.
|
||||
|
||||
We can still find the box by using find:
|
||||
We can still find the box by using find:
|
||||
|
||||
find box
|
||||
One Match(#1-#8):
|
||||
|
|
@ -291,15 +291,15 @@ We are getting tired of the box. Let's destroy it.
|
|||
|
||||
destroy box
|
||||
|
||||
It will ask you for confirmation. Once you give it, the box will be gone.
|
||||
It will ask you for confirmation. Once you give it, the box will be gone.
|
||||
|
||||
You can destroy many objects in one go by giving a comma-separated list of objects (or a range
|
||||
of #dbrefs, if they are not in the same location) to the command.
|
||||
|
||||
## Adding a Help Entry
|
||||
|
||||
The Command-help is something you modify in Python code. We'll get to that when we get to how to
|
||||
add Commands. But you can also add regular help entries, for example to explain something about
|
||||
The Command-help is something you modify in Python code. We'll get to that when we get to how to
|
||||
add Commands. But you can also add regular help entries, for example to explain something about
|
||||
the history of your game world:
|
||||
|
||||
sethelp/add History = At the dawn of time ...
|
||||
|
|
@ -308,5 +308,5 @@ You will now find your new `History` entry in the `help` list and read your help
|
|||
|
||||
## Adding a World
|
||||
|
||||
After this brief introduction to building and using in-game commands you may be ready to see a more fleshed-out
|
||||
After this brief introduction to building and using in-game commands you may be ready to see a more fleshed-out
|
||||
example. Evennia comes with a tutorial world for you to explore. We will try that out in the next section.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Given the path to a Typeclass, there are three ways to create an instance of it:
|
|||
This is the recommended way if you are trying to create things in Python. The first argument can either be
|
||||
the class _or_ the python-path to the typeclass, like `"path.to.SomeTypeClass"`. It can also be `None` in which
|
||||
case the Evennia default will be used. While all the creation methods
|
||||
are available on `evennia`, they are actually implemented in [evennia/utils/create.py](api:evennia.utils.create).
|
||||
are available on `evennia`, they are actually implemented in [evennia/utils/create.py](../../../api/evennia.utils.create.md).
|
||||
- Finally, you can create objects using an in-game command, such as
|
||||
|
||||
create/drop obj:path.to.SomeTypeClass
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue