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
@@ -1,360 +1,360 @@
1
- main:
2
- var playerName (text_field "Enter your name")
3
- "Your name is %{playerName}"
4
- var meal (run takeout_menu Cake)
5
- "The player chose to eat %{meal}"
6
- // play music calm
7
- jump quest_demo
8
-
9
- takeout_menu third_option:
10
- var meal ""
11
- choice:
12
- talk helper idle "Which meal do you want?"
13
- "Pizza":
14
- set meal pizza
15
- "Burger":
16
- set meal burger
17
- "%{third_option}":
18
- set meal $third_option
19
- talk helper idle "Chosen %{meal}"
20
- return $meal
21
-
22
- test_functions:
23
- talk player idle "Function test label"
24
- return (+ 1 2)
25
-
26
- test_scopes:
27
- var test1 1
28
- talk player idle "Declared test1: %{test1}"
29
- run test_scopes_2
30
- talk player idle "Back to original scope, shouldn't have access to test2: %{test2}"
31
-
32
- test_scopes_2:
33
- var test2 2
34
- talk player idle "Entered scope 2, still have access to test1: %{test1}"
35
- talk player idle "Declared test2 in scope 2: %{test2}"
36
-
37
- random_tests:
38
- var test 2
39
- talk helper idle "%{test}"
40
- add test 1
41
- talk helper idle "%{test}"
42
- talk helper idle "Hello world"
43
- start_quest breadShopping
44
- choice:
45
- "Can we spend some energy?"
46
- "Spend 5 energy" if (>= (get_stat_value energy) 5):
47
- add_stat energy -5
48
- talk player idle "Spent 5 energy!"
49
- "Don't spend":
50
- talk player idle "Didn't spend anything"
51
- set data.winThreshold 10
52
- set data.player.score 5
53
- set data.player.scoreBonus 5
54
- if (== (+ $data.player.score $data.player.scoreBonus) $data.winThreshold):
55
- "The player won!"
56
-
57
- if (roll testAudio agility 90):
58
- "yahoo"
59
- else:
60
- "oh no"
61
- if (quest_started? breadShopping):
62
- "The quest has started"
63
- else:
64
- "It's not working"
65
- if (|| (== (+ 1 2 3 4) 10) (== (+ 1 2 3) 5) (== (+ 1 2) 3 3 3 3)):
66
- "It's true"
67
- else:
68
- "It's false"
69
- set data.counter (+ 1 2)
70
- add_item book 1
71
- if (has_item? book 1):
72
- "There's a book in the inventory"
73
- if (== (item_amount? book) 1):
74
- "We have 1 book"
75
- talk helper idle "Hello world"
76
- set data.counter 1
77
- jump quest_demo
78
- notify "Hello world!"
79
- start_quest breadShopping
80
- add_item bread 15
81
- remove_item bread 10
82
- if (> $items.bread.amount 0):
83
- talk helper idle "You have %{items.bread.amount} bread"
84
- else:
85
- talk helper idle "You have no bread"
86
- clear_dialog
87
- complete_objective breadShopping bread
88
- choice:
89
- "Let's do a skill check"
90
- roll aSkillCheck agility 70 "Test skill roll" hideAfterRoll:
91
- success:
92
- talk player idle "Woo I did it"
93
- failure "Text if the skill check failed":
94
- talk player idle "Oh no I failed"
95
- "Another choice":
96
- "Hello too"
97
- complete_quest breadShopping "You helped the cat get bread"
98
- if (roll someSkillCheck agility 40):
99
- set data.skillcheckDone true
100
- "You open the narrat demo and wonder how this thing even works"
101
- choice:
102
- "How about asking for help?"
103
- "Ask for help":
104
- jump askForHelp
105
- "No, I don't want help 😡"
106
- jump dontAskForHelp
107
-
108
- functions_test:
109
- run some_function
110
- talk player idle "Back to functions_test"
111
- run some_function
112
-
113
- some_function:
114
- talk player idle "Ran the function %{data.counter} times"
115
- add data.counter 1
116
-
117
- skillCheckTest:
118
- choice:
119
- "Let's do a skill check"
120
- roll aSkillCheck agility 70 "Test skill roll":
121
- success:
122
- talk player idle "Woo I did it"
123
- failure "Text if the skill check failed":
124
- talk player idle "Oh no I failed"
125
- "Another choice":
126
- "Hello too"
127
- if (roll someSkillCheck agility 40):
128
- set data.skillcheckDone true
129
- jump skillCheckTest
130
- stats:
131
- talk player idle "Trying energy feature"
132
- choice:
133
- "Can we spend some energy?"
134
- "Spend 5 energy" if (>= $stats.energy 5):
135
- add_stat energy -5
136
- talk player idle "Spent 5 energy!"
137
- "Don't spend":
138
- talk player idle "Didn't spend anything"
139
- jump stats
140
-
141
- xpTest:
142
- talk helper idle "Gaining 3 logic xp"
143
- add_xp haggling 3
144
- jump xpTest
145
-
146
- askForHelp:
147
- talk helper idle "Hello! I heard you're trying to play the narrat demo!"
148
- talk helper idle "You can view the source script for this demo in the <a href=\"https:\/\/github.com\/nialna\/narrat-demo\" target=\"_blank\">demo repo</a>"
149
- talk helper idle "There is also a <a href=\"https:\/\/github.com\/nialna\/narrat-template\" target=\"_blank\">game template</a> ready to use."
150
- talk helper idle "As you've probably noticed, you can make choices in this."
151
- talk helper idle "There are lots of things you can do to make an interactive story in Narrat really. Choices are one of the most useful ones."
152
- talk helper idle "I'm going to send you to my other friend who has some questions for you."
153
- jump askAboutChoices
154
-
155
- askAboutChoices:
156
- choice:
157
- talk cat idle "Hi it's me, another generic cat! Do you like making choices in games?"
158
- "Yes":
159
- set data.choices true
160
- "Cat will remember this."
161
- "No":
162
- add_level agility 2
163
- "Cat will remember this."
164
- choice:
165
- talk helper idle "Now I think we should do an activity, what do you like doing?"
166
- "let's make choices cause I like making choices!" if $data.likeChoices:
167
- jump makeChoices
168
- "let's do nothing!":
169
- jump doNothing
170
-
171
-
172
- dontAskForHelp:
173
- // clear_dialog
174
- talk inner idle "Maybe we should get help though? I don't really know what else to do"
175
- jump main
176
-
177
- makeChoices:
178
- choice:
179
- talk inner idle "I don't know, we've been making a lot of choices already lately."
180
- "I still want to make a choice!":
181
- talk helper idle "Well you just made one, it turns out. Can we continue now?"
182
- jump doNothing
183
- "I guess you're right":
184
- jump doNothing
185
-
186
-
187
- doNothing:
188
- choice:
189
- talk music_cat idle "How about we get some music in here?"
190
- "Play some relaxing music":
191
- "The music is going to start and stop with timers to show the feature"
192
- play music calm
193
- wait 2000
194
- pause music
195
- wait 500
196
- play music calm
197
- wait 500
198
- stop music
199
- wait 500
200
- play music calm
201
- "I hate music":
202
- talk music_cat idle "Well too bad, it's up to you."
203
- jump otherFeatures
204
-
205
- otherFeatures:
206
- talk helper idle "There are lots of other features, like skill checks and conditions."
207
- if (roll someSkillCheck agility 40):
208
- "For example this line only appears if you passed a skill check"
209
- "This engine is still very early and not fully documented yet, but you can look at the example demo and how it is made."
210
- "There is also a screen feature on the left where you can display background images with interactive buttons."
211
- jump showMap
212
-
213
- showMap:
214
- set_screen map
215
- set_button parkButton true
216
- talk helper idle "This is an example map. There are buttons you can click on. It is possible to dynanically enable and disable buttons in your script"
217
- talk helper idle "You can view the source script for this demo in the <a href=\"https:\/\/github.com\/nialna\/narrat-demo\">demo repo</a>"
218
-
219
- quest_demo:
220
- set_button shopButton true
221
- set_button parkButton false
222
- jump bread_quest
223
-
224
- bread_quest:
225
- choice:
226
- talk helper idle "Can you get 2 pieces of bread for me?"
227
- "Yes":
228
- talk helper idle "Thanks, that's very nice!"
229
- talk helper idle "I'll be waiting for you at the park"
230
- jump bread_start
231
- "No":
232
- talk helper idle "Oh, okay"
233
- jump quest_demo
234
-
235
- bread_start:
236
- start_quest breadShopping
237
- talk inner idle "Time to go to the shop to buy some bread then."
238
- set_screen map
239
- set_button shopButton true
240
-
241
- shopButton:
242
- set_screen default
243
- "You visit the bread shop"
244
- talk shopkeeper idle "Hello, I'm a little baker selling bread!"
245
- set data.breadPrice 5
246
- jump shop_menu
247
-
248
- parkButton:
249
- choice:
250
- talk helper idle "Ah, so do you have my bread?"
251
- "Yes!" if (>= $items.bread.amount 2):
252
- talk helper idle "Thanks a lot!"
253
- complete_objective breadShopping delivery
254
- complete_quest breadShopping
255
- "No :(":
256
- talk helper idle "Oh okay"
257
- set_button parkButton false
258
-
259
- shop_menu:
260
- choice:
261
- talk shopkeeper idle "So, do you want some bread?"
262
- "Buy bread (costs %{data.breadPrice})" if (>= $stats.money.value $data.breadPrice):
263
- add_item bread 1
264
- if (== $data.breadPrice 5):
265
- add_stat money -5
266
- else:
267
- add_stat money -4
268
- jump map_update
269
- roll bread_haggle haggling 50 "Try to haggle for bread" hideAfterRoll:
270
- success "You explain that helper cat needs bread to feed his poor family":
271
- set data.breadPrice 4
272
- talk shopkeeper idle "I guess I can sell you bread for 4 coins"
273
- jump shop_menu
274
- failure "You try to pity trip the shopkeeper but he won't bulge":
275
- talk shopkeeper idle "The price is 5 coins, nothing less, nothing more."
276
- jump shop_menu
277
- "Exit":
278
- jump map_update
279
-
280
- map_update:
281
- if (>= $items.bread.amount 2):
282
- complete_objective breadShopping bread
283
- talk inner idle "I've got enough bread now, I'm going to go to the park."
284
- start_objective breadShopping delivery
285
- set_screen map
286
- set_button parkButton true
287
- set_button shopButton false
288
- else:
289
- talk inner idle "Hmm, I still need to buy more bread for helper cat."
290
- set_screen map
291
-
292
- eat_bread:
293
- talk player idle "hmm, bread"
294
-
295
- read_book:
296
- talk inner idle "It's full of ocult rituals. I'm not sure what they are, but I'm sure they are useful."
297
-
298
- label_to_jump:
299
- talk cat idle "The code has now jumped to this label"
300
-
301
- jump_example:
302
- talk cat idle "Hello, this is an example about jumping to other labels"
303
- talk cat idle "Use the jump command to jump to a different label in any of your scripts"
304
- jump label_to_jump
305
-
306
- choice_example:
307
- talk cat idle "This example shows how to use the choice command"
308
- choice:
309
- "This is the choice prompt text"
310
- "This is the first option the player can select":
311
- talk cat idle "I will say this if you select the first option"
312
- "This is the second choice the player can pick":
313
- talk cat idle "I see you picked the second choice!"
314
-
315
- choice_example_conditions:
316
- talk cat idle "This example shows how to use conditions in choices"
317
- choice:
318
- "This is the choice prompt text"
319
- "This choice will only appear if a condition is met" if $data.someFlag:
320
- talk cat idle "Choice response"
321
- roll someSkillCheck agility 50 "This choice will run a skill check":
322
- success "Skill check succeeded":
323
- "This line will appear if the skill check succeeds"
324
- failure "Skill check failed":
325
- "This line will appear if the skill check fails"
326
-
327
-
328
- set_example:
329
- choice:
330
- talk cat idle "Do you like surprises?"
331
- "Yes":
332
- set data.like_surprises true
333
- "No!":
334
- set data.like_surprises false
335
- if $data.like_surprises:
336
- talk cat idle "Since you like surprises, here's a surprise message"
337
-
338
-
339
- add_example:
340
- set data.counter 0
341
- jump add_example_add
342
-
343
- add_example_add:
344
- choice:
345
- talk cat idle "Do you want to increase the counter? You can only do it 10 times":
346
- "Increase the counter" if (< $data.counter 10):
347
- add data.counter 1
348
- "No!":
349
- talk cat idle "Ok then"
350
- "I'm done" if (>= $data.counter 10):
351
- jump add_example_end
352
- jump add_example_add
353
-
354
- add_example_end:
355
- talk cat idle "It seems you're done with the counter now"
356
-
357
- talk_example:
358
- talk cat idle "I'm talking to you!"
359
- "This is a shortcut for the narrator talking"
360
- talk player idle "The player can also talk"
1
+ main:
2
+ var playerName (text_field "Enter your name")
3
+ "Your name is %{playerName}"
4
+ var meal (run takeout_menu Cake)
5
+ "The player chose to eat %{meal}"
6
+ // play music calm
7
+ jump quest_demo
8
+
9
+ takeout_menu third_option:
10
+ var meal ""
11
+ choice:
12
+ talk helper idle "Which meal do you want?"
13
+ "Pizza":
14
+ set meal pizza
15
+ "Burger":
16
+ set meal burger
17
+ "%{third_option}":
18
+ set meal $third_option
19
+ talk helper idle "Chosen %{meal}"
20
+ return $meal
21
+
22
+ test_functions:
23
+ talk player idle "Function test label"
24
+ return (+ 1 2)
25
+
26
+ test_scopes:
27
+ var test1 1
28
+ talk player idle "Declared test1: %{test1}"
29
+ run test_scopes_2
30
+ talk player idle "Back to original scope, shouldn't have access to test2: %{test2}"
31
+
32
+ test_scopes_2:
33
+ var test2 2
34
+ talk player idle "Entered scope 2, still have access to test1: %{test1}"
35
+ talk player idle "Declared test2 in scope 2: %{test2}"
36
+
37
+ random_tests:
38
+ var test 2
39
+ talk helper idle "%{test}"
40
+ add test 1
41
+ talk helper idle "%{test}"
42
+ talk helper idle "Hello world"
43
+ start_quest breadShopping
44
+ choice:
45
+ "Can we spend some energy?"
46
+ "Spend 5 energy" if (>= (get_stat_value energy) 5):
47
+ add_stat energy -5
48
+ talk player idle "Spent 5 energy!"
49
+ "Don't spend":
50
+ talk player idle "Didn't spend anything"
51
+ set data.winThreshold 10
52
+ set data.player.score 5
53
+ set data.player.scoreBonus 5
54
+ if (== (+ $data.player.score $data.player.scoreBonus) $data.winThreshold):
55
+ "The player won!"
56
+
57
+ if (roll testAudio agility 90):
58
+ "yahoo"
59
+ else:
60
+ "oh no"
61
+ if (quest_started? breadShopping):
62
+ "The quest has started"
63
+ else:
64
+ "It's not working"
65
+ if (|| (== (+ 1 2 3 4) 10) (== (+ 1 2 3) 5) (== (+ 1 2) 3 3 3 3)):
66
+ "It's true"
67
+ else:
68
+ "It's false"
69
+ set data.counter (+ 1 2)
70
+ add_item book 1
71
+ if (has_item? book 1):
72
+ "There's a book in the inventory"
73
+ if (== (item_amount? book) 1):
74
+ "We have 1 book"
75
+ talk helper idle "Hello world"
76
+ set data.counter 1
77
+ jump quest_demo
78
+ notify "Hello world!"
79
+ start_quest breadShopping
80
+ add_item bread 15
81
+ remove_item bread 10
82
+ if (> $items.bread.amount 0):
83
+ talk helper idle "You have %{items.bread.amount} bread"
84
+ else:
85
+ talk helper idle "You have no bread"
86
+ clear_dialog
87
+ complete_objective breadShopping bread
88
+ choice:
89
+ "Let's do a skill check"
90
+ roll aSkillCheck agility 70 "Test skill roll" hideAfterRoll:
91
+ success:
92
+ talk player idle "Woo I did it"
93
+ failure "Text if the skill check failed":
94
+ talk player idle "Oh no I failed"
95
+ "Another choice":
96
+ "Hello too"
97
+ complete_quest breadShopping "You helped the cat get bread"
98
+ if (roll someSkillCheck agility 40):
99
+ set data.skillcheckDone true
100
+ "You open the narrat demo and wonder how this thing even works"
101
+ choice:
102
+ "How about asking for help?"
103
+ "Ask for help":
104
+ jump askForHelp
105
+ "No, I don't want help 😡"
106
+ jump dontAskForHelp
107
+
108
+ functions_test:
109
+ run some_function
110
+ talk player idle "Back to functions_test"
111
+ run some_function
112
+
113
+ some_function:
114
+ talk player idle "Ran the function %{data.counter} times"
115
+ add data.counter 1
116
+
117
+ skillCheckTest:
118
+ choice:
119
+ "Let's do a skill check"
120
+ roll aSkillCheck agility 70 "Test skill roll":
121
+ success:
122
+ talk player idle "Woo I did it"
123
+ failure "Text if the skill check failed":
124
+ talk player idle "Oh no I failed"
125
+ "Another choice":
126
+ "Hello too"
127
+ if (roll someSkillCheck agility 40):
128
+ set data.skillcheckDone true
129
+ jump skillCheckTest
130
+ stats:
131
+ talk player idle "Trying energy feature"
132
+ choice:
133
+ "Can we spend some energy?"
134
+ "Spend 5 energy" if (>= $stats.energy 5):
135
+ add_stat energy -5
136
+ talk player idle "Spent 5 energy!"
137
+ "Don't spend":
138
+ talk player idle "Didn't spend anything"
139
+ jump stats
140
+
141
+ xpTest:
142
+ talk helper idle "Gaining 3 logic xp"
143
+ add_xp haggling 3
144
+ jump xpTest
145
+
146
+ askForHelp:
147
+ talk helper idle "Hello! I heard you're trying to play the narrat demo!"
148
+ talk helper idle "You can view the source script for this demo in the <a href=\"https:\/\/github.com\/nialna\/narrat-demo\" target=\"_blank\">demo repo</a>"
149
+ talk helper idle "There is also a <a href=\"https:\/\/github.com\/nialna\/narrat-template\" target=\"_blank\">game template</a> ready to use."
150
+ talk helper idle "As you've probably noticed, you can make choices in this."
151
+ talk helper idle "There are lots of things you can do to make an interactive story in Narrat really. Choices are one of the most useful ones."
152
+ talk helper idle "I'm going to send you to my other friend who has some questions for you."
153
+ jump askAboutChoices
154
+
155
+ askAboutChoices:
156
+ choice:
157
+ talk cat idle "Hi it's me, another generic cat! Do you like making choices in games?"
158
+ "Yes":
159
+ set data.choices true
160
+ "Cat will remember this."
161
+ "No":
162
+ add_level agility 2
163
+ "Cat will remember this."
164
+ choice:
165
+ talk helper idle "Now I think we should do an activity, what do you like doing?"
166
+ "let's make choices cause I like making choices!" if $data.likeChoices:
167
+ jump makeChoices
168
+ "let's do nothing!":
169
+ jump doNothing
170
+
171
+
172
+ dontAskForHelp:
173
+ // clear_dialog
174
+ talk inner idle "Maybe we should get help though? I don't really know what else to do"
175
+ jump main
176
+
177
+ makeChoices:
178
+ choice:
179
+ talk inner idle "I don't know, we've been making a lot of choices already lately."
180
+ "I still want to make a choice!":
181
+ talk helper idle "Well you just made one, it turns out. Can we continue now?"
182
+ jump doNothing
183
+ "I guess you're right":
184
+ jump doNothing
185
+
186
+
187
+ doNothing:
188
+ choice:
189
+ talk music_cat idle "How about we get some music in here?"
190
+ "Play some relaxing music":
191
+ "The music is going to start and stop with timers to show the feature"
192
+ play music calm
193
+ wait 2000
194
+ pause music
195
+ wait 500
196
+ play music calm
197
+ wait 500
198
+ stop music
199
+ wait 500
200
+ play music calm
201
+ "I hate music":
202
+ talk music_cat idle "Well too bad, it's up to you."
203
+ jump otherFeatures
204
+
205
+ otherFeatures:
206
+ talk helper idle "There are lots of other features, like skill checks and conditions."
207
+ if (roll someSkillCheck agility 40):
208
+ "For example this line only appears if you passed a skill check"
209
+ "This engine is still very early and not fully documented yet, but you can look at the example demo and how it is made."
210
+ "There is also a screen feature on the left where you can display background images with interactive buttons."
211
+ jump showMap
212
+
213
+ showMap:
214
+ set_screen map
215
+ set_button parkButton true
216
+ talk helper idle "This is an example map. There are buttons you can click on. It is possible to dynanically enable and disable buttons in your script"
217
+ talk helper idle "You can view the source script for this demo in the <a href=\"https:\/\/github.com\/nialna\/narrat-demo\">demo repo</a>"
218
+
219
+ quest_demo:
220
+ set_button shopButton true
221
+ set_button parkButton false
222
+ jump bread_quest
223
+
224
+ bread_quest:
225
+ choice:
226
+ talk helper idle "Can you get 2 pieces of bread for me?"
227
+ "Yes":
228
+ talk helper idle "Thanks, that's very nice!"
229
+ talk helper idle "I'll be waiting for you at the park"
230
+ jump bread_start
231
+ "No":
232
+ talk helper idle "Oh, okay"
233
+ jump quest_demo
234
+
235
+ bread_start:
236
+ start_quest breadShopping
237
+ talk inner idle "Time to go to the shop to buy some bread then."
238
+ set_screen map
239
+ set_button shopButton true
240
+
241
+ shopButton:
242
+ set_screen default
243
+ "You visit the bread shop"
244
+ talk shopkeeper idle "Hello, I'm a little baker selling bread!"
245
+ set data.breadPrice 5
246
+ jump shop_menu
247
+
248
+ parkButton:
249
+ choice:
250
+ talk helper idle "Ah, so do you have my bread?"
251
+ "Yes!" if (>= $items.bread.amount 2):
252
+ talk helper idle "Thanks a lot!"
253
+ complete_objective breadShopping delivery
254
+ complete_quest breadShopping
255
+ "No :(":
256
+ talk helper idle "Oh okay"
257
+ set_button parkButton false
258
+
259
+ shop_menu:
260
+ choice:
261
+ talk shopkeeper idle "So, do you want some bread?"
262
+ "Buy bread (costs %{data.breadPrice})" if (>= $stats.money.value $data.breadPrice):
263
+ add_item bread 1
264
+ if (== $data.breadPrice 5):
265
+ add_stat money -5
266
+ else:
267
+ add_stat money -4
268
+ jump map_update
269
+ roll bread_haggle haggling 50 "Try to haggle for bread" hideAfterRoll:
270
+ success "You explain that helper cat needs bread to feed his poor family":
271
+ set data.breadPrice 4
272
+ talk shopkeeper idle "I guess I can sell you bread for 4 coins"
273
+ jump shop_menu
274
+ failure "You try to pity trip the shopkeeper but he won't bulge":
275
+ talk shopkeeper idle "The price is 5 coins, nothing less, nothing more."
276
+ jump shop_menu
277
+ "Exit":
278
+ jump map_update
279
+
280
+ map_update:
281
+ if (>= $items.bread.amount 2):
282
+ complete_objective breadShopping bread
283
+ talk inner idle "I've got enough bread now, I'm going to go to the park."
284
+ start_objective breadShopping delivery
285
+ set_screen map
286
+ set_button parkButton true
287
+ set_button shopButton false
288
+ else:
289
+ talk inner idle "Hmm, I still need to buy more bread for helper cat."
290
+ set_screen map
291
+
292
+ eat_bread:
293
+ talk player idle "hmm, bread"
294
+
295
+ read_book:
296
+ talk inner idle "It's full of ocult rituals. I'm not sure what they are, but I'm sure they are useful."
297
+
298
+ label_to_jump:
299
+ talk cat idle "The code has now jumped to this label"
300
+
301
+ jump_example:
302
+ talk cat idle "Hello, this is an example about jumping to other labels"
303
+ talk cat idle "Use the jump command to jump to a different label in any of your scripts"
304
+ jump label_to_jump
305
+
306
+ choice_example:
307
+ talk cat idle "This example shows how to use the choice command"
308
+ choice:
309
+ "This is the choice prompt text"
310
+ "This is the first option the player can select":
311
+ talk cat idle "I will say this if you select the first option"
312
+ "This is the second choice the player can pick":
313
+ talk cat idle "I see you picked the second choice!"
314
+
315
+ choice_example_conditions:
316
+ talk cat idle "This example shows how to use conditions in choices"
317
+ choice:
318
+ "This is the choice prompt text"
319
+ "This choice will only appear if a condition is met" if $data.someFlag:
320
+ talk cat idle "Choice response"
321
+ roll someSkillCheck agility 50 "This choice will run a skill check":
322
+ success "Skill check succeeded":
323
+ "This line will appear if the skill check succeeds"
324
+ failure "Skill check failed":
325
+ "This line will appear if the skill check fails"
326
+
327
+
328
+ set_example:
329
+ choice:
330
+ talk cat idle "Do you like surprises?"
331
+ "Yes":
332
+ set data.like_surprises true
333
+ "No!":
334
+ set data.like_surprises false
335
+ if $data.like_surprises:
336
+ talk cat idle "Since you like surprises, here's a surprise message"
337
+
338
+
339
+ add_example:
340
+ set data.counter 0
341
+ jump add_example_add
342
+
343
+ add_example_add:
344
+ choice:
345
+ talk cat idle "Do you want to increase the counter? You can only do it 10 times":
346
+ "Increase the counter" if (< $data.counter 10):
347
+ add data.counter 1
348
+ "No!":
349
+ talk cat idle "Ok then"
350
+ "I'm done" if (>= $data.counter 10):
351
+ jump add_example_end
352
+ jump add_example_add
353
+
354
+ add_example_end:
355
+ talk cat idle "It seems you're done with the counter now"
356
+
357
+ talk_example:
358
+ talk cat idle "I'm talking to you!"
359
+ "This is a shortcut for the narrator talking"
360
+ talk player idle "The player can also talk"