narrat 2.0.11 → 2.0.12

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