Skip to content

Commit b0eee91

Browse files
committed
Add register character docs
1 parent 6f20790 commit b0eee91

File tree

4 files changed

+59
-100
lines changed

4 files changed

+59
-100
lines changed

docs/latest/getting-started/register-action.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ functionality to: emit a signal, register a journal entry, or update state.
1010
Actions are stored in an action store which can be configured in the Parley
1111
settings.
1212

13-
In this guide, we will create a action that can be used to create an Action Node
14-
in the corresponding [create an Action Node guide](./create-action-node.md).
13+
In this guide, we will create an action that can be used to create an Action
14+
Node in the corresponding
15+
[create an Action Node guide](./create-action-node.md).
1516

1617
## Pre-requisites
1718

@@ -25,13 +26,13 @@ in the corresponding [create an Action Node guide](./create-action-node.md).
2526

2627
![Register an Action](../../../www/static/docs/register-action/register-action.gif)
2728

28-
> [info]: it is assumed that the default Parley settings are used for the fact
29-
> store and it is stored at: `res://facts/fact_store_main.tres`. You can find
30-
> more information on changing the default Parley settings
29+
> [info]: it is assumed that the default Parley settings are used for the action
30+
> store and it is stored at: `res://actions/action_store_main.tres`. You can
31+
> find more information on changing the default Parley settings
3132
> [here](../reference/parley-settings.md).
3233
33-
- Create an Action script (ensure that it extends the `ParleyActionInterface`
34-
class) at: `res://actions/advance_time_action.gd`
34+
1. Create an Action script (ensure that it extends the `ParleyActionInterface`
35+
class) at: `res://actions/advance_time_action.gd`
3536

3637
```gdscript
3738
extends ParleyActionInterface
@@ -41,18 +42,20 @@ func execute(_ctx: Dictionary, values: Array) -> int:
4142
return OK
4243
```
4344

44-
1. Open up the `ParleyStores` dock in the Godot Editor and click `Add Action`.
45-
2. Give your new action an ID. In our example, we use: `main:advance_time`.
46-
3. Give your new action a name. In our example, we use: `Advance Time`.
47-
4. Link your created action script with the Action using the resource inspector
45+
2. Open up the `ParleyStores` dock in the Godot Editor and open the `Action`
46+
tab.
47+
3. Click `Add Action`.
48+
4. Give your new action an ID. In our example, we use: `main:advance_time`.
49+
5. Give your new action a name. In our example, we use: `Advance Time`.
50+
6. Link your created action script with the Action using the resource inspector
4851
(labelled `Ref`).
4952

5053
> [tip]: You can use the resource editors in `ParleyStores` to quickly navigate
5154
> to the relevant resource for editing. You can also add resources using the
5255
> resource editor dropdown field instead of dragging.
5356
54-
5. You should now see that the Action is available in the Action node dropdown
57+
7. You should now see that the Action is available in the Action node dropdown
5558
options. Select `Advance Time` in the options to associate it with the
5659
selected Action Node.
57-
6. Test out your new Action within the Dialogue Sequence by clicking the Test
60+
8. Test out your new Action within the Dialogue Sequence by clicking the Test
5861
Dialogue Sequence from start button.
Lines changed: 42 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,54 @@
11
---
22
description: |
3-
Register an Action
3+
Register a Character
44
---
55

6-
TODO
6+
As the name suggests, Characters are resources in Parley used to define
7+
characters within a Dialogue Sequence.
78

8-
Actions are resources in Parley used to: TODO.
9+
Characters are stored in a Character Store which can be configured in the Parley
10+
settings.
911

10-
<!-- For example, one might want to display different dialogue
11-
depending on whether Alice gave a coffee or not.
12-
13-
Facts are stored in a fact store which can be configured in the Parley settings.
14-
15-
In this guide, we will create a fact that can be used to create a Condition Node
16-
in the corresponding
17-
[create a Condition Node guide](./create-condition-node.md).
12+
In this guide, we will create a character that can be used to create
13+
[Dialogue](../nodes/dialogue-node.md) and
14+
[Dialogue Option](../nodes/dialogue-option-node.md) nodes.
1815

1916
## Pre-requisites
2017

