Skip to content

Commit 901a178

Browse files
committed
Add store and settings docs
1 parent b0eee91 commit 901a178

File tree

15 files changed

+205
-52
lines changed

15 files changed

+205
-52
lines changed

addons/parley/utils/parley_util.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class log:
4949

5050
class resource:
5151
static func get_uid(resource: Resource) -> String:
52-
if not resource.resource_path:
52+
if not resource or not resource.resource_path:
5353
ParleyUtils.log.warn("Unable to get UID for Resource (resource: %s): resource_path is not defined. Returning empty string." % [resource])
5454
return ""
5555
var id: int = ResourceLoader.get_resource_uid(resource.resource_path)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func execute(_ctx: Dictionary, values: Array) -> int:
5454
> to the relevant resource for editing. You can also add resources using the
5555
> resource editor dropdown field instead of dragging.
5656
57-
7. You should now see that the Action is available in the Action node dropdown
58-
options. Select `Advance Time` in the options to associate it with the
59-
selected Action Node.
57+
7. You should now see that the Action is available in the Action dropdown
58+
options in the Action node editor. Select `Advance Time` in the options to
59+
associate it with the selected Action Node.
6060
8. Test out your new Action within the Dialogue Sequence by clicking the Test
6161
Dialogue Sequence from start button.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: |
3-
Register a Character
3+
Register a Character
44
---
55

66
As the name suggests, Characters are resources in Parley used to define

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

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,73 +21,61 @@ in the corresponding
2121
- You have created a basic Dialogue Sequence before. Consult the
2222
[getting started guide](./create-dialogue-sequence.md) for more info.
2323

24-
<!-- TODO: update when Parley supports creation of Fact -->
25-
2624
## Instructions
2725

2826
> **Note:** it is assumed that the default Parley settings are used for the fact
2927
> store and it is stored at: `res://facts/fact_store_main.tres`
3028
31-
- Create a Fact script (ensure that it extends the `FactInterface` class) at:
32-
`res://facts/alice_gave_coffee_fact.gd`
29+
1. Create a Fact script (ensure that it extends the `FactInterface` class) at:
30+
`res://facts/alice_gave_coffee_fact.gd`
3331

3432
```gdscript
3533
extends FactInterface
3634
37-
func execute(_ctx: Dictionary, _values: Array) -> bool:
38-
print('Alice did indeed give coffee')
39-
# Note, you can return any value here, it doesn't
40-
# necessarily have to be a bool
35+
func execute(ctx: Dictionary, _values: Array) -> bool:
36+
print('Did Alice give coffee?')
37+
# Note, you can return any value here, it doesn't
38+
# necessarily have to be a bool
4139
return true
4240
```
4341

44-
- [OPTIONAL] If the return type of your fact, is **not** of type `bool`, it is
45-
recommended to return well-known values of the fact (for example, when using a
46-
[Match Node](../nodes/match-node.md)). For example:
42+
2. [OPTIONAL] If the return type of your fact, is **not** of type `bool`, it is
43+
recommended to return well-known values of the fact (for example, when using
44+
a [Match Node](../nodes/match-node.md)). For example:
4745

4846
```gdscript
4947
extends FactInterface
5048
51-
enum Ball {
52-
RED = 1,
53-
YELLOW = 2,
54-
PINK = 6,
55-
BLUE = 5,
49+
enum DifficultyLevel {
50+
EASY,
51+
NORMAL,
52+
HARD,
5653
}
5754
5855
func execute(ctx: Dictionary, _values: Array) -> int:
59-
return ctx.get('ball', 0)
56+
return ctx.get('difficulty_level', DifficultyLevel.NORMAL)
6057
61-
func available_values() -> Array[Ball]:
58+
func available_values() -> Array[DifficultyLevel]:
6259
return [
63-
Ball.RED,
64-
Ball.YELLOW,
65-
Ball.PINK,
66-
Ball.BLUE,
60+
DifficultyLevel.EASY,
61+
DifficultyLevel.NORMAL,
62+
DifficultyLevel.HARD,
6763
]
6864
```
6965

70-
- Open up the inspector for `res://facts/fact_store_main.tres` in the Godot
71-
Editor and click `Add Element`:
72-
73-
![Add Element](../../../www/static/docs/register-fact/add-element.png)
74-
75-
- Then, click the empty element and choose `New Fact`:
76-
77-
![Click Empty Element](../../../www/static/docs/register-fact/click-empty-element.png)
78-
79-
- Now populate the fact ID by using the same element ID (recommended but not
80-
essential) and choose a sensible name for the Fact in the store:
81-
82-
![Populate basic fact data](../../../www/static/docs/register-fact/populate-basic-fact-data.png)
83-
84-
- Then, drag the fact script created earlier to the `<empty>` ref field:
85-
86-
![Drag Fact Script](../../../www/static/docs/register-fact/drag-fact-script.png)
87-
88-
<!-- TODO: change/remove this when supported Parley -->
89-
90-
- Finally, reload the Godot project and the new fact should be available to use
91-
in Parley!
92-
93-
![Reload Godot Editor](../../../www/static/docs/register-fact/reload-godot-editor.png)
66+
3. Open up the `ParleyStores` dock in the Godot Editor and open the `Fact` tab.
67+
4. Click `Add Fact`.
68+
5. Give your new fact an ID. In our example, we use: `main:alice_gave_coffee`.
69+
6. Give your new fact a name. In our example, we use: `Alice gave coffee`.
70+
7. Link your created fact script with the Fact using the resource inspector
71+
(labelled `Ref`).
72+
73+
> [tip]: You can use the resource editors in `ParleyStores` to quickly navigate
74+
> to the relevant resource for editing. You can also add resources using the
75+
> resource editor dropdown field instead of dragging.
76+
77+
8. You should now see that the Fact is available in the Fact dropdown options in
78+
the Condition node editor. Select `Alice gave coffee` in the options to
79+
associate it with the selected Condition node.
80+
9. Test out your new Fact within the Dialogue Sequence by clicking the Test
81+
Dialogue Sequence from start button.

docs/latest/reference/parley-settings.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,61 @@ description: |
33
Parley settings
44
---
55

6-
Parley settings: TODO.
6+
Parley supports the following settings should you want to tweak some of the
7+
default behaviours.
8+
9+
To access all the Parley settings, open up the Godot settings: `Project` ->
10+
`Project Settings` and filter by: `parley`:
11+
12+
![parley-settings](../../../www/static/docs/reference/parley-settings.png)
13+
14+
## Action Store Path
15+
16+
This defines the path to the Action Store resource that is used to store
17+
actions. The resource extend resource type: `ParleyActionStore`.
18+
19+
> [warn]: This path must be valid in order for Parley to function properly.
20+
21+
Setting path: `parley/stores/action_store_path`
22+
23+
Default: `res://actions/action_store.tres`
24+
25+
## Fact Store Path
26+
27+
This defines the path to the Fact Store resource that is used to store facts.
28+
The resource extend resource type: `ParleyFactStore`.
29+
30+
> [warn]: This path must be valid in order for Parley to function properly.
31+
32+
Setting path: `parley/stores/fact_store_path`
33+
34+
Default: `res://facts/fact_store.tres`
35+
36+
## Character Store Path
37+
38+
This defines the path to the Character Store resource that is used to store
39+
characters. The resource extend resource type: `ParleyCharacterStore`.
40+
41+
> [warn]: This path must be valid in order for Parley to function properly.
42+
43+
Setting path: `parley/stores/character_store_path`
44+
45+
Default: `res://characters/character_store.tres`
46+
47+
## Dialogue Balloon Path
48+
49+
This defines the path to the default Dialogue balloon that is used to render the
50+
dialogue when testing Dialogue Sequences.
51+
52+
Setting path: `parley/dialogue/dialogue_balloon_path`
53+
54+
Default: `res://addons/parley/components/default_balloon.tscn`
55+
56+
## Test Scene Path
57+
58+
This defines the path to the default test scene that is rendered when testing
59+
Dialogue Sequences.
60+
61+
Setting path: `parley/test_dialogue_sequence/test_scene_path`
62+
63+
Default: `res://addons/parley/views/test_dialogue_sequence_scene.tscn`

