mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Better explain on utlity tutorial use of ABILITY_REVERSE_MAP. Resolve #3680
This commit is contained in:
parent
e81d40d95e
commit
4af63a0b06
1 changed files with 2 additions and 2 deletions
|
|
@ -135,9 +135,9 @@ ABILITY_REVERSE_MAP = {
|
|||
|
||||
Above, the `Ability` class holds some basic properties of a character sheet.
|
||||
|
||||
The `ABILITY_REVERSE_MAP` is a convenient map to go the other way — if in some command we were to enter the string 'cha', we could use this mapping to directly convert your input to the correct `Ability`. For example:
|
||||
The `ABILITY_REVERSE_MAP` is a convenient map to convert a string to an Enum. The most common use of this would be in a Command; the Player don't know anything about Enums, they can only send strings. So we'd only get the string "cha". Using this `ABILITY_REVERSE_MAP` we can conveniently convert this input to an `Ability.CHA` Enum you can then pass around in code
|
||||
|
||||
ability = ABILITY_REVERSE_MAP.get(your_input)
|
||||
ability = ABILITY_REVERSE_MAP.get(user_input)
|
||||
|
||||
|
||||
## Utility Module
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue