mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 00:06:30 +01:00
Convert master docs to use MyST
This commit is contained in:
parent
6e03216cd9
commit
d229ff024c
359 changed files with 3275 additions and 4567 deletions
|
|
@ -44,13 +44,13 @@ Python function. For that, there is the _EvMenu templating_ language. This allow
|
|||
menu
|
||||
in a more human-readable string with a simple format. This is then parsed to produce the
|
||||
`{"nodename": <function>, ...}` mapping for you, for the EvMenu to use normally. The templating
|
||||
language is described in the [Menu templating section](./EvMenu#Evmenu-templating-language).
|
||||
language is described in the [Menu templating section](./EvMenu.md#evmenu-templating-language).
|
||||
|
||||
|
||||
## 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
|
||||
|
|
@ -91,7 +91,7 @@ This menutree can also be generated from an *EvMenu template*
|
|||
```
|
||||
|
||||
The `template_string` and `goto_callables` are described in [Template language
|
||||
section](EvMenu#Evmenu-templating-language).
|
||||
section](./EvMenu.md#evmenu-templating-language).
|
||||
|
||||
|
||||
## The EvMenu class
|
||||
|
|
@ -113,7 +113,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
|
||||
|
|
@ -150,7 +150,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
|
||||
|
|
@ -739,15 +739,15 @@ template2menu(caller, template_string, goto_callables)
|
|||
|
||||
## 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
|
||||
- **[Yes/No prompt](./EvMenu#example-yesno-prompt)** - entering text with limited possible responses
|
||||
- **[Yes/No prompt](./EvMenu.md#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`).
|
||||
|
||||
|
|
@ -817,7 +817,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.
|
||||
|
||||
|
|
@ -1115,7 +1115,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](./NPC-shop-Tutorial) for an example of this.
|
||||
function more clever. See the [NPC shop tutorial](./NPC-shop-Tutorial.md) for an example of this.
|
||||
|
||||
|
||||
## Ask for simple input
|
||||
|
|
@ -1216,7 +1216,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).
|
||||
|
|
@ -1304,8 +1304,8 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue