narrat 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +776 -0
  2. package/LICENSE +21 -21
  3. package/README.md +38 -38
  4. package/dist/.DS_Store +0 -0
  5. package/dist/app.vue.d.ts +106 -106
  6. package/dist/components/MainMenu.vue.d.ts +12 -12
  7. package/dist/components/Skills.vue.d.ts +22 -22
  8. package/dist/components/debug/debug-menu.vue.d.ts +48 -48
  9. package/dist/components/dialog-picture.vue.d.ts +9 -9
  10. package/dist/components/game-dialog.vue.d.ts +65 -65
  11. package/dist/components/hud.vue.d.ts +12 -12
  12. package/dist/components/inventory-ui.vue.d.ts +30 -30
  13. package/dist/components/loading-bar.vue.d.ts +10 -10
  14. package/dist/components/menu-buttons.vue.d.ts +26 -26
  15. package/dist/components/notification-toast.vue.d.ts +6 -6
  16. package/dist/components/quests-ui.vue.d.ts +20 -20
  17. package/dist/components/utils/modal.vue.d.ts +6 -6
  18. package/dist/components/volume-controls.vue.d.ts +7 -7
  19. package/dist/config.d.ts +151 -151
  20. package/dist/constants.d.ts +1 -1
  21. package/dist/data/characters.json +62 -62
  22. package/dist/data/config.json +182 -182
  23. package/dist/data/example.rpy +360 -360
  24. package/dist/data/refactor.rpy +30 -30
  25. package/dist/defaultConfig.d.ts +2 -2
  26. package/dist/demo/demo.d.ts +1 -1
  27. package/dist/dialog-box.vue.d.ts +37 -37
  28. package/dist/exports/config.d.ts +1 -1
  29. package/dist/exports/display.d.ts +2 -2
  30. package/dist/exports/plugins.d.ts +20 -20
  31. package/dist/fonts/OpenDyslexic.ttf.svg +2326 -2326
  32. package/dist/gameloop.d.ts +3 -3
  33. package/dist/img/.DS_Store +0 -0
  34. package/dist/lib/lib.d.ts +15 -15
  35. package/dist/main.d.ts +5 -5
  36. package/dist/music/.DS_Store +0 -0
  37. package/dist/narrat.es.js +40 -14
  38. package/dist/narrat.es.js.map +1 -1
  39. package/dist/narrat.umd.js +70 -70
  40. package/dist/narrat.umd.js.map +1 -1
  41. package/dist/plugins/NarratPlugin.d.ts +11 -11
  42. package/dist/sounds/.DS_Store +0 -0
  43. package/dist/stores/audio-store.d.ts +12 -12
  44. package/dist/stores/dialog-store.d.ts +31 -31
  45. package/dist/stores/hud-stats-store.d.ts +22 -22
  46. package/dist/stores/inventory-store.d.ts +37 -37
  47. package/dist/stores/main-store.d.ts +276 -276
  48. package/dist/stores/notification-store.d.ts +12 -12
  49. package/dist/stores/quest-log.d.ts +39 -39
  50. package/dist/stores/rendering-store.d.ts +13 -13
  51. package/dist/stores/screens-store.d.ts +23 -23
  52. package/dist/stores/skills.d.ts +36 -36
  53. package/dist/stores/vm-store.d.ts +148 -148
  54. package/dist/types/app-types.d.ts +4 -4
  55. package/dist/types/character-types.d.ts +27 -27
  56. package/dist/types/dialog-box-types.d.ts +10 -10
  57. package/dist/types/game-save.d.ts +21 -21
  58. package/dist/types/parser.d.ts +92 -92
  59. package/dist/types/state.d.ts +3 -3
  60. package/dist/utils/ajax.d.ts +1 -1
  61. package/dist/utils/audio-loader.d.ts +13 -13
  62. package/dist/utils/characters.d.ts +5 -5
  63. package/dist/utils/data-helpers.d.ts +19 -19
  64. package/dist/utils/debounce.d.ts +14 -14
  65. package/dist/utils/error-handling.d.ts +3 -3
  66. package/dist/utils/helpers.d.ts +6 -6
  67. package/dist/utils/images-loader.d.ts +6 -6
  68. package/dist/utils/logger.d.ts +11 -11
  69. package/dist/utils/object-iterators.d.ts +8 -8
  70. package/dist/utils/promises.d.ts +1 -1
  71. package/dist/utils/randomId.d.ts +1 -1
  72. package/dist/utils/save-helpers.d.ts +3 -0
  73. package/dist/utils/skillchecks.d.ts +17 -17
  74. package/dist/utils/string-helpers.d.ts +3 -3
  75. package/dist/utils/time-helpers.d.ts +2 -2
  76. package/dist/vm/commands/arithmetic-commands.d.ts +17 -17
  77. package/dist/vm/commands/audio-commands.d.ts +8 -8
  78. package/dist/vm/commands/choice.d.ts +37 -37
  79. package/dist/vm/commands/clear_dialog.d.ts +2 -2
  80. package/dist/vm/commands/command-helpers.d.ts +2 -2
  81. package/dist/vm/commands/command-plugin.d.ts +30 -30
  82. package/dist/vm/commands/flow-commands.d.ts +14 -14
  83. package/dist/vm/commands/if.d.ts +10 -10
  84. package/dist/vm/commands/index.d.ts +2 -2
  85. package/dist/vm/commands/inventory-commands.d.ts +15 -15
  86. package/dist/vm/commands/logic-command.d.ts +42 -42
  87. package/dist/vm/commands/notify.d.ts +4 -4
  88. package/dist/vm/commands/quest-commands.d.ts +30 -30
  89. package/dist/vm/commands/screen-commands.d.ts +8 -8
  90. package/dist/vm/commands/set.d.ts +6 -6
  91. package/dist/vm/commands/skill-commands.d.ts +33 -33
  92. package/dist/vm/commands/stats-commands.d.ts +12 -12
  93. package/dist/vm/commands/string-commands.d.ts +9 -9
  94. package/dist/vm/commands/text-field.d.ts +7 -7
  95. package/dist/vm/commands/text.d.ts +13 -13
  96. package/dist/vm/commands/wait.d.ts +4 -4
  97. package/dist/vm/vm-helpers.d.ts +16 -16
  98. package/dist/vm/vm-parser.d.ts +19 -19
  99. package/dist/vm/vm-parser.test.d.ts +1 -1
  100. package/dist/vm/vm.d.ts +19 -19
  101. package/package.json +79 -79
