Align character generation tutorial more closely with the code.

This commit is contained in:
gas-public-wooden-clean 2024-01-01 18:22:32 -06:00
parent ff159e3942
commit b6d7c2500a

View file

@ -354,7 +354,12 @@ def start_chargen(caller, session=None):
# this generates all random components of the character
tmp_character = TemporaryCharacterSheet()
EvMenu(caller, menutree, session=session, tmp_character=tmp_character)
EvMenu(
caller,
menutree,
session=session,
startnode_input=("sgsg", {"tmp_character": tmp_character}),
)
```
@ -637,24 +642,27 @@ This is what is called an _end node_, because it returns `None` instead of optio
```python
def start_chargen(caller, session=None):
"""
This is a start point for spinning up the chargen from a command later.
"""
This is a start point for spinning up the chargen from a command later.
"""
menutree = { # <----- can now add this!
"node_chargen": node_chargen,
"node_change_name": node_change_name,
"node_swap_abilities": node_swap_abilities,
"node_apply_character": node_apply_character
"node_chargen": node_chargen,
"node_change_name": node_change_name,
"node_swap_abilities": node_swap_abilities,
"node_apply_character": node_apply_character,
}
# this generates all random components of the character
tmp_character = TemporaryCharacterSheet()
EvMenu(caller, menutree, session=session,
startnode="node_chargen", # <-----
tmp_character=tmp_character)
EvMenu(
caller,
menutree,
startnode="node_chargen", # <-----
session=session,
startnode_input=("sgsg", {"tmp_character": tmp_character}),
)
```
Now that we have all the nodes, we add them to the `menutree` we left empty before. We only add the nodes, _not_ the goto-helpers! The keys we set in the `menutree` dictionary are the names we should use to point to nodes from inside the menu (and we did).