examples/create-condition-basic.ds

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"title": "",
3+
"nodes": [
4+
{
5+
"id": "node:1",
6+
"type": "START",
7+
"position": "(620.0, 440.0)"
8+
},
9+
{
10+
"id": "node:2",
11+
"type": "END",
12+
"position": "(1940.0, 500.0)"
13+
},
14+
{
15+
"id": "node:3",
16+
"type": "DIALOGUE",
17+
"position": "(1400.0, 680.0)",
18+
"character": "uid://ceouii84qmu0w::bob",
19+
"text": "Where's my coffee??"
20+
},
21+
{
22+
"id": "node:4",
23+
"type": "DIALOGUE",
24+
"position": "(1400.0, 200.0)",
25+
"character": "uid://ceouii84qmu0w::bob",
26+
"text": "Thanks for the coffee!"
27+
},
28+
{
29+
"id": "node:5",
30+
"type": "CONDITION",
31+
"position": "(900.0, 400.0)",
32+
"description": "Did Alice give coffee",
33+
"combiner": "ALL",
34+
"conditions": [
35+
{
36+
"fact_ref": "uid://cpwr6bc02ec7a",
37+
"operator": 0,
38+
"value": "true"
39+
}
40+
]
41+
}
42+
],
43+
"edges": [
44+
{
45+
"id": "edge:1",
46+
"from_node": "node:1",
47+
"from_slot": 0,
48+
"to_node": "node:5",
49+
"to_slot": 0,
50+
"should_override_colour": false,
51+
"colour_override": "(0.4118, 0.4118, 0.4118, 1.0)"
52+
},
53+
{
54+
"id": "edge:2",
55+
"from_node": "node:5",
56+
"from_slot": 0,
57+
"to_node": "node:4",
58+
"to_slot": 0,
59+
"should_override_colour": false,
60+
"colour_override": "(0.4118, 0.4118, 0.4118, 1.0)"
61+
},
62+
{
63+
"id": "edge:3",
64+
"from_node": "node:5",
65+
"from_slot": 1,
66+
"to_node": "node:3",
67+
"to_slot": 0,
68+
"should_override_colour": false,
69+
"colour_override": "(0.4118, 0.4118, 0.4118, 1.0)"
70+
},
71+
{
72+
"id": "edge:4",
73+
"from_node": "node:4",
74+
"from_slot": 0,
75+
"to_node": "node:2",
76+
"to_slot": 0,
77+
"should_override_colour": false,
78+
"colour_override": "(0.4118, 0.4118, 0.4118, 1.0)"
79+
},
80+
{
81+
"id": "edge:5",
82+
"from_node": "node:3",
83+
"from_slot": 0,
84+
"to_node": "node:2",
85+
"to_slot": 0,
86+
"should_override_colour": false,
87+
"colour_override": "(0.4118, 0.4118, 0.4118, 1.0)"
88+
}
89+
],
90+
"stores": {
91+
"character": [],
92+
"fact": []
93+
}
94+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[remap]
2+
3+
importer="parley_dialogue_ast_compiler_0.2.0"
4+
type="Resource"
5+
uid="uid://dlcr5lltkb0nr"
6+
path="res://.godot/imported/create-condition-basic.ds-94c6607bd22704d7fc2e128789bcd3b8.tres"
7+
8+
[deps]
9+
10+
source_file="res://examples/create-condition-basic.ds"
11+
dest_files=["res://.godot/imported/create-condition-basic.ds-94c6607bd22704d7fc2e128789bcd3b8.tres"]
12+
13+
[params]
14+
68.7 KB
Loading
-49 KB
Binary file not shown.
-31.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)