package/CHANGELOG.md ADDED
@@ -0,0 +1,776 @@
1
+ # Narrat changelog
2
+
3
+ ## 2.0.6
4
+
5
+ Fixed a reggression bug introduced in 2.x where player choices weren't printed anymore in the dialogue history after making a choice.
6
+
7
+ ## 2.0.4
8
+
9
+ Fixed more audio edge cases around race conditions
10
+
11
+ ## 2.0.1
12
+
13
+ Fixed audio bug around loading
14
+
15
+ ### New feature: Text Fields
16
+
17
+ New text fields feature to let players type answers to questions.
18
+
19
+ Usage: `text_field [prompt]`
20
+
21
+ Example:
22
+
23
+ ```py
24
+ main:
25
+ set player.name (text_field "Enter your name")
26
+ "Your name is %{playerName}"
27
+ ```
28
+
29
+ ## 2.0.0
30
+
31
+ The narrat 2.0.0 branch is now the main branch.
32
+
33
+ Narrat 1.x has been deprecated and moved to the `v1-latest` tag on npm.
34
+
35
+ To install old v 1.x for legacy games, use `npm install narrat@v1-latest` instead of just `npm install narrat`
36
+
37
+ To know more about how to update a game to 2.x, see the [narrat 2.0.0 docs](https://docs.get-narrat.com/readme/narrat-2.0)
38
+
39
+ ## 2.0.0-rc4
40
+
41
+ ### Important Note
42
+
43
+ The main CSS file from narrat must now be imported in games using it to have the default CSS.
44
+
45
+ Simply add `import 'narrat/dist/style.css';` at the top of your `index.ts` (before your own CSS).
46
+
47
+ ### Switch to vite
48
+
49
+ To make developping narrat easier, the bundler used has been switched from rollup to vite. Vite is recommended as the standard for Vue these days, and the rollup vue plugin is deprecated. The update was necessary to support more recent features.
50
+
51
+ This has no impact on end users, other than having to import the CSS file as explained above.
52
+
53
+ ## 2.0.0-rc3
54
+
55
+ - Improvements to debugging to show more useful info on parser/runtime errors
56
+ - Corrected display of line numbers in errors
57
+ - Made parser continue parsing after errors to make it easier to see all errors at once and to be able to play the game even if there are parser errors
58
+
59
+ ## 2.0.0-rc1
60
+
61
+ ### Narrat 2.0
62
+
63
+ ### What changed in narrat 2.0
64
+
65
+ Narrat has a **new language syntax** in 2.0.0 - The parser has been improved to turn the narrat scripting into a full programming language with support for expressions, variables and functions
66
+
67
+ The syntax is generally the same so existing scripts would mostly work, except for the use of `$if` (which used to be a hack by sending your code to JavaScript [eval](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)).
68
+
69
+ ### Script updating tool
70
+
71
+ There is a [script updating tool](https://github.com/liana-pigeot/Narrat-Script-Updater) which can be used to help automatically update existing scripts from 1.x to work with the new syntax.
72
+
73
+ {% hint style="danger" %}
74
+ The old syntax is largely compatible, but the $if instruction works very differently now. The script will update those $if instructions to match the new system, but might fail at updating long series of conditions in $if
75
+ {% endhint %}
76
+
77
+ ### Installing narrat 2.0
78
+
79
+ Narrat 2.0 is currently published under a different tag to avoid people on 1.x accidentally installing it.
80
+
81
+ To install narrat to, run `npm install narrat@next`. The `next` tag is where the latest 2.x version is published.
82
+
83
+ ### Expressions
84
+
85
+ Expressions are now a first party feature. An expression is any operation between parenthesis. Any command in the game can be used as an expression, if it returns a value. For example `(+ 2 3)` is an expression that would get evaluated to `5`.
86
+
87
+ ### Syntax for using commands
88
+
89
+ The syntax for using commands hasn't changed, but it's been formalised.
90
+
91
+ The format for any operation is `[operator] [arg1] [arg2] [arg3] ...`. Operator is the command's keyword (like `talk`, `set`, `if` etc).
92
+
93
+ For example:
94
+
95
+ `set data.player.score 3` is the operator `set` with arguments `data.player.score` and `3`.
96
+
97
+ `set data.player.score (+ $data.player.score 2)`
98
+
99
+ The first command would set `3` in `data.player.score`.
100
+
101
+ The second command is also a set on `data.player.score`, but the second argument (the value) is an expression itself: `(+ $data.player.score 2)`. So the final resulting command is effectively `set data.player.score 5`.
102
+
103
+ ### Using Variables
104
+
105
+ To use a variable's value in a command, prefix its name with `$` as in the example above. In the case of the `set` command, we want to pass to set the variable's name, not its value, so we don't use `$` at the start.
106
+
107
+ Variables are also available in string interpolation as before, to insert variables in text:
108
+
109
+ `talk player idle "Hello %{data.player.name}"`
110
+
111
+ ### New If syntax
112
+
113
+ The previous `$if` is gone, now `if` is a command itself, which takes one argument: the condition. If the condition is true it plays the next branch, and it can have an optional else branch.
114
+
115
+ Example:
116
+
117
+ ```py
118
+ set data.age 25
119
+ if (> $data.age 18):
120
+ "The player is an adult"
121
+ else:
122
+ "The player is not an adult"
123
+ ```
124
+
125
+ #### More details on syntax and expressions
126
+
127
+ More complex example:
128
+
129
+ ```py
130
+ main:
131
+ set data.winThreshold 10
132
+ set data.player.score 5
133
+ set data.player.scoreBonus 5
134
+ if (== (+ $data.player.score $data.player.scoreBonus) $data.winThreshold):
135
+ "The player won!"
136
+ ```
137
+
138
+ In this example, the script stores a few variables, and then uses them in an `if` to compare their value. The `==` operation returns true if all arguments are equal, while the `+` operation adds values together and returns the result.
139
+
140
+ Here's how the code above would get broken down as the expressions get calculated:
141
+
142
+ ```py
143
+ if (== (+ $player.score $player.scoreBonus) $data.winThreshold):
144
+ if (== 10 $data.winThreshold):
145
+ if (== 10 10):
146
+ if true
147
+ ```
148
+
149
+ ### New operators
150
+
151
+ A lot of new operators have been added to be able to perform basic operations with the new scripting system:
152
+
153
+ - `+`, `-`, `*`, `/` : Will add/substract/etc arguments passed and return the value. Can take infinite arguments
154
+ - `||` and `&&` : Will or/and all arguments passed and return true or false. Inifinite arguments
155
+ - `>`, `>=`, `<`, `<=`, `==`, `!=` : Compares arguments 1 and 2, returns true or false. Note: equality uses truthy equality, not strict equality
156
+ - `!`: Negates argument 1
157
+ - `?`: Ternary operation. Arg 1 is the condition, 2 is what gets returned on success, 3 what gets returned on failure
158
+
159
+ ### New helper functions
160
+
161
+ New helper functions for easily checking quests and inventory without long lines:
162
+
163
+ - `quest_completed? [questId]`: Returns true if the quest `questId` is completed
164
+ - `objective_completed? [questId] [objectiveId]`: Same for an objective
165
+ - Also quest_started and `objective_started`
166
+ - `has_item? [itemId] [amount (optional)]`: Returns true if the player has an item (if amount is passed, the player needs to have amount or more of it)
167
+ - `item_amount? [itemId]` Returns how many of an item the player has.
168
+
169
+ ### Local variables
170
+
171
+ Local variables can now be declared. They exist inside the scope in which they are declared. Example
172
+
173
+ ```python
174
+ main:
175
+ run variables_test
176
+ "The variable 'test' is now undefined because we left the scope it was created in: %{test}"
177
+
178
+ variables_test:
179
+ var test 1
180
+ "Test value is %{test}"
181
+ ```
182
+
183
+ ### Function with arguments and return values
184
+
185
+ Labels are now "functions" and can take arguments or return values.
186
+
187
+ Example:
188
+
189
+ ```renpy
190
+ main:
191
+ var meal (run takeout_menu Cake)
192
+ "The player chose to eat %{meal}"
193
+
194
+ takeout_menu third_option:
195
+ var meal ""
196
+ choice:
197
+ talk helper idle "Which meal do you want?"
198
+ "Pizza":
199
+ set meal pizza
200
+ "Burger":
201
+ set meal burger
202
+ "%{third_option}":
203
+ set meal $third_option
204
+ talk helper idle "Chosen %{meal}"
205
+ return $meal
206
+
207
+ ```
208
+
209
+ ### Other new features
210
+
211
+ #### Audio triggers
212
+
213
+ New audio triggers feature to play sounds on certain events in the game.
214
+
215
+ Simply add the sounds to the config:
216
+
217
+ ```json
218
+ "audioTriggers": {
219
+ "onPlayerAnswered": "click",
220
+ "onPressStart": "game_start",
221
+ "onSkillCheckFailure": "failure",
222
+ "onSkillCheckSuccess": "success"
223
+ }
224
+ ```
225
+
226
+ Keys are event names, and values are the id of an audio you've defined in the config. For now all the available events are the ones above. Once defined, the sound will play every time that event is triggered.
227
+
228
+ ## 1.3.3
229
+
230
+ 1.x branch is now deprecated as 2.x is being pushed to main.
231
+
232
+ See [Narrat 2.0 update](https://docs.get-narrat.com/readme/narrat-2.0) docs for more info on how to update to 2.x
233
+
234
+ The main breaking change is the syntax for $if has changed, and also a CSS file needs to be imported in the game's `index.ts`:
235
+
236
+ `import 'narrat/dist/lib.css';`
237
+
238
+ ## 1.3.2
239
+
240
+ - Improvement to variables editor for debugging
241
+ - Bugfixes to access quests in conditions
242
+
243
+ ## 1.3.1
244
+
245
+ New feature to "use" items.
246
+
247
+ In an item config, an optional `onUse` value is available, which cn be set to a label to jump to when using the item.
248
+
249
+ There are also interaction groups which allow scripts to toggle on/off whether using items is allowed. They can be configured to automatically be turned off during dialogue scripts (to avoid bugs/side effects that jumping to an item's label would cause halfway through dialogue).
250
+
251
+ Config:
252
+
253
+ ```json
254
+ "items": {
255
+ "bread": {
256
+ "name": "Bread",
257
+ "description": "A bread in the game.",
258
+ "icon": "img/items/bread.png",
259
+ "onUse": {
260
+ "action": "jump",
261
+ "label": "eat_bread"
262
+ },
263
+ "tag": "default"
264
+ },
265
+ "book": {
266
+ "name": "Ominous Book",
267
+ "description": "An ominous book",
268
+ "icon": "img/items/book.png",
269
+ "onUse": {
270
+ "action": "run",
271
+ "label": "read_book"
272
+ },
273
+ "tag": "always_interactable"
274
+ }
275
+ },
276
+ "interactionTags": {
277
+ "default": {
278
+ "onlyInteractOutsideOfScripts": true
279
+ }
280
+ }
281
+ ```
282
+
283
+ The `onUse` `action` property can be either `jump` or `run`, allowing to either jump to a script, or run a script as a function (see [1.3.0 changes](#1.3.0) or [functions docs](https://docs.get-narrat.com/features/functions)), which effectively allows interrupting the current dialogue to run an item's function before going back to it.
284
+
285
+ The `tag` property on an item data sets which interaction group it is part of. This allows fine control of which items can be allowed to be used when. For example, some items might be available to use all the time, while some should only be allowed to be used at certain points.
286
+
287
+ By default if not provided, items have the `default` tag, and the default configuration has the `default` tag set to use `onlyInteractOutsideOfScripts`, which automatically disables interaction during scripts to avoid issues.
288
+
289
+ In the example above, the bread can only be interacted with outside of scripts and will use a jump to a label, while the book can be interacted with at any time and will use a `run`, effectively running a label as a function and then going back to where the script was.
290
+
291
+ In scripts, interaction tags can be controlled:
292
+
293
+ ```py
294
+ main:
295
+ disable_interaction someTag
296
+ talk player idle "Impossible to use items with the tag someTag for now"
297
+ enable_interaction someTag
298
+ talk player idle "It is now possible to use items with the tag someTag"
299
+ ```
300
+
301
+ ## 1.3.0
302
+
303
+ New `run` function to run a label as a "function"
304
+
305
+ The difference between this and jump is that using `run` will go back to where you were before once the label is over.
306
+
307
+ For example:
308
+
309
+ ```py
310
+ main:
311
+ set data.counter 1
312
+ jump functions_test
313
+
314
+ functions_test:
315
+ run some_function
316
+ talk player idle "Back to functions_test"
317
+ run some_function
318
+ talk player idle "We're back again"
319
+
320
+ some_function:
321
+ talk player idle "Ran the function %{data.counter} times"
322
+ add data.counter 1
323
+ ```
324
+
325
+ In this example when running `functions_test`, the script in `some_function` will be ran, then the execution comes back to do the rest of `functions_test`.
326
+
327
+ **Note:** Saving still only happens when _jumping_ to a label, because being at a specific label is the only way to make sure a save file can keep working if the code of the game gets changed in an update.
328
+
329
+ ## 1.2.1
330
+
331
+ Improved reset feature when returning to main menu to avoid potential bugs
332
+
333
+ ## 1.2.0
334
+
335
+ ## Quests system
336
+
337
+ There is a new quests system.
338
+
339
+ Quests can be defined in the config:
340
+
341
+ ```json
342
+ "quests": {
343
+ "breadShopping": {
344
+ "title": "Bread Shopping",
345
+ "description": "The helper cat asked you to buy bread for him.",
346
+ "objectives": {
347
+ "bread": {
348
+ "description": "Buy bread for the helper cat."
349
+ },
350
+ "delivery": {
351
+ "description": "Deliver the bread to the helper cat."
352
+ }
353
+ }
354
+ }
355
+ }
356
+ ```
357
+
358
+ Scripts can interact with the quest system:
359
+
360
+ - Start Quest: `start_quest breadShopping`
361
+ - Start objective: `start_objective breadShopping delivery` (for hidden objectives)
362
+ - Complete objective: `complete_objective breadShopping bread`
363
+ - Complete quest: `complete_quest breadShopping`
364
+
365
+ Example demo:
366
+
367
+ ```py
368
+ quest_demo:
369
+ set_button shopButton true
370
+ set_button parkButton false
371
+ jump bread_quest
372
+
373
+ bread_quest:
374
+ choice:
375
+ talk helper idle "Can you get 2 pieces of bread for me?"
376
+ "Yes":
377
+ talk helper idle "Thanks, that's very nice!"
378
+ talk helper idle "I'll be waiting for you at the park"
379
+ jump bread_start
380
+ "No":
381
+ talk helper idle "Oh, okay"
382
+ jump quest_demo
383
+
384
+ bread_start:
385
+ start_quest breadShopping
386
+ talk inner idle "Time to go to the shop to buy some bread then."
387
+ set_screen map
388
+ set_button shopButton true
389
+
390
+ shopButton:
391
+ set_screen default
392
+ "You visit the bread shop"
393
+ talk shopkeeper idle "Hello, I'm a little baker selling bread!"
394
+ set data.breadPrice 5
395
+ jump shop_menu
396
+
397
+ parkButton:
398
+ choice:
399
+ talk helper idle "Ah, so do you have my bread?"
400
+ "Yes!" $if this.items.bread.amount >= 2:
401
+ talk helper idle "Thanks a lot!"
402
+ complete_objective breadShopping delivery
403
+ complete_quest breadShopping
404
+ "No :(":
405
+ talk helper idle "Oh okay"
406
+ set_button parkButton false
407
+
408
+ shop_menu:
409
+ choice:
410
+ talk shopkeeper idle "So, do you want some bread?"
411
+ "Buy bread (costs %{data.breadPrice})" $if this.stats.money.value >= this.data.breadPrice:
412
+ add_item bread 1
413
+ $if this.data.breadPrice === 5:
414
+ add_stat money -5
415
+ else:
416
+ add_stat money -4
417
+ jump map_update
418
+ roll bread_haggle haggling 50 "Try to haggle for bread" hideAfterRoll:
419
+ success "You explain that helper cat needs bread to feed his poor family":
420
+ set data.breadPrice 4
421
+ talk shopkeeper idle "I guess I can sell you bread for 4 coins"
422
+ jump shop_menu
423
+ failure "You try to pity trip the shopkeeper but he won't bulge":
424
+ talk shopkeeper idle "The price is 5 coins, nothing less, nothing more."
425
+ jump shop_menu
426
+ "Exit":
427
+ jump map_update
428
+
429
+ map_update:
430
+ $if this.items.bread.amount >= 2:
431
+ complete_objective breadShopping bread
432
+ talk inner idle "I've got enough bread now, I'm going to go to the park."
433
+ start_objective breadShopping delivery
434
+ set_screen map
435
+ set_button parkButton true
436
+ set_button shopButton false
437
+ else:
438
+ talk inner idle "Hmm, I still need to buy more bread for helper cat."
439
+ set_screen map
440
+ ```
441
+
442
+ ## 1.1.0
443
+
444
+ ### Inventory system
445
+
446
+ There is a new inventory system.
447
+
448
+ Possible items can be defined in the config:
449
+
450
+ ```json
451
+ "items": {
452
+ "bread": {
453
+ "name": "Bread",
454
+ "description": "A bread in the game.",
455
+ "icon": "img/items/bread.png"
456
+ }
457
+ }
458
+ ```
459
+
460
+ Then items can be added/removed in scripts:
461
+
462
+ ```py
463
+ main:
464
+ add_item bread 15
465
+ remove_item bread 10
466
+ $if this.items.bread.amount > 0:
467
+ talk helper idle "You have %{items.bread.amount} bread"
468
+ else:
469
+ talk helper idle "You have no bread"
470
+ ```
471
+
472
+ ## 1.0.0
473
+
474
+ ### State management rewrite
475
+
476
+ Rewrote the state management of the engine using [pinia](https://pinia.vuejs.org/) instead of Vuex for state management.
477
+
478
+ This allows the state to be more modular, easy to use and better compatible with Vue.js devtools for development of the engine, as pinia is now the official vue state management library.
479
+
480
+ The version has been bumped to 1.0.0 as it's a major rewrite. No bugs have been found when testing though.
481
+
482
+ ### Save files breaking change
483
+
484
+ The save file format has changed, so saved games from previous versions would break. As no one is using this engine in production for now, this isn't an issue.
485
+
486
+ A new `version` string has been added to save files, so that in the future it will be possible to add migrations from older save files to newer ones if needed
487
+
488
+ ## Updated Vue version
489
+
490
+ The Vue dependency version has been updated to the current latest (3.2.37)
491
+
492
+ ## Vuex peer dependency deleted
493
+
494
+ Vuex is no longer a peer dependency, and has been replaced with pinia.
495
+
496
+ ## 0.11.1
497
+
498
+ Fixed an error in how the narrat packaged is exported
499
+
500
+ ## 0.11.0
501
+
502
+ ### New Plugin system!
503
+
504
+ There is now a plugin system developers can use to add new functionality to narrat (more documentation soon). See the [narrat-bitsy](https://github.com/liana-pigeot/narrat-bitsy) plugin for an example.
505
+
506
+ ## 0.10.0
507
+
508
+ ### New XP System
509
+
510
+ - XP can be accumulated to level
511
+ - config option: `skillOptions.xpPerLevel`
512
+ - Use `add_xp` in script tso add xp, just like adding levels
513
+ - XP now displayed in skills menu
514
+
515
+ ### Other improvements
516
+
517
+ - Improvements in skill checks display and difficulty
518
+ - Bug fixes to skill check edge cases
519
+ - Fixed a bug when not having a default title screen music
520
+ - Added a new `hideAfterRoll` option to skill checks to hide their choice after they've happened once
521
+ - Refactored skill check code for internal consistency between the different ways they're run
522
+ - New CSS variables and classes to customise the look of skill check prompts
523
+
524
+ ## 0.9.4
525
+
526
+ - Fixed a bug when going back to the main menu and reloading the save without refreshing the page
527
+ - New `defaultMusic` option in audio options for title screen music
528
+
529
+ ## 0.9.3
530
+
531
+ - Fixed a bug when loading a saved game
532
+
533
+ ## 0.9.2
534
+
535
+ - Added new CSS variables and id/classes to make it easier to theme games
536
+
537
+ Current CSS variables list (Look at [main.css](https://github.com/liana-pigeot/narrat/blob/main/src/sass/main.css) in the narrat repo for up to date version):
538
+
539
+ ```css
540
+ :root {
541
+ --bg-color: #131720;
542
+ --text-color: #d9e1f2;
543
+ --primary: hsl(255, 30%, 55%);
544
+ --focus: hsl(210, 90%, 50%);
545
+ --secondary: #42b983;
546
+ --border-color: hsla(0, 0%, 100%, 0.2);
547
+ --light-1: hsl(210, 30%, 40%);
548
+ --light-2: hsl(255, 30%, 50%);
549
+ --light-background: linear-gradient(to right, var(--light-1), var(--light-2));
550
+ --shadow-1: hsla(236, 50%, 50%, 0.3);
551
+ --shadow-2: hsla(236, 50%, 50%, 0.4);
552
+ --hud-background: rgba(0, 0, 0, 0.4);
553
+ --hud-text-color: var(--text-color);
554
+ --notifications-bg: darkslateblue;
555
+
556
+ --skills-text-background: rgba(0, 0, 0, 0.5);
557
+ --skills-text-color: var(--text-color);
558
+ --skills-level-background: rgba(0, 0, 0, 0.5);
559
+ --skills-level-color: orange;
560
+ }
561
+ ```
562
+
563
+ Can be edited in a game's CSS file by overriding those variables in a more specific selector. For example:
564
+
565
+ ```css
566
+ #app {
567
+ --bg-color: white;
568
+ --text-color: black;
569
+ }
570
+ ```
571
+
572
+ would override the background and text colors of the game
573
+
574
+ ## 0.9.1
575
+
576
+ - Fixed a file capitalisation error in 0.9.0
577
+
578
+ ## 0.9.0
579
+
580
+ ### Breaking Changes
581
+
582
+ New config options for skills:
583
+
584
+ - `icon`: Path to the image to use for the skill's icon (currently the skill widget is 200x300, but you can override the CSS if needed)
585
+ - `hidden`: Optional boolean to make the skill hidden until it is "obtained". A skill that is configured to be hidden will only start appearing in the skills menu once it's above level 0
586
+
587
+ Example skills config:
588
+
589
+ ```json
590
+ "skills": {
591
+ "agility": {
592
+ "name": "Agility",
593
+ "description": "How good you are at moving around.",
594
+ "startingLevel": 0,
595
+ "icon": "img/skills/agility.jpg",
596
+ "hidden": true
597
+ },
598
+ "logic": {
599
+ "name": "Logic",
600
+ "description": "How good you are at solving problems",
601
+ "icon": "img/skills/logic.jpg",
602
+ "startingLevel": 0
603
+ }
604
+ },
605
+ ```
606
+
607
+ ### Bug Fixes
608
+
609
+ - Music could play multiple times at once when replaying the same music
610
+
611
+ ### New Features and improvements
612
+
613
+ #### Development and debug
614
+
615
+ - Improved debug menu with a **variable editor** to view and edit values in the `data` object.
616
+ - Also added a separate editor for the entire engine/app state. Can be useful for debugging complex bugs by exploring the state of the app.
617
+ - New **Quick label jump** feature to easily jump to specific labels for testing. Press **J** to open and type the name of a label then select a result with up/down arrows and press Enter
618
+ - New keyboard shortcut to open debug menu (**d**)
619
+ - Added a debug info panel on the main starting screen of the game with info on the shortcuts
620
+
621
+ #### Engine improvements
622
+
623
+ - Menu modal improved to be more compact with a cleaner design
624
+ - Added fade in and fade outs when changing music (configurable in config)
625
+ - **Improved the default UI** to be more pleasing to look at
626
+ - Added a **return to Main Menu** button to the main menu for resetting the game
627
+ - New **Skills Menu** allowing players to view their skills:
628
+ - It only appears if the game has skills configured
629
+ - It shows skill icons, name and current level on a grid
630
+ - Clicking on a skill opens a skill page with more detailed info and the skill description
631
+ - The skill menu button is next to the usual menu button
632
+
633
+ ## 0.8.5
634
+
635
+ - Fixed a bug with `clear_dialog` that was disabling all interaction upon use
636
+
637
+ ## 0.8.4
638
+
639
+ - Fixed many issues with save being broken (it didn't properly save the name of the last label the player was on, effectively restarting the game from scratch every time)
640
+ - Added new things to the save function so their state gets reloaded properly on game launch:
641
+ - Current music now gets saved and restarts when reloading the game, if any is active
642
+ - Stats (the ones in the HUD) now get saved
643
+ - Current screen is also saved
644
+ - Removed many useless spammy `console.log` and added a `Logger` in the code so that most logs (outside of errors/important logs) will only appear in debug mode.
645
+
646
+ ## 0.8.3
647
+
648
+ - Fixed bug where menu button would move up as more text gets added to the game
649
+
650
+ ## 0.8.2
651
+
652
+ - Added css to hide scrollbars in the game UI
653
+ - Added a new Menu button with the options to quit and change volume
654
+ - Removed volume slider from the HUD and moved it to the new menu
655
+
656
+ ## 0.8.1
657
+
658
+ - Fixed a bug in accessing values inside conditions caused by changed in 0.7.2
659
+
660
+ ## 0.8.0
661
+
662
+ - Changed the `set` method to access things without caps (`data`, `skills`, `buttons` instead of `DATA`, `SKILLS`, `BUTTONS`) for consistency.
663
+ - Changed string interpolation to have more accessible objects, now values in `data` need to be accessed with `%{data.something}` instead of just `%{something}`
664
+ - Now possible to access skill levels in string interpolation with `%{skills.someSkill.level}`
665
+ - Improvements to how skill checks are printed to be less awkward
666
+
667
+ ## 0.7.1
668
+
669
+ - Added `stop` and `pause` functions which work similarly to play for stopping or pausing audio.
670
+
671
+ ## 0.6.5
672
+
673
+ - Audio and music options from the config now get passed to howler
674
+ - Renamed `path` to `src` in audio config (to be consistent with howler)
675
+
676
+ ## 0.6.0
677
+
678
+ Added stats feature for tracking numbers and displaying them in the hud
679
+
680
+ Example config:
681
+
682
+ ```
683
+ "hudStats": {
684
+ "money": {
685
+ "icon": "img/ui/money.png",
686
+ "name": "Money",
687
+ "startingValue": 0,
688
+ "minValue": 0
689
+ },
690
+ "energy": {
691
+ "icon": "img/ui/energy.png",
692
+ "name": "Energy",
693
+ "startingValue": 10,
694
+ "minValue": 0,
695
+ "maxValue": 10
696
+ }
697
+ }
698
+ ```
699
+
700
+ ## 0.5.4
701
+
702
+ - Improved responsive layout and fixed some issues in it
703
+
704
+ New config keys required in the layout part of the config (to be documented):
705
+
706
+ ```
707
+ "layout": {
708
+ "backgrounds": {
709
+ "width": 880,
710
+ "height": 720
711
+ },
712
+ "dialogBottomPadding": 70,
713
+ "minTextWidth": 475,
714
+ "mobileDialogHeightPercentage": 60,
715
+ "verticalLayoutThreshold": 1000,
716
+ "portraits": {
717
+ "width": 100,
718
+ "height": 100
719
+ }
720
+ },
721
+ ```
722
+
723
+ ## 0.4.0
724
+
725
+ Added responsive layout for mobile and small screens. Still in progress, but functionnal enough to be better than before so I'm releasing it.
726
+
727
+ ## 0.3.4
728
+
729
+ - Improved string templating to work with deep nesting and also inside choice text
730
+
731
+ ## 0.3.3
732
+
733
+ - Now detects indentation size and can support any indentation size
734
+
735
+ ## 0.3.2
736
+
737
+ - Added a new `add_level` function for increasing the level of a skill. Example: `add_level someSkill 1` will increase the player's level in `someSkill` by 1
738
+ - Added a new `notify` function for displaying a notification toast that disappears after a few seconds (duration configurable in `config.json`). Example: `notify "Hello, this is a notification"`.
739
+
740
+ ## 0.3.1
741
+
742
+ Added new config options for controlling how skill rolls are done and the display of their difficulty
743
+
744
+ ## 0.3.0
745
+
746
+ Breaking changes around renaming data access from scripts
747
+
748
+ ### New Add Command
749
+
750
+ New `add` command, works the same way as `set` but increments the value based on the existing value, ie. `set SKILLS.someSkill.level 2` will increment `someSkill.level` by 2.
751
+
752
+ ### Skills
753
+
754
+ - Now possible to set the starting value of a skill (in the config)
755
+ - Now possible to edit a skill's value with `set SKILLS.someSkill.level 2` for example
756
+ - Skillcheck command renamed to roll (`if this.roll("someSkillCheck", "testSkill", 40);`)
757
+
758
+ ### General
759
+
760
+ The `set` and `$if` command now refer to data in caps and have access to more data:
761
+
762
+ - `set SKILLS.someSkill.level [value]` Sets the value of a skill
763
+ - `set DATA.someData [value]` Sets a value in the data object (data is for any game-created variables)
764
+ - `$if this.SKILLCHECKS.someSkillCheck.passed` now available for checking if a skillcheck has already been passed
765
+
766
+ ## 0.0.14
767
+
768
+ - Added the changelog (manually made for now)
769
+
770
+ ## 0.0.13
771
+
772
+ - Added debug menu for jumping to labels (currently doesn't support production builds disabling it)
773
+ - Added saving and loading of the game (works by storing data, skills, skillchecks etc. When the game is reloaded, it is brought back at the last label visited)
774
+ - Fixed a bug where conditional choices would play the wrong result if a choice is removed due to a condition
775
+ - Made script loading and compilation happen during the initial loading, so everything is ready to play when pressing start game
776
+ - Skill checks now also save and load their data, so a failed check becomes impossible to choose, and a succeeded skill check can be skipped if shown again