rpg-engine 0.20.0 → 0.21.0

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 (160) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.d.ts +3 -0
  4. package/dist/adventures/source.js +11 -49
  5. package/dist/campaign/create-campaign.d.ts +1 -1
  6. package/dist/campaign/create-campaign.js +3 -2
  7. package/dist/campaign/find-campaign.d.ts +2 -0
  8. package/dist/campaign/find-campaign.js +2 -0
  9. package/dist/campaign/index.d.ts +1 -1
  10. package/dist/campaign/index.js +1 -1
  11. package/dist/campaign/settings.js +2 -2
  12. package/dist/commands/book.d.ts +16 -35
  13. package/dist/commands/book.js +86 -62
  14. package/dist/commands/config/config.js +1 -1
  15. package/dist/commands/config/dashboard.d.ts +2 -2
  16. package/dist/commands/config/dashboard.js +9 -3
  17. package/dist/commands/config/words.js +1 -1
  18. package/dist/commands/image.d.ts +5 -0
  19. package/dist/commands/image.js +6 -3
  20. package/dist/commands/package/data.d.ts +35 -0
  21. package/dist/commands/package/data.js +117 -0
  22. package/dist/commands/package/here.d.ts +7 -2
  23. package/dist/commands/package/here.js +23 -11
  24. package/dist/commands/package/install.js +14 -15
  25. package/dist/commands/package/language.d.ts +15 -0
  26. package/dist/commands/package/language.js +109 -0
  27. package/dist/commands/package/package.js +20 -10
  28. package/dist/commands/package/result.d.ts +19 -0
  29. package/dist/commands/package/theme.d.ts +13 -0
  30. package/dist/commands/package/theme.js +66 -0
  31. package/dist/commands/package/uninstall.d.ts +4 -1
  32. package/dist/commands/package/uninstall.js +29 -9
  33. package/dist/commands/scene/close.d.ts +1 -1
  34. package/dist/commands/scene/close.js +15 -8
  35. package/dist/commands/shared/books/adventures.d.ts +0 -4
  36. package/dist/commands/shared/books/adventures.js +2 -31
  37. package/dist/commands/shared/books/words.js +3 -2
  38. package/dist/commands/shared/campaign/book.d.ts +21 -8
  39. package/dist/commands/shared/campaign/book.js +65 -42
  40. package/dist/commands/shared/campaign/saves.js +2 -2
  41. package/dist/commands/shared/campaign/world.js +2 -1
  42. package/dist/commands/shared/packages/catalog.d.ts +3 -3
  43. package/dist/commands/shared/packages/catalog.js +98 -42
  44. package/dist/commands/shared/packages/unpacked.d.ts +50 -0
  45. package/dist/commands/shared/packages/unpacked.js +146 -0
  46. package/dist/core/archive.d.ts +13 -0
  47. package/dist/core/archive.js +76 -0
  48. package/dist/core/context.d.ts +2 -0
  49. package/dist/core/context.js +1 -0
  50. package/dist/core/store.d.ts +5 -1
  51. package/dist/core/store.js +15 -2
  52. package/dist/dashboard/api.js +24 -1
  53. package/dist/dashboard/app.js +7 -2
  54. package/dist/dashboard/guide/ar.md +8 -8
  55. package/dist/dashboard/guide/cs.md +8 -8
  56. package/dist/dashboard/guide/da.md +9 -9
  57. package/dist/dashboard/guide/de.md +8 -8
  58. package/dist/dashboard/guide/el.md +8 -8
  59. package/dist/dashboard/guide/en.md +7 -7
  60. package/dist/dashboard/guide/es.md +8 -8
  61. package/dist/dashboard/guide/fi.md +8 -8
  62. package/dist/dashboard/guide/fr.md +8 -8
  63. package/dist/dashboard/guide/he.md +8 -8
  64. package/dist/dashboard/guide/hi.md +8 -8
  65. package/dist/dashboard/guide/hu.md +8 -8
  66. package/dist/dashboard/guide/is.md +8 -8
  67. package/dist/dashboard/guide/it.md +8 -8
  68. package/dist/dashboard/guide/ja.md +8 -8
  69. package/dist/dashboard/guide/ko.md +8 -8
  70. package/dist/dashboard/guide/nb.md +9 -9
  71. package/dist/dashboard/guide/nl.md +8 -8
  72. package/dist/dashboard/guide/pl.md +8 -8
  73. package/dist/dashboard/guide/pt.md +8 -8
  74. package/dist/dashboard/guide/ro.md +8 -8
  75. package/dist/dashboard/guide/ru.md +9 -9
  76. package/dist/dashboard/guide/sv.md +8 -8
  77. package/dist/dashboard/guide/tr.md +8 -8
  78. package/dist/dashboard/guide/uk.md +9 -9
  79. package/dist/dashboard/guide/zh.md +8 -8
  80. package/dist/dashboard/i18n/ar.json +33 -5
  81. package/dist/dashboard/i18n/cs.json +33 -5
  82. package/dist/dashboard/i18n/da.json +33 -5
  83. package/dist/dashboard/i18n/de.json +33 -5
  84. package/dist/dashboard/i18n/el.json +33 -5
  85. package/dist/dashboard/i18n/es.json +33 -5
  86. package/dist/dashboard/i18n/fi.json +33 -5
  87. package/dist/dashboard/i18n/fr.json +33 -5
  88. package/dist/dashboard/i18n/he.json +33 -5
  89. package/dist/dashboard/i18n/hi.json +33 -5
  90. package/dist/dashboard/i18n/hu.json +33 -5
  91. package/dist/dashboard/i18n/is.json +33 -5
  92. package/dist/dashboard/i18n/it.json +33 -5
  93. package/dist/dashboard/i18n/ja.json +33 -5
  94. package/dist/dashboard/i18n/ko.json +33 -5
  95. package/dist/dashboard/i18n/nb.json +33 -5
  96. package/dist/dashboard/i18n/nl.json +33 -5
  97. package/dist/dashboard/i18n/pl.json +33 -5
  98. package/dist/dashboard/i18n/pt.json +33 -5
  99. package/dist/dashboard/i18n/ro.json +33 -5
  100. package/dist/dashboard/i18n/ru.json +33 -5
  101. package/dist/dashboard/i18n/sv.json +33 -5
  102. package/dist/dashboard/i18n/tr.json +33 -5
  103. package/dist/dashboard/i18n/uk.json +33 -5
  104. package/dist/dashboard/i18n/zh.json +33 -5
  105. package/dist/dashboard/journal/book.js +3 -2
  106. package/dist/dashboard/journal/journal.js +8 -5
  107. package/dist/dashboard/kit.js +1 -1
  108. package/dist/dashboard/packages/catalog.js +31 -14
  109. package/dist/dashboard/packages/engine.js +46 -2
  110. package/dist/dashboard/packages/installed.js +13 -0
  111. package/dist/dashboard/packages/outcomes.js +21 -0
  112. package/dist/dashboard/packages/packages.js +41 -18
  113. package/dist/dashboard/packages/rows.js +3 -1
  114. package/dist/dashboard/parts/icons.js +3 -0
  115. package/dist/dashboard/parts/picture.js +89 -0
  116. package/dist/dashboard/parts/refusals.js +8 -1
  117. package/dist/dashboard/parts/widgets.js +2 -1
  118. package/dist/dashboard/play/scene.js +8 -5
  119. package/dist/dashboard/settings/settings.js +23 -13
  120. package/dist/dashboard/sheet/party.js +5 -2
  121. package/dist/dashboard/sheet/sheet.js +2 -1
  122. package/dist/dashboard/shell/notices.js +2 -2
  123. package/dist/dashboard/shell/system-style.js +45 -12
  124. package/dist/dashboard/shell/tooltip.js +223 -0
  125. package/dist/dashboard/style.css +283 -132
  126. package/dist/dashboard/world/lore.js +4 -3
  127. package/dist/dashboard/world/place-card.js +2 -1
  128. package/dist/languages/index.d.ts +1 -1
  129. package/dist/languages/index.js +1 -1
  130. package/dist/languages/pack.d.ts +4 -1
  131. package/dist/languages/pack.js +16 -5
  132. package/dist/packages/engine.d.ts +7 -0
  133. package/dist/packages/engine.js +32 -1
  134. package/dist/packages/index.d.ts +1 -1
  135. package/dist/packages/index.js +1 -1
  136. package/dist/server/dashboard/engine.d.ts +18 -0
  137. package/dist/server/dashboard/engine.js +31 -0
  138. package/dist/server/dashboard/files.d.ts +8 -1
  139. package/dist/server/dashboard/files.js +30 -10
  140. package/dist/server/dashboard/index.d.ts +3 -0
  141. package/dist/server/dashboard/index.js +10 -1
  142. package/dist/server/dashboard/pictures.d.ts +7 -0
  143. package/dist/server/dashboard/pictures.js +62 -0
  144. package/dist/server/dashboard/writes.d.ts +5 -3
  145. package/dist/server/dashboard/writes.js +45 -14
  146. package/dist/testing/index.js +1 -0
  147. package/dist/themes/index.d.ts +2 -1
  148. package/dist/themes/index.js +4 -2
  149. package/dist/themes/installed.d.ts +14 -0
  150. package/dist/themes/installed.js +28 -0
  151. package/dist/themes/theme.d.ts +7 -0
  152. package/dist/themes/theme.js +22 -0
  153. package/instructions/core.md +3 -3
  154. package/instructions/dashboard-guide.md +1 -0
  155. package/instructions/mentor-hints.md +1 -1
  156. package/instructions/mentor-tutorial.md +1 -1
  157. package/instructions/party.md +1 -1
  158. package/instructions/play.md +2 -2
  159. package/package.json +1 -1
  160. package/systems/free/instructions/outcomes-told.md +1 -1