2118
- Ensure you have familiarised yourself with the
22-
[Condition Node](../nodes/condition-node.md) docs.
19+
[Character Node](../nodes/character.md) docs.
2320
- Parley is [installed](./installation.md) and running in your Godot Editor.
2421
- You have created a basic Dialogue Sequence before. Consult the
25-
[getting started guide](./create-dialogue-sequence.md) for more info. -->
26-
27-
<!-- TODO: update when Parley supports creation of Fact -->
28-
29-
<!-- ## Instructions
30-
31-
> **Note:** it is assumed that the default Parley settings are used for the fact
32-
> store and it is stored at: `res://facts/fact_store_main.tres`
33-
34-
- Create a Fact script (ensure that it extends the `FactInterface` class) at:
35-
`res://facts/alice_gave_coffee_fact.gd`
36-
37-
```gdscript
38-
extends FactInterface
39-
40-
func execute(_ctx: Dictionary, _values: Array) -> bool:
41-
print('Alice did indeed give coffee')
42-
# Note, you can return any value here, it doesn't
43-
# necessarily have to be a bool
44-
return true
45-
```
46-
47-
- [OPTIONAL] If the return type of your fact, is **not** of type `bool`, it is
48-
recommended to return well-known values of the fact (for example, when using a
49-
[Match Node](../nodes/match-node.md)). For example:
50-
51-
```gdscript
52-
extends FactInterface
53-
54-
enum Ball {
55-
RED = 1,
56-
YELLOW = 2,
57-
PINK = 6,
58-
BLUE = 5,
59-
}
60-
61-
func execute(ctx: Dictionary, _values: Array) -> int:
62-
return ctx.get('ball', 0)
63-
64-
func available_values() -> Array[Ball]:
65-
return [
66-
Ball.RED,
67-
Ball.YELLOW,
68-
Ball.PINK,
69-
Ball.BLUE,
70-
]
71-
```
72-
73-
- Open up the inspector for `res://facts/fact_store_main.tres` in the Godot
74-
Editor and click `Add Element`:
75-
76-
![Add Element](../../../www/static/docs/register-fact/add-element.png)
77-
78-
- Then, click the empty element and choose `New Fact`:
79-
80-
![Click Empty Element](../../../www/static/docs/register-fact/click-empty-element.png)
81-
82-
- Now populate the fact ID by using the same element ID (recommended but not
83-
essential) and choose a sensible name for the Fact in the store:
84-
85-
![Populate basic fact data](../../../www/static/docs/register-fact/populate-basic-fact-data.png)
86-
87-
- Then, drag the fact script created earlier to the `<empty>` ref field:
88-
89-
![Drag Fact Script](../../../www/static/docs/register-fact/drag-fact-script.png)
90-
91-
<!-- TODO: change/remove this when supported Parley -->
92-
93-
<!-- - Finally, reload the Godot project and the new fact should be available to use
94-
in Parley!
95-
96-
![Reload Godot Editor](../../../www/static/docs/register-fact/reload-godot-editor.png) -->
22+
[getting started guide](./create-dialogue-sequence.md) for more info.
23+
24+
## Instructions
25+
26+
![Register a Character](../../../www/static/docs/register-character/register-character.gif)
27+
28+
> [info]: it is assumed that the default Parley settings are used for the
29+
> character store and it is stored at:
30+
> `res://characters/character_store_main.tres`. You can find more information on
31+
> changing the default Parley settings [here](../reference/parley-settings.md).
32+
33+
1. Open up the `ParleyStores` dock in the Godot Editor and open the `Character`
34+
tab.
35+
2. Click `Add Character`.
36+
3. Give your new character an ID. In our example, we use: `frankie`.
37+
4. Give your new character a name. In our example, we use: `Frankie`.
38+
39+
> [tip]: You can use the resource editors in `ParleyStores` to quickly navigate
40+
> to the relevant resource for editing. You can also add resources using the
41+
> resource editor dropdown field instead of dragging.
42+
43+
5. You should now see that the Character is available in the Dialogue node
44+
dropdown options for the associated character. Select `Frankie` in the
45+
options to associate it with the selected Dialogue Node.
46+
6. Test out your new Character within the Dialogue Sequence by clicking the Test
47+
Dialogue Sequence from start button.
48+
49+
> [tip]: You may want to define a custom character rather than using the Parley
50+
> Character so you can add custom attributes. ATM, Parley does not support
51+
> adding this via the `ParleyStores` editor but you can do by adding to the raw
52+
> character store resource in the Godot editor. When doing this, it is **vital**
53+
> to ensure that you include `@tool` at the top of the your custom character
54+
> definition.

www/routes/_app.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export default define.page(function App({ Component, state, url }) {
4747
// deno-lint-ignore react-no-danger
4848
dangerouslySetInnerHTML={{
4949
__html: `
50-
const isDarkMode = localStorage.theme === "dark"
51-
|| (!("theme" in localStorage)
52-
&& window.matchMedia("(prefers-color-scheme: dark)").matches);
50+
const isDarkMode = localStorage.theme !== "light";
5351
document.documentElement.dataset.theme = isDarkMode ? "dark" : "light";`,
5452
}}
5553
>
1.53 MB
Loading

0 commit comments

Comments
 (0)