Skip to content

Commit d77217f

Browse files
committed
Add doc on mapProjectData
1 parent 27d443c commit d77217f

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

docs/inAppTutorial/REFERENCE.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,17 @@ A step is more or less an element to highlight plus a trigger that can be detect
9191

9292
Here is the structure of a step (all fields are optional):
9393

94-
- `id` (string): Id of the step (useful for shortcuts and editor switches)
94+
- `id` (string): id of the step (useful for shortcuts and editor switches)
9595
- `elementToHighlightId` (string): the CSS selector of the element to highlight
96-
- `nextStepTrigger`: See [Triggers](#triggers)
97-
- `tooltip`: See [Tooltip](#tooltip)
98-
- `isTriggerFlickering`(true): Useful when a DOM mutation is not caught and the presence trigger is not fired.
99-
- `shortcuts`: List of steps that the flow can use as shortcuts.
96+
- `nextStepTrigger`: see [Triggers](#triggers)
97+
- `tooltip`: see [Tooltip](#tooltip)
98+
- `isTriggerFlickering`(true): useful when a DOM mutation is not caught and the presence trigger is not fired.
99+
- `shortcuts`: list of steps that the flow can use as shortcuts.
100100
- `stepId`: id of the step to jump to
101101
- `trigger`: DOM trigger (presence of absence of element)
102102
- `skippable` (true): if the step can be skipped (useful when the user interaction can result in this step not being mandatory)
103103
- `isOnClosableDialog` (true): if the step is on a closable dialog, if the element to highlight is missing (meaning the dialog has been closed), the flow will go back to the previous step that is not on a closable dialog.
104+
- `mapProjectData` (object): allow to read data in the GDevelop project object and store it during the duration of the tutorial. This data can then be used in the tooltips. See [Available Project Data](#available-project-data)
104105

105106
#### **Triggers**
106107

@@ -117,6 +118,27 @@ Notes:
117118

118119
- You can learn about CSS selectors [here](https://www.w3schools.com/cssref/css_selectors.asp).
119120

121+
#### **Available Project Data**
122+
123+
Project data is read when the step is complete. Here is how to construct `mapProjectData`:
124+
125+
- For each item of the object:
126+
- the key of the object is the string under which to store the data
127+
- the value is the "data accessor"
128+
- At the moment, there is only one available data accessor:
129+
- `lastProjectObjectName` that will read the name of the last object added to the project.
130+
131+
Example: This will store the name of the last object added to the project under the key `firstObject`:
132+
133+
```json
134+
{
135+
...,
136+
"mapProjectData": {
137+
"firstObject": "lastProjectObjectName",
138+
}
139+
}
140+
```
141+
120142
#### **Tooltip**
121143

122144
For each step, you can specify a tooltip to display next to the element you want to highlight. A tooltip contains the 3 following fields:
@@ -128,6 +150,8 @@ For each step, you can specify a tooltip to display next to the element you want
128150
Notes:
129151

130152
- At least one field among `title` and `description` should be provided. If you don't want to display a tooltip, do not provide the `tooltip` field in your step.
153+
- To use data stored with `mapProjectData`, include the placeholder `$(...)` in your text.
154+
- For example, the description `"Drag $(firstObject) to the scene"` will be displayed `"Drag Platformer to the scene"`.
131155

132156
### `editorSwitches`
133157

0 commit comments

Comments
 (0)