narrat 2.0.7 → 2.0.8

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