@@ -1,3 +1,3 @@
1
1
  export { type AdventureManifest, manifestFileName, manifestLine, readManifest, writeManifest } from "./manifest.ts";
2
2
  export { adventureFolderName, adventureTarget } from "./placement.ts";
3
- export { type AdventureFiles, isAdventureFolder, largestAdventure, packAdventure, readAdventureFolder, readAdventureZip } from "./source.ts";
3
+ export { type AdventureFiles, isAdventureFolder, largestAdventure, packAdventure, readAdventureEntries, readAdventureFolder, readAdventureZip } from "./source.ts";
@@ -2,4 +2,4 @@
2
2
  // .zip an export writes (ADV-7).
3
3
  export { manifestFileName, manifestLine, readManifest, writeManifest } from "./manifest.js";
4
4
  export { adventureFolderName, adventureTarget } from "./placement.js";
5
- export { isAdventureFolder, largestAdventure, packAdventure, readAdventureFolder, readAdventureZip } from "./source.js";
5
+ export { isAdventureFolder, largestAdventure, packAdventure, readAdventureEntries, readAdventureFolder, readAdventureZip } from "./source.js";
@@ -1,3 +1,4 @@
1
+ import { type PackageEntry } from "../core/archive.ts";
1
2
  import { type AdventureManifest } from "./manifest.ts";
2
3
  /** The folders an adventure has, as a campaign has them (D-372). */
3
4
  export declare const adventureFolders: readonly ["world", "images", "rules"];
@@ -21,3 +22,5 @@ export declare function readAdventureZip(bytes: Uint8Array, label: string): Adve
21
22
  export declare function readAdventureFolder(folder: string): AdventureFiles;
22
23
  /** The .zip of an adventure, its manifest first and its files in order of path: the same adventure gives the same bytes (ADV-7). */
23
24
  export declare function packAdventure(manifest: AdventureManifest, held: Record<string, Uint8Array>): Uint8Array;
25
+ /** The adventure from a package's files whose paths are checked, its manifest at their top (ADV-1); it throws, saying why, when it is refused. */
26
+ export declare function readAdventureEntries(label: string, inner: PackageEntry[]): AdventureFiles;
@@ -1,6 +1,7 @@
1
- import { unzipSync, zipSync } from "fflate";
1
+ import { zipSync } from "fflate";
2
2
  import { relative, sep } from "node:path";
3
- import { archivePathParts, refuseTwice } from "../core/archive-paths.js";
3
+ import { refuseTwice } from "../core/archive-paths.js";
4
+ import { packageEntries, topFile, unzipFiles } from "../core/archive.js";
4
5
  import { filesIn } from "../core/files.js";
5
6
  import { Refusal } from "../core/refusal.js";
6
7
  import { files } from "../core/store.js";
@@ -14,8 +15,6 @@ const layersFolder = "layers";
14
15
  export const largestAdventure = 512 * 1024 * 1024;
15
16
  // What each folder may hold: pages and rules are markdown, pictures as the engine shows them.
16
17
  const allowed = { world: /\.md$/i, images: /\.(png|jpg|webp|svg)$/i, rules: /\.md$/i };
17
- // What a computer leaves beside files, which no one put in the adventure.
18
- const litter = /^(\..*|__macosx|thumbs\.db|desktop\.ini)$/i;
19
18
  // The time every file of an exported zip carries, so that the same adventure gives the same bytes.
20
19
  const fixedTime = new Date(1980, 0, 1);
21
20
  /** Whether a folder of this computer is an adventure: it has a manifest. */
@@ -24,24 +23,7 @@ export function isAdventureFolder(folder) {
24
23
  }
25
24
  /** The adventure a .zip holds (ADV-1), at its top or inside one folder there, as GitHub zips a repository; it throws, saying why, when it is refused. */
26
25
  export function readAdventureZip(bytes, label) {
27
- let declared = 0;
28
- let read;
29
- try {
30
- read = unzipSync(bytes, {
31
- filter: (file) => {
32
- declared += file.originalSize;
33
- if (declared > largestAdventure) {
34
- throw new Error(`it unpacks to more than ${largestAdventure / 1024 / 1024} MB, more than an adventure may`);
35
- }
36
- return true;
37
- },
38
- });
39
- }
40
- catch (error) {
41
- throw new Refusal(`${label} is not a .zip that reads: ${error instanceof Error ? error.message : String(error)}. Nothing changed.`, "archive-unread", { name: label });
42
- }
43
- const named = Object.entries(read).filter(([name]) => !/[\\/]$/.test(name)).map(([name, data]) => [utf8Name(label, name), data]);
44
- return adventureOf(label, named);
26
+ return adventureOf(label, unzipFiles(bytes, label, largestAdventure, "an adventure"));
45
27
  }
46
28
  /** The adventure a folder of this computer holds (ADV-1); it throws, saying why, when it is refused. */
47
29
  export function readAdventureFolder(folder) {
@@ -56,33 +38,9 @@ export function packAdventure(manifest, held) {
56
38
  }
57
39
  return zipSync(ordered, { level: 6, mtime: fixedTime });
58
40
  }
59
- /**
60
- * A file's name in a .zip as it was written: one without the zip's UTF-8 mark reads byte by byte, so its UTF-8 is read again, as macOS writes it; one in an old
61
- * code page, as Windows' own tar writes it, is refused with what to do.
62
- */
63
- function utf8Name(label, name) {
64
- if (/^[\u0000-ÿ]*$/.test(name) && /[\u0080-ÿ]/.test(name)) {
65
- try {
66
- return new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(name, (character) => character.charCodeAt(0))).normalize("NFC");
67
- }
68
- catch {
69
- // Not UTF-8 byte by byte: a name the zip marked as UTF-8 already, or one in an old code page.
70
- }
71
- }
72
- if (/[\u0080-\u009f]/.test(name)) {
73
- throw new Refusal(`${label} names a file with accents not written in UTF-8 (${name}): make the zip again with 7-Zip, or Compress-Archive in PowerShell. Nothing changed.`, "archive-accents", { name: label });
74
- }
75
- return name.normalize("NFC");
76
- }
77
- /** The adventure from a package's files: its paths checked, the one folder at its top that holds it all taken away, and what it may hold kept. */
78
- function adventureOf(label, entries) {
79
- // What a computer leaves beside the files, as macOS's __MACOSX, goes before the folder at the top is looked for.
80
- const checked = entries.map(([name, data]) => [archivePathParts(label, name, "the adventure"), data])
81
- .filter(([parts]) => parts.length > 0 && !parts.some((part) => litter.test(part)));
82
- const atTop = checked.some(([parts]) => parts.length === 1 && parts[0].toLowerCase() === manifestFileName);
83
- const tops = new Set(checked.map(([parts]) => parts[0]));
84
- const inner = !atTop && tops.size === 1 ? checked.map(([parts, data]) => [parts.slice(1), data]).filter(([parts]) => parts.length > 0) : checked;
85
- const manifest = inner.find(([parts]) => parts.length === 1 && parts[0].toLowerCase() === manifestFileName);
41
+ /** The adventure from a package's files whose paths are checked, its manifest at their top (ADV-1); it throws, saying why, when it is refused. */
42
+ export function readAdventureEntries(label, inner) {
43
+ const manifest = topFile(inner, manifestFileName);
86
44
  if (manifest === undefined) {
87
45
  throw new Refusal(`${label} has no ${manifestFileName} at its top: it is not an adventure. A document or a folder of notes is imported by the master, who writes its pages. Nothing changed.`, "not-adventure", { name: label });
88
46
  }
@@ -121,6 +79,10 @@ function adventureOf(label, entries) {
121
79
  refuseTwice(label, layerPaths);
122
80
  return { manifest: read, files: held, layers, ignored: [...ignored].sort() };
123
81
  }
82
+ /** The adventure from a package's files: its paths checked, the one folder at its top that holds it all taken away, and what it may hold kept. */
83
+ function adventureOf(label, entries) {
84
+ return readAdventureEntries(label, packageEntries(label, entries, "the adventure", [manifestFileName]));
85
+ }
124
86
  /**
125
87
  * Where a file under layers/ lies over the pages of the game system (ADV-8): only in layers/<the system the adventure needs>/world/, in markdown. Another folder
126
88
  * there, a file of another kind, or layers in an adventure that needs no system refuse it whole.
@@ -1,7 +1,7 @@
1
1
  import { type HostInstructions } from "./host-files.ts";
2
2
  import { type CampaignSettings } from "./settings.ts";
3
3
  /**
4
- * Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
4
+ * Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the inbox for the player's pictures, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
5
5
  * and the host files that send them to the start lines and give Claude Code the character agent (D-97, D-242, D-490). `platform` is the operating system, as Node names it. Returns the campaign's full path.
6
6
  */
7
7
  export declare function createCampaign(folder: string, settings: CampaignSettings, platform: string, instructions: HostInstructions): string;
@@ -3,11 +3,11 @@ import { join, resolve } from "node:path";
3
3
  import { stringify } from "yaml";
4
4
  import { z } from "zod";
5
5
  import { files } from "../core/store.js";
6
- import { campaignFileName, findCampaign, sessionsFolderName } from "./find-campaign.js";
6
+ import { campaignFileName, findCampaign, inboxFolderName, sessionsFolderName } from "./find-campaign.js";
7
7
  import { hostFileChanges, rpgServer, writeHostFile } from "./host-files.js";
8
8
  import { settingsSchema } from "./settings.js";
9
9
  /**
10
- * Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
10
+ * Creates a campaign in `folder`: campaign.yaml, state.yaml, the sessions folder, the inbox for the player's pictures, the .mcp.json through which AI hosts such as Claude Code find the rpg tools,
11
11
  * and the host files that send them to the start lines and give Claude Code the character agent (D-97, D-242, D-490). `platform` is the operating system, as Node names it. Returns the campaign's full path.
12
12
  */
13
13
  export function createCampaign(folder, settings, platform, instructions) {
@@ -20,6 +20,7 @@ export function createCampaign(folder, settings, platform, instructions) {
20
20
  const mcpConfig = mcpConfigWithRpg(root, platform);
21
21
  const hostFiles = hostFileChanges(root, instructions, platform);
22
22
  files().makeFolder(join(root, sessionsFolderName));
23
+ files().makeFolder(join(root, inboxFolderName));
23
24
  files().write(join(root, campaignFileName), `# Campaign settings: change them with the config command.\n${stringify(parsed.data)}`);
24
25
  // A new campaign starts in setup (MOD-1).
25
26
  files().write(join(root, "state.yaml"), "# The present of the game, kept by rpg: mode, date and current scene.\nmode: setup\n");
@@ -4,6 +4,8 @@ export declare const campaignFileName = "campaign.yaml";
4
4
  export declare const houseRulesFolderName = "rules";
5
5
  /** The folder of a campaign with its chats as text, copied from the AI hosts as they go on, kept out of the saves (T-225). */
6
6
  export declare const sessionsFolderName = "sessions";
7
+ /** The folder of a campaign where the player drops pictures of their own, which the master gives to pages with image (D-572 (3)); kept out of the saves. */
8
+ export declare const inboxFolderName = "inbox";
7
9
  /** The folder of a campaign with its story told as a book, a chapter for each closed scene, kept out of the saves (T-227). */
8
10
  export declare const bookFolderName = "book";
9
11
  /** The campaign that holds `folder`: the nearest folder, from `folder` upwards, with a campaign.yaml. */
@@ -6,6 +6,8 @@ export const campaignFileName = "campaign.yaml";
6
6
  export const houseRulesFolderName = "rules";
7
7
  /** The folder of a campaign with its chats as text, copied from the AI hosts as they go on, kept out of the saves (T-225). */
8
8
  export const sessionsFolderName = "sessions";
9
+ /** The folder of a campaign where the player drops pictures of their own, which the master gives to pages with image (D-572 (3)); kept out of the saves. */
10
+ export const inboxFolderName = "inbox";
9
11
  /** The folder of a campaign with its story told as a book, a chapter for each closed scene, kept out of the saves (T-227). */
10
12
  export const bookFolderName = "book";
11
13
  /** The campaign that holds `folder`: the nearest folder, from `folder` upwards, with a campaign.yaml. */
@@ -1,6 +1,6 @@
1
1
  export { type ChoiceItem, type ChoiceSet, type PickRange, pickText, readChoices, readPick, writeChoices } from "./choices.ts";
2
2
  export { createCampaign } from "./create-campaign.ts";
3
- export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.ts";
3
+ export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, inboxFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.ts";
4
4
  export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.ts";
5
5
  export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.ts";
6
6
  export { type CountedByGame, customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, type LeveledSetting, rigorItems, rigors, startingLevels } from "./levels.ts";
@@ -1,7 +1,7 @@
1
1
  // The campaign: a folder with campaign.yaml, its settings, the present, the sessions and the files an AI host reads.
2
2
  export { pickText, readChoices, readPick, writeChoices } from "./choices.js";
3
3
  export { createCampaign } from "./create-campaign.js";
4
- export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.js";
4
+ export { bookFolderName, campaignFileName, findCampaign, houseRulesFolderName, inboxFolderName, requireCampaign, sessionsFolderName } from "./find-campaign.js";
5
5
  export { hasCharacterAgent, hostFileNames, refreshHostFiles, writeEffortFiles } from "./host-files.js";
6
6
  export { lastChoices, rememberChoice, rememberedSettings } from "./last-choices.js";
7
7
  export { customLevel, customLevels, customSettings, difficulties, difficultyItems, itemMeaning, leveled, rigorItems, rigors, startingLevels } from "./levels.js";
@@ -258,8 +258,8 @@ export function checkSettingName(name) {
258
258
  export const mentorWays = ["off", "hints", "tutorial"];
259
259
  /** What each way of the mentor means to the master, which config gives for the chosen one, and the player's change of it on the dashboard (D-347). */
260
260
  const mentorMeanings = {
261
- off: "the story alone: no tips or explanations of yours, only your answers to what the player asks between brackets",
262
- hints: "a tip of a sentence or two, in brackets, before a choice that matters and when a rule slips by, as the mentor's part of your instructions says; no lessons",
261
+ off: "the story alone: no tips or explanations of yours, only your answers to what the player asks in [OOC: …]",
262
+ hints: "a tip of a sentence or two, in [OOC: …], before a choice that matters and when a rule slips by, as the mentor's part of your instructions says; no lessons",
263
263
  tutorial: "each mechanic explained the first time it comes up, the whole sum of a roll shown, a debrief after fights and at the end of a session, "
264
264
  + "as the mentor's part of your instructions says",
265
265
  };
@@ -1,55 +1,36 @@
1
1
  import { z } from "zod";
2
- import { type SceneChapter } from "./shared/campaign/book.ts";
2
+ import { type StoryScene } from "./shared/campaign/book.ts";
3
3
  export declare const book: import("../core/registry.ts").Command<z.ZodObject<{
4
4
  chapter: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
5
5
  title: z.ZodOptional<z.ZodString>;
6
6
  text: z.ZodOptional<z.ZodString>;
7
+ through: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
7
8
  }, z.core.$strip>, {
9
+ kind: "written";
10
+ number: number;
11
+ title: string;
12
+ scenes: StoryScene[];
13
+ words: number;
14
+ untold: number;
15
+ } | {
8
16
  kind: "list";
9
17
  written: number;
10
- closed: number;
11
- missing: SceneChapter[];
18
+ untold: StoryScene[];
12
19
  craft: string | undefined;
13
- scene?: undefined;
14
20
  chapter?: undefined;
15
- had?: undefined;
16
- title?: undefined;
17
- words?: undefined;
18
- left?: undefined;
21
+ number?: undefined;
19
22
  } | {
20
23
  kind: "read";
21
- scene: SceneChapter;
22
- chapter: import("./shared/campaign/book.ts").BookChapter | undefined;
24
+ chapter: import("./shared/campaign/book.ts").WrittenChapter;
23
25
  craft: string | undefined;
24
26
  written?: undefined;
25
- closed?: undefined;
26
- missing?: undefined;
27
- had?: undefined;
28
- title?: undefined;
29
- words?: undefined;
30
- left?: undefined;
27
+ untold?: undefined;
28
+ number?: undefined;
31
29
  } | {
32
30
  kind: "removed";
33
- scene: SceneChapter;
34
- had: boolean;
35
- written?: undefined;
36
- closed?: undefined;
37
- missing?: undefined;
38
- craft?: undefined;
39
- chapter?: undefined;
40
- title?: undefined;
41
- words?: undefined;
42
- left?: undefined;
43
- } | {
44
- kind: "written";
45
- scene: SceneChapter;
46
- title: string;
47
- words: number;
48
- left: number[];
31
+ number: number;
49
32
  written?: undefined;
50
- closed?: undefined;
51
- missing?: undefined;
33
+ untold?: undefined;
52
34
  craft?: undefined;
53
35
  chapter?: undefined;
54
- had?: undefined;
55
36
  }>;
@@ -2,101 +2,125 @@ import { z } from "zod";
2
2
  import { requireCampaign } from "../campaign/index.js";
3
3
  import { appendLogEntry } from "../core/log.js";
4
4
  import { defineCommand } from "../core/registry.js";
5
- import { campaignBook, chapterCraft, removeChapter, sceneChapters, writeChapter } from "./shared/campaign/book.js";
5
+ import { campaignBook, chapterCraft, removeChapter, scenesText, storyScenes, untoldScenes, writeChapter } from "./shared/campaign/book.js";
6
6
  import { firstInChat } from "./shared/campaign/parts.js";
7
7
  import { newDatedLogEntry } from "./shared/time/time.js";
8
- // How many chapters still to write a list shows, the first; the others are counted.
9
- const listedChapters = 20;
8
+ // How many scenes still untold a list shows, the first; the others are counted.
9
+ const listedScenes = 20;
10
10
  // The longest chapter the book takes, in characters.
11
- const chapterLength = 60_000;
11
+ const chapterLength = 80_000;
12
12
  export const book = defineCommand({
13
13
  name: "book",
14
- description: "The campaign's story told as a book, which the player reads in the dashboard's Journal: a novel's chapter, never a summary, for each closed scene, by its number. "
15
- + "Write each once its scene closes. With nothing, it lists the closed chapters still to write, which is how a campaign begun without the book gets the story so far; "
16
- + "with chapter alone, it reads one back, so that the voice holds from one to the next; empty text takes it out. The first call in a chat says how to write them.",
14
+ description: "The campaign's story told as a book, which the player reads in the dashboard's Journal: chapters of a novel, never summaries, each telling the scenes closed since the last one, "
15
+ + "ended where the story turns. With nothing, it lists the closed scenes no chapter tells yet, which is how a campaign begun without the book gets the story so far; "
16
+ + "text writes the next chapter, of those scenes or of those through one; with chapter alone, it reads one back, so that the voice holds from one to the next, and with text it writes it again; "
17
+ + "empty text takes the last out. The first call in a chat says how to write them.",
17
18
  group: "game",
18
19
  positionals: ["chapter"],
19
20
  input: z.object({
20
- chapter: z.coerce.number().int().positive().optional().describe("the chapter's number, its scene's as the journal counts them"),
21
- title: z.string().optional().describe("the chapter's title, its scene's if left out"),
22
- text: z.string().optional().describe("the chapter's prose, in markdown; empty to take it out"),
21
+ chapter: z.coerce.number().int().positive().optional().describe("the number of a chapter written, to read, write again or retitle; the next chapter if left out"),
22
+ title: z.string().optional().describe("the chapter's title, its first scene's if left out"),
23
+ text: z.string().optional().describe("the chapter's prose, in markdown; empty to take the last chapter out"),
24
+ through: z.coerce.number().int().positive().optional().describe("for the next chapter, the number of its last scene, when it tells only the first of the scenes still untold"),
23
25
  }),
24
26
  run(input, context) {
25
27
  const root = requireCampaign(context.folder);
26
- const scenes = sceneChapters(root);
27
28
  const written = campaignBook(root);
29
+ const untold = untoldScenes(root, written);
28
30
  const craft = firstInChat(context, "book") ? chapterCraft : undefined;
29
- const unwritten = (scene) => scene.to !== undefined && !written.some((chapter) => chapter.number === scene.number);
30
- if (input.chapter === undefined) {
31
- if (input.title !== undefined || input.text !== undefined) {
32
- throw new Error("Give chapter, the number of the chapter to write: book alone lists those still to write. Nothing written.");
33
- }
34
- return { kind: "list", written: written.length, closed: scenes.filter((scene) => scene.to !== undefined).length, missing: scenes.filter(unwritten), craft };
31
+ const next = written.length + 1;
32
+ if (input.through !== undefined && input.chapter !== undefined && input.chapter !== next) {
33
+ throw new Error(`through is for the next chapter, ${next}: chapter ${input.chapter} keeps its scenes. Nothing written.`);
35
34
  }
36
- const scene = closedScene(scenes, input.chapter);
37
- const before = written.find((chapter) => chapter.number === scene.number);
38
- if (input.text === undefined && input.title === undefined) {
39
- return { kind: "read", scene, chapter: before, craft };
35
+ if (input.chapter === undefined && input.title === undefined && input.text === undefined) {
36
+ return { kind: "list", written: written.length, untold, craft };
40
37
  }
41
- const text = (input.text ?? before?.text ?? "").replace(/\r\n?/g, "\n").trim().normalize("NFC");
42
- if (input.text !== undefined && text === "") {
43
- if (before !== undefined) {
44
- removeChapter(root, scene.number);
45
- appendLogEntry(root, newDatedLogEntry(root, context, "book-chapter", "hidden", { chapter: scene.number, removed: true }));
46
- }
47
- return { kind: "removed", scene, had: before !== undefined };
38
+ if (input.chapter === undefined || input.chapter === next) {
39
+ return writeNext(root, context, next, chapterScenes(untold, input.through), input.title, input.text);
48
40
  }
49
- if (text === "") {
50
- throw new Error(`Chapter ${scene.number} is not written yet: give its text with the title. Nothing written.`);
41
+ const before = written.find((chapter) => chapter.number === input.chapter);
42
+ if (before === undefined) {
43
+ throw new Error(`There is no chapter ${input.chapter}: the book has ${written.length}, and the next is ${next}. Nothing written.`);
51
44
  }
52
- if (text.length > chapterLength) {
53
- throw new Error(`This chapter is ${text.length} characters, the book takes ${chapterLength}: tell the scene shorter. Nothing written.`);
45
+ if (input.text === undefined && input.title === undefined) {
46
+ return { kind: "read", chapter: before, craft };
54
47
  }
55
- const title = input.title?.trim() || before?.title || scene.title;
56
- writeChapter(root, scene, title, text);
57
- const words = text.split(/\s+/).filter((word) => word !== "").length;
58
- appendLogEntry(root, newDatedLogEntry(root, context, "book-chapter", "hidden", { chapter: scene.number, title, words }));
59
- return { kind: "written", scene, title, words, left: scenes.filter((other) => other.number !== scene.number && unwritten(other)).map((other) => other.number) };
48
+ if (input.text !== undefined && input.text.trim() === "") {
49
+ if (before.number !== written.length) {
50
+ throw new Error(`Chapter ${before.number} has chapters after it: write it again, or take out the last first. Nothing written.`);
51
+ }
52
+ removeChapter(root, before.number);
53
+ appendLogEntry(root, newDatedLogEntry(root, context, "book-chapter", "hidden", { chapter: before.number, removed: true }));
54
+ return { kind: "removed", number: before.number };
55
+ }
56
+ const scenes = storyScenes(root).slice(before.first - 1, before.last);
57
+ const text = proseOf(input.text ?? before.text);
58
+ const title = input.title?.trim() || before.title;
59
+ writeChapter(root, before.number, scenes, title, text);
60
+ return logged(root, context, { number: before.number, title, text, scenes, untold: untold.length });
60
61
  },
61
62
  format(result) {
62
63
  const craft = "craft" in result && result.craft !== undefined ? `\n\n${result.craft}` : "";
63
64
  if (result.kind === "list") {
64
- if (result.closed === 0) {
65
- return `No scene has closed yet: the book's first chapter comes with the first scene's end.${craft}`;
66
- }
67
- if (result.missing.length === 0) {
68
- return `The book has every closed chapter, ${result.written}: write the next when its scene closes.${craft}`;
65
+ if (result.untold.length === 0) {
66
+ return `${result.written === 0 ? "The book has no chapter yet" : `The book has ${result.written} ${result.written === 1 ? "chapter" : "chapters"}`}, and no closed scene waits for one: `
67
+ + `the next chapter comes when the story turns, at a scene's end.${craft}`;
69
68
  }
70
- const lines = result.missing.slice(0, listedChapters).map(missingLine);
71
- const more = result.missing.length > listedChapters ? `\nAnd ${result.missing.length - listedChapters} more after them.` : "";
72
- return `The book has ${result.written} of ${result.closed} closed chapters. To write, in order, each from its chats first, then its summary and the pages:\n${lines.join("\n")}${more}${craft}`;
69
+ const lines = result.untold.slice(0, listedScenes).map(sceneLine);
70
+ const more = result.untold.length > listedScenes ? `\nAnd ${result.untold.length - listedScenes} more after them.` : "";
71
+ return `The book has ${result.written} ${result.written === 1 ? "chapter" : "chapters"}; ${scenesText(result.untold)} ${result.untold.length === 1 ? "waits" : "wait"} for the next. `
72
+ + `Tell them in chapters, each ending where the story turns (through gives a chapter's last scene), each from its chats first, then its summary and the pages:\n${lines.join("\n")}${more}${craft}`;
73
73
  }
74
74
  if (result.kind === "read") {
75
- return result.chapter === undefined
76
- ? `Chapter ${result.scene.number} is not written yet.\n${missingLine(result.scene)}${craft}`
77
- : `Chapter ${result.scene.number} «${result.chapter.title}»:\n\n${result.chapter.text}${craft}`;
75
+ return `Chapter ${result.chapter.number} «${result.chapter.title}», ${scenesText([{ number: result.chapter.first }, { number: result.chapter.last }])}:\n\n${result.chapter.text}${craft}`;
78
76
  }
79
77
  if (result.kind === "removed") {
80
- return result.had ? `Chapter ${result.scene.number} taken out of the book.` : `Chapter ${result.scene.number} was not in the book: nothing changed.`;
78
+ return `Chapter ${result.number} taken out of the book: its scenes wait for a chapter again.`;
81
79
  }
82
- const shown = result.left.slice(0, listedChapters).join(", ");
83
- const left = result.left.length === 0 ? "" : ` Still to write: ${shown}${result.left.length > listedChapters ? "…" : ""}.`;
84
- return `Chapter ${result.scene.number} «${result.title}» written, ${result.words} words: the player reads it in the Journal, under Story.${left}`;
80
+ const left = result.untold === 0 ? "" : ` Still untold: ${result.untold} closed ${result.untold === 1 ? "scene" : "scenes"}, for the next chapter.`;
81
+ return `Chapter ${result.number} «${result.title}», ${scenesText(result.scenes)}, written, ${result.words} words: the player reads it in the Journal, under Story.${left}${craft}`;
85
82
  },
86
83
  });
87
- /** The closed scene that is a chapter's; stops the command for any other number. */
88
- function closedScene(scenes, number) {
89
- const scene = scenes.find((one) => one.number === number);
90
- if (scene === undefined) {
91
- throw new Error(`There is no chapter ${number}: the story has ${scenes.length}. book alone lists those still to write. Nothing written.`);
84
+ /** The next chapter, telling these scenes. */
85
+ function writeNext(root, context, number, scenes, title, text) {
86
+ if (text === undefined || text.trim() === "") {
87
+ throw new Error(`Chapter ${number} is not written yet: give its text, the prose of ${scenesText(scenes)}. Nothing written.`);
92
88
  }
93
- if (scene.to === undefined) {
94
- throw new Error(`Chapter ${number} is the scene still open: write it once the scene closes. Nothing written.`);
89
+ const prose = proseOf(text);
90
+ const named = title?.trim() || scenes[0].title;
91
+ writeChapter(root, number, scenes, named, prose);
92
+ return logged(root, context, { number, title: named, text: prose, scenes, untold: untoldScenes(root).length });
93
+ }
94
+ /** The scenes the next chapter tells: the untold ones, or those through one; stops the command when there are none. */
95
+ function chapterScenes(untold, through) {
96
+ if (untold.length === 0) {
97
+ throw new Error("No closed scene waits for a chapter: the next comes when the story turns, at a scene's end. Nothing written.");
98
+ }
99
+ if (through === undefined) {
100
+ return untold;
101
+ }
102
+ const last = untold.findIndex((scene) => scene.number === through);
103
+ if (last === -1) {
104
+ throw new Error(`Scene ${through} is not one still untold: give through between ${untold[0].number} and ${untold.at(-1)?.number}. Nothing written.`);
95
105
  }
96
- return scene;
106
+ return untold.slice(0, last + 1);
107
+ }
108
+ /** A chapter's prose as the book keeps it; stops the command when it is too long. */
109
+ function proseOf(text) {
110
+ const prose = text.replace(/\r\n?/g, "\n").trim().normalize("NFC");
111
+ if (prose.length > chapterLength) {
112
+ throw new Error(`This chapter is ${prose.length} characters, the book takes ${chapterLength}: end it sooner, with through. Nothing written.`);
113
+ }
114
+ return prose;
115
+ }
116
+ /** A chapter written, in the log, with its length. */
117
+ function logged(root, context, chapter) {
118
+ const words = chapter.text.split(/\s+/).filter((word) => word !== "").length;
119
+ appendLogEntry(root, newDatedLogEntry(root, context, "book-chapter", "hidden", { chapter: chapter.number, title: chapter.title, scenes: chapter.scenes.map((scene) => scene.number), words }));
120
+ return { kind: "written", number: chapter.number, title: chapter.title, scenes: chapter.scenes, words, untold: chapter.untold };
97
121
  }
98
- /** A chapter to write: its title and game date, its summary, and when it ran in real time, for chats to read it. */
99
- function missingLine(scene) {
122
+ /** A scene still untold: its title and game date, its summary, and when it ran in real time, for chats to read it. */
123
+ function sceneLine(scene) {
100
124
  const date = scene.date === undefined ? "" : `, ${scene.date}`;
101
125
  const summary = scene.summary === undefined ? "" : `: ${scene.summary}`;
102
126
  const otherDay = scene.to !== undefined && scene.to.slice(0, 10) !== scene.from.slice(0, 10) ? ` of ${scene.to.slice(0, 10)}` : "";
@@ -246,7 +246,7 @@ function configure(input, context) {
246
246
  part,
247
247
  };
248
248
  }
249
- const ordersKept = "Kept until the player lifts it; the lines and veils still come first. An order for this scene only stays in the scene; when unsure, ask in one bracket.";
249
+ const ordersKept = "Kept until the player lifts it; the lines and veils still come first. An order for this scene only stays in the scene; when unsure, ask in one [OOC: …].";
250
250
  // The settings of free words the player may leave unset again, with the value none, and all those of how the master writes (D-395).
251
251
  const freeSettingNames = ["author", "style", "calendar"];
252
252
  /** A setting the game system adds, shown, or changed to one of its values (DAT-10); refused with them for any other. */
@@ -21,13 +21,13 @@ export interface PlayerSetting {
21
21
  game?: string;
22
22
  /**
23
23
  * What the player should know of it on this computer, as whether pictures can be made here; fix when it says how to have what is missing; the values its
24
- * {names} take, as a maker's own words; and a line after it.
24
+ * {names} take, as a maker's own words; and the lines after it.
25
25
  */
26
26
  note?: {
27
27
  text: string;
28
28
  fix?: true;
29
29
  values?: Record<string, string>;
30
- also?: string;
30
+ also?: string[];
31
31
  };
32
32
  /** A setting of the player's own words, as the author the master writes like, the longest its text may be (D-395); for a list, each item's (D-563). */
33
33
  most?: number;
@@ -66,7 +66,7 @@ export function setupSettingNamed(root, name) {
66
66
  }
67
67
  /** The player's settings as the dashboard shows them (D-341): with what this computer lacks, as pictures without Codex, asked again. */
68
68
  export function shownPlayerSettings(root, context) {
69
- return playerSettings(root, context).map((setting) => (setting.name === "pictures" ? { ...setting, ...picturesReadyNote(context) } : setting));
69
+ return playerSettings(root, context).map((setting) => (setting.name === "pictures" ? { ...setting, ...withOwnPicture(picturesReadyNote(context)) } : setting));
70
70
  }
71
71
  /** The player's settings with their values, then those the game system adds (D-341). */
72
72
  export function playerSettings(root, context) {
@@ -163,8 +163,10 @@ const toolAsked = "The master asks you in the chat which tool to use.";
163
163
  // Where the maker the player chose made no picture, and the chat in use makes them (D-572): it refused one, with its own words, or it cannot.
164
164
  const refusedNote = "{maker} refused the last picture: {why}. {by} makes them instead.";
165
165
  const madeMeanwhile = "{by} makes them meanwhile.";
166
+ // Whoever makes them, the player may give a page a picture of their own (D-572 (3)).
167
+ const ownPicture = "You can also give a page you see a picture of your own: with its picture button, or dropped in the campaign's inbox folder for the master.";
166
168
  /** Every note the pictures' setting may have, which the dashboard writes in its language (D-394). */
167
- export const picturesNotes = [...Object.values(madeBy), madeWithTool, toolAsked, refusedNote, madeMeanwhile, ...[...Object.values(codexSays), ...Object.values(claudeSays)].map(notReadyText)];
169
+ export const picturesNotes = [...Object.values(madeBy), madeWithTool, toolAsked, refusedNote, madeMeanwhile, ownPicture, ...[...Object.values(codexSays), ...Object.values(claudeSays)].map(notReadyText)];
168
170
  /**
169
171
  * Whether this computer makes pictures, and with whose plan, in the player's words (D-308, D-390); why not and how to have them; where the maker the player
170
172
  * chose made none and the chat in use makes them, why (D-572); nothing where no maker is asked.
@@ -181,7 +183,7 @@ function picturesReadyNote(context) {
181
183
  if (instead !== undefined) {
182
184
  return instead.refused === true
183
185
  ? { note: { text: refusedNote, values: { maker: instead.maker, why: instead.why.replace(/\.$/, ""), by: instead.by } } }
184
- : { note: { text: notReadyText(instead), fix: true, values: { by: instead.by }, also: madeMeanwhile } };
186
+ : { note: { text: notReadyText(instead), fix: true, values: { by: instead.by }, also: [madeMeanwhile] } };
185
187
  }
186
188
  if (ready.tool !== undefined) {
187
189
  return { note: { text: madeWithTool, values: { tool: ready.tool } } };
@@ -191,6 +193,10 @@ function picturesReadyNote(context) {
191
193
  }
192
194
  return { note: { text: madeBy[ready.maker === "Claude" || ready.maker === "Antigravity" ? ready.maker : "Codex"] } };
193
195
  }
196
+ /** The pictures' note with the line that the player may give a picture of their own after it. */
197
+ function withOwnPicture(note) {
198
+ return note.note === undefined ? note : { note: { ...note.note, also: [...note.note.also ?? [], ownPicture] } };
199
+ }
194
200
  /** How the player has pictures, or else why there are none. */
195
201
  function notReadyText(said) {
196
202
  return said.fix ?? `${said.why}.`;
@@ -77,7 +77,7 @@ export const playerWords = {
77
77
  about: "how much the master teaches the game, out of the story",
78
78
  values: mentorWays,
79
79
  means: {
80
- off: "only the story; ask in brackets whenever you want",
80
+ off: "only the story; ask in [OOC: …] whenever you want",
81
81
  hints: "a short note before big choices and when a rule slips by",
82
82
  tutorial: "each rule explained the first time, the numbers shown, a short review after fights",
83
83
  },
@@ -1,4 +1,7 @@
1
1
  import { z } from "zod";
2
+ import type { Context } from "../core/context.ts";
3
+ import { type ReadImage } from "../images/index.ts";
4
+ import { type Page, type World } from "../pages/index.ts";
2
5
  interface ImageResult {
3
6
  page: string;
4
7
  /** The picture now in the campaign, from its folder; undefined when the page's own was removed. */
@@ -25,4 +28,6 @@ export declare const image: import("../core/registry.ts").Command<z.ZodObject<{
25
28
  url: z.ZodOptional<z.ZodString>;
26
29
  describe: z.ZodOptional<z.ZodString>;
27
30
  }, z.core.$strip>, ImageResult>;
31
+ /** Writes a picture into the campaign's images folder and links it in the page, logging it; `from` is the file it was read from, if any. */
32
+ export declare function placeImage(root: string, context: Context, world: World, page: Page, picture: ReadImage, from?: string): ImageResult;
28
33
  export {};
@@ -18,6 +18,7 @@ export const image = defineCommand({
18
18
  description: "Give a page its picture: a portrait for a character, an image for a creature, an item or a place, as the dashboard will show it in a round token. "
19
19
  + "It copies the file into the campaign and links it in the page's image field; a page without one shows the picture of the page it derives from, such as a wolf's icon. "
20
20
  + "Use it when the player gives you a picture, or after you made one with your own tools: its file, or url with the https address your tool gives, which the engine downloads. "
21
+ + "The player may drop pictures in the campaign's inbox folder: ask what each is for, give it, then delete it from the inbox. "
21
22
  + "For a place, a quest, a character or a creature of the campaign, describe instead of file has the picture made on this computer, as the campaign's pictures setting allows: "
22
23
  + "for the player character or a companion only when the player asks; for a creature once for each kind, whose copies show it. "
23
24
  + "Example: page Ettore, file C:\\Users\\me\\Pictures\\ettore.png.",
@@ -99,7 +100,7 @@ async function downloadedImage(root, context, world, page, url) {
99
100
  return placeImage(root, context, world, page, imageOfBytes(bytes, "What the address gave"));
100
101
  }
101
102
  /** Writes a picture into the campaign's images folder and links it in the page, logging it; `from` is the file it was read from, if any. */
102
- function placeImage(root, context, world, page, picture, from) {
103
+ export function placeImage(root, context, world, page, picture, from) {
103
104
  if ("problem" in picture) {
104
105
  throw new Error(`${picture.problem} Nothing changed.`);
105
106
  }
@@ -114,6 +115,8 @@ function placeImage(root, context, world, page, picture, from) {
114
115
  appendLogEntry(root, newDatedLogEntry(root, context, "image-set", "public", { page: page.name, image: shownPath(root, target) }));
115
116
  return { page: page.name, image: shownPath(root, target), from: copied ? from : undefined, changed: true };
116
117
  }
118
+ // Where nothing makes the picture, the player may give one of their own (D-572 (3)).
119
+ const playerGives = "ask the player for one of their own, given on the page in their dashboard or dropped in the campaign's inbox folder";
117
120
  // How long a picture's download may take: a few megabytes come in seconds.
118
121
  const longestDownload = 60 * 1000;
119
122
  /** Why a page of the game system takes no picture, and how to give one: to a page of the campaign that derives from it, which a creature's scenes then bring in. */
@@ -154,7 +157,7 @@ function madePicture(root, context, world, page, seen) {
154
157
  }
155
158
  const ready = context.pictures?.ready(true) ?? { ready: false, why: "Nothing on this computer makes pictures" };
156
159
  if (!ready.ready || context.pictures === undefined) {
157
- throw new Error(`${ready.ready ? "Nothing on this computer makes pictures" : ready.why}. If your own tools make pictures, make one and give it with file; else go on without. Nothing changed.`);
160
+ throw new Error(`${ready.ready ? "Nothing on this computer makes pictures" : ready.why}. If your own tools make pictures, make one and give it with file; else ${playerGives}, or go on without. Nothing changed.`);
158
161
  }
159
162
  const unseen = [...readListSetting(root, "lines"), ...readListSetting(root, "veils")];
160
163
  const { name, who } = kind === "place" || kind === "quest" ? { name: page.name } : isPartyMember(page) ? { name: page.name, who: portraitWho(root, context, world, page) } : metWho(root, world, page);
@@ -169,7 +172,7 @@ function madePicture(root, context, world, page, seen) {
169
172
  const making = context.pictures.make(subject).then((made) => {
170
173
  if ("refused" in made) {
171
174
  appendLogEntry(root, newDatedLogEntry(root, context, "image-refused", "hidden", { page: page.name, why: made.refused }));
172
- throw new Error(`No picture of ${page.name}: ${made.refused}. Go on without, or give one with file.`);
175
+ throw new Error(`No picture of ${page.name}: ${made.refused}. Give one with file, or ${playerGives}, or go on without.`);
173
176
  }
174
177
  try {
175
178
  const world = campaignWorld(root, context);