Data files
Every file a mod ships: talk.json, shops.json, letters.json, calendar.json, items.json, the messages file, textures and the script. Each field, limit and error.
A mod names its data files in mod.json: the scripts under scripts,
every other file under content. Each path is inside the
mod, and you choose the file's name. The names below are the usual ones. A JSON file may start with a "$schema" key that names its schema, so an editor checks it as you type. A messages file cannot, because its
keys are its lines.
Index #
| File | mod.json key | What it is for |
|---|---|---|
| shops.json | content.shops | Changes shops, each by its id: "nook", "flower", "redd" and the rest of the shop table. |
| messages file | content.messages | Lines a script or another mod can use, by key. |
| textures folder | content.textures | A folder of replacement textures, named the way Dolphin names a custom texture. |
| main.lua | scripts.main | Lua 5.4 source text, run once when the game starts. |
| items.json | content.items | New furniture, each on a vanilla base piece. |
| mod-items.json (the game's) | none, the game writes it | /save/card_a/mod-items.json. |
| letters.json | content.letters | Letter templates that a mod command (send_letter) mails through the mailbox, named "<mod id>:<letter id>". |
| calendar.json | content.calendar | Calendar days: dated days with safe effects only, and no script. |
| talk.json | content.talk | Villager lines placed in a villager's talk. |
shops.jsonsince 1 #
How the game uses shops.json #
Changes shops, each by its id: "nook", "flower", "redd" and the rest of the shop table. A shop takes one block, or a list of blocks. A block says what changes (goods, open, own_goods, prices, services, name, lines) and, with "when", when. Every field means the same on every shop. The shop table says which fields each shop has; a field a shop does not have is left out and the mod's row says so (rule shop_fields). While a block applies its goods join the shop's own, in at most half the spots of their kind (rounded up), or with "own_goods": false they are the whole stock. When several blocks apply at once their goods are sold together, and for a single value the last of them counts. The game itself, not the page or the mod list, refuses goods with no shelf model, money, turnips, tickets, grab bags, fossils and reserve ids, and raises a price below the item's buy-back to the buy-back. items.json lists what may be stocked. A good may be an item of the same mod, by its full id, at Nook's and the flower shop. Without a price a good takes the shop's own price. Shops are off in The City. When two switched-on mods change the same shop, the one later in the load order has that shop whole and the other's change to it is not used (rule load_order_last_wins). The earlier mod's row says so.
shops.json fields #
| Field | Value | Meaning |
|---|---|---|
shops required | object | The shops this file changes, by id. Each takes one block or a list of blocks. |
shops.nook optional | a block or list, 1 to 8 entries | Nook's store: open, own_goods, goods, price_percent, buy_back_percent, at most 16 goods in a block. |
shops.flower optional | a block or list, 1 to 8 entries | The flower shop: open, own_goods, goods, price_percent, name, lines, at most 6 goods in a block. Line slots: greeting, stock. |
shops.redd optional | a block or list, 1 to 8 entries | Crazy Redd: own_goods, goods, price_percent, at most 6 goods in a block. |
shops.saharah optional | a block or list, 1 to 8 entries | Saharah: own_goods, goods, price_percent, at most 6 goods in a block. |
shops.fireworks optional | a block or list, 1 to 8 entries | The fireworks stall: own_goods, goods, price_percent, at most 6 goods in a block. |
shops.able optional | a block or list, 1 to 8 entries | Able Sisters: services. Services: design. |
shops.barber optional | a block or list, 1 to 8 entries | The barber shop: open, services. Services: haircut. |
shops.dream optional | a block or list, 1 to 8 entries | The Dream Suite: services. Services: dream. |
shops.katrina optional | a block or list, 1 to 8 entries | Katrina: services. Services: fortune. |
block.when optional | a when | When the block or the good applies: while every key here holds. Leave it out for always. |
block.open optional | boolean | true: the shop is open while the block applies, also when its own hours have it shut. false: it is shut while the block applies. Leave it out for the shop's own hours. |
block.own_goods optional | boolean | false: while the block applies the shop sells only the goods of the blocks that apply, and every spot of a kind they do not list is bare. true (the default): the goods join the shop's own, in at most half the spots of their kind, rounded up. |
block.goods optional | list, 1 to 16 entries | The goods. Each stands in a spot of its own kind. The shop table gives each shop's most goods in a block. |
block.goods[].item required | string, matching ^0x[0-9a-fA-F]{4}$ or matching ^([a-z0-9][a-z0-9-]{0,31}\.[a-z0-9][a-z0-9-]{0,47}):([a-z0-9][a-z0-9-]{0,31})$ | The item id as a string, "0x" and 4 hex digits, or the full id of an item in this mod's items file (author.mod:thing), at Nook's and the flower shop. Each item is listed at most once in a block. Two mod items may not share a base. |
block.goods[].price optional | integer, 1 to 99999 | The price in Bells. Leave it out for the shop's own price. |
block.goods[].when optional | a when | When the block or the good applies: while every key here holds. Leave it out for always. |
block.price_percent optional | integer, 1 to 1000 | While the block applies the shop asks this percent of its own price for every good with no price of its own. 100 is the game's price. Never below the buy-back. |
block.buy_back_percent optional | integer, 1 to 1000 | While the block applies the shop pays this percent of what it would pay for what the player sells, never more than it asks for the item. Not turnips. |
block.services optional | object | A service's price in Bells, by the service's name in the shop table (a haircut, a design, a dream, a fortune). |
block.services.<key> optional | integer, 1 to 99999 | The service's price in Bells, 1 to 99999. |
block.name optional | string, 1 to 40 characters, matching ^[^\n]*$ | The shop's name where the game shows it: the flower shop's door sign while the shop is shut. One line. |
block.lines optional | object | What the keeper says, by slot (the shop table lists each shop's). A slot is one line, or a list of 1 to 8 the keeper picks from each time. |
block.lines.<key> optional | string, 1 to 160 characters or list, 1 to 8 entries | One line, or a list of 1 to 8 lines the keeper picks from. |
when.hours optional | object | HH:MM to HH:MM. From and to must differ. |
when.hours.from required | string, matching ^([01][0-9]|2[0-3]):[0-5][0-9]$ | From this time, on a 24-hour clock. |
when.hours.to required | string, matching ^([01][0-9]|2[0-3]):[0-5][0-9]$ | Up to this time, on a 24-hour clock. It may be past midnight. |
when.time optional | one of "morning", "day", "evening", "night" | The game's four times of day: morning 5 to 12, day 12 to 17, evening 17 to midnight, night midnight to 5. |
when.season optional | one of "spring", "summer", "fall", "winter" | Spring is March to May, summer June to August, fall September to November, winter December to February. |
when.weather optional | one of "clear", "rain", "snow" | Cherry blossom and falling leaves count as clear. |
when.weekday optional | list, 1 to 7 entries | Only on these days of the week. |
when.weekday[] required | one of "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" | A day of the week, monday to sunday, in lowercase. |
when.month optional | list, 1 to 12 entries | Only in these months, 1 (January) to 12. |
when.month[] required | integer, 1 to 12 | A month, 1 (January) to 12. |
when.setting optional | string, matching ^[a-z][a-z0-9_]{0,31}$ | The name of one of this mod's settings of type bool with scope world. Holds while it is on. |
shops.json: the shop table #
Every shop takes the same block under its id, and each field means the same on every shop. A field a shop does not have is left out, and the mod's row in the Mods tab says so (rule shop_fields).
| Shop id | when | open | own_goods | goods | price_percent | buy_back_percent | services | name | lines | Goods in a block | Services | Line slots |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
"nook", Nook's store | yes | yes | yes | yes | yes | yes | no | no | no | 1 to 16 | none | none |
"flower", the flower shop | yes | yes | yes | yes | yes | no | no | yes | yes | 1 to 6 | none | greeting, stock |
"redd", Crazy Redd's tent | yes | no | yes | yes | yes | no | no | no | no | 1 to 6 | none | none |
"saharah", Saharah | yes | no | yes | yes | yes | no | no | no | no | 1 to 6 | none | none |
"fireworks", the fireworks stall | yes | no | yes | yes | yes | no | no | no | no | 1 to 6 | none | none |
"able", Able Sisters | yes | no | no | no | no | no | yes | no | no | none | design | none |
"barber", the barber shop | yes | yes | no | no | no | no | yes | no | no | none | haircut | none |
"dream", the Dream Suite | yes | no | no | no | no | no | yes | no | no | none | dream | none |
"katrina", Katrina's tent | yes | no | no | no | no | no | yes | no | no | none | fortune | none |
shops.json limits #
shops.blocks, 8 blocks: The most blocks in the list one shop takes in shops.json.shops.stock, 6 goods: The most goods in one block for the flower shop: one per bench spot.nook.stock, 16 goods: The most goods in one block for Nook's store.visitors.stock, 6 goods: The most goods in one block for a visiting seller (Crazy Redd, Saharah, the fireworks stall).shops.lines, 8 lines: The most lines in one slot of a block's "lines". The keeper says one of them each time.shops.name_chars, 40 characters: The longest shop name (the flower shop's door sign), in Unicode code points.shops.line_chars, 160 characters: The longest shop line (a slot of "lines"), in Unicode code points.shops.line_newlines, 3 newlines: The most line breaks in one shop line.shops.price_max, 99,999 Bells: The highest price a mod shop may ask. The game raises a price below its own buy-back to the buy-back. The buy-back is what Nook pays for the item.shops.percent_max, 1,000 percent: The highest price_percent or buy_back_percent.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
shops.json example #
{
"shops": {
"flower": {
"when": {
"hours": {
"from": "15:00",
"to": "01:00"
}
},
"open": true,
"own_goods": false,
"name": "Tea Stall",
"lines": {
"greeting": "Welcome to the tea stall!"
},
"goods": [
{
"item": "0x2800",
"price": 400
}
]
}
}
}Errors shops.json can raise #
shops-file: shops.json needs a "shops" object of shop idsshop-id: There is no shop with that idshop-blocks: A shop takes one block or 1 to 8shop-not-object: A block is not an objectshop-block-empty: A block changes nothingshop-name: Shop "name" must be 1 to 40 characters on one lineshop-hours-same: Hours that start and end at the same timeshop-hours: "hours" are not "HH:MM"shop-when: A "when" is not rightshop-when-setting: "when.setting" names no bool world settingshop-flag: "open" or "own_goods" is not true or falseshop-percent: A percent is not 1 to 1000shop-service: A service the shop does not have, or a bad priceshop-line-slot: A line slot the shop does not haveshop-text: A shop line is too longshop-field-ignored: A field this shop does not haveshop-replaced: Another mod has this shopshop-stock: "goods" must list 1 to the goods the shop takesshop-item-no-model: A good the game has no model forshop-item-twice: An item is stocked twiceshop-item-refused: An item that cannot be soldshop-item: A stock "item" is not "0x" and 4 hex digitsshop-price: A price is not 1 to 99999 Bellsshop-price-floor: A price the game raises
Each one, with the message you see and the fix, is in the errors list under shops.json. Any JSON file can also meet the ones under JSON files.
Guide to shops.json #
messages filesince 1 #
How the game uses messages file #
Lines a script or another mod can use, by key. A script reads its own with message("key") and another mod's with message("author.mod:key"). This file cannot carry a $schema key, because every key is a line. Point your editor at messages.schema.json in its settings instead.
messages file fields #
| Field | Value | Meaning |
|---|---|---|
<key> optional | string, at least 1 character; the key matching ^[a-z0-9_.-]{1,48}$ | 1 to 400 UTF-8 bytes. Lines wrap by width, not by a count of characters. A row holds 180 pixels of the game's font, which is about 24 letters. Narrow letters like i and l take less room, and wide ones like W and m take more. A page holds 4 rows. |
messages file limits #
messages.lines, 256 lines: The most lines in one mod's messages file.messages.key_bytes, 48 bytes: The longest line key.messages.text_bytes, 400 bytes: The longest line, in UTF-8 bytes. Lines wrap by width, not by a count of characters. A row holds 180 pixels of the game's font, which is about 24 letters. Narrow letters like i and l take less room, and wide ones like W and m take more. A page holds 4 rows.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
messages file example #
{
"gossip1": "Did you hear? The museum got a new fossil!"
}Errors messages file can raise #
messages-not-object: A messages file is not key to textmessages-too-many: More than 256 linesmessages-key: A line id is not 1 to 48 of a-z 0-9 _ . -messages-text: A line is empty or over 400 bytesmessages-out-of-memory: Out of memory reading lines
Each one, with the message you see and the fix, is in the errors list under Messages files. Any JSON file can also meet the ones under JSON files.
Guide to messages file #
textures foldersince 1 #
How the game uses textures folder #
A folder of replacement textures, named the way Dolphin names a custom texture. A mod's texture beats the HD pack. Among mods, the one lower in the list wins. The exception is that a file for one exact palette beats any mod's "$" (every palette) file for the same texture (rule load_order_last_wins). All mods' DDS textures together may take 96 MB on the graphics card, or 24 MB on a phone. Their PNGs may take 96 MB of pixels, or 24 MB on a phone. A texture past its limit is left out and named on its mod's row. A mod's texture is read a little each frame after it is first drawn, so the game's own texture shows for a moment before it. Find a texture's name in the model viewer (/viewer/).
textures folder: file names #
tex1_<w>x<h>_<data>_<fmt>.dds: A texture without a palette.tex1_<w>x<h>_<data>_<tlut>_<fmt>.dds: A palette (C4, C8) texture. <tlut> is the palette's hash.tex1_<w>x<h>_<data>_$_<fmt>.dds: A palette texture under any palette.tex1_<w>x<h>_<data>[_<tlut>|_$]_<fmt>.png: The same names as a PNG, with any case of .png. A PNG is decoded once at load and is at most 2048 a side. A DDS of the same name in the same mod is the same texture, and the first one scanned wins.<label>_tex1_<w>x<h>_<data>[_<tlut>|_$]_<fmt>.dds: Any of these names with a label in front, so you can tell your files apart, as in bookshelf-top_tex1_32x32_626709d910129694_$_8.png. The label is 1 to 40 lowercase letters, digits and dashes, then one underscore. The game matches on the tex1_ part only. A file whose label breaks that rule is refused. Two files in one folder that are the same texture once the labels are taken off are refused when either one has a label. An item's own textures folder reads labels the same way.
Image formats. DDS: BC7, BC1/DXT1, BC3/DXT5 (legacy FourCC or DX10), DX10 R8G8B8A8 or B8G8R8A8, or legacy uncompressed 32 bits a pixel. 1 to 16384 a side. Level 0 only, no stored mipmaps. PNG: grey, RGB, palette, grey with alpha or RGBA, 1 to 16 bits, interlaced or not, tRNS. At most 2048 a side.
textures folder limits #
textures.label_chars, 40 characters: The longest label before a texture name in a mod, as in bookshelf-top_tex1_32x32_626709d910129694_$_8.png. A label is lowercase letters, digits and dashes, then one underscore.textures.png_side, 2,048 pixels: The longest side of a PNG texture.textures.png_decoded_bytes, 96 MB: Decoded pixels of every mod's PNG textures together, on a computer. A PNG past it is left out and named on its mod's row.textures.png_decoded_bytes_phone, 24 MB: The same on a phone or low-memory device.textures.dds_bytes, 96 MB: Image bytes of every mod's DDS textures together on a computer, as the graphics card holds them. Only the first mip level counts: 1 byte a pixel for BC7 and DXT5, half a byte for DXT1 and 4 bytes uncompressed. A DDS past the limit is left out and named on its mod's row. The HD pack does not count.textures.dds_bytes_phone, 24 MB: The same on a phone or low-memory device.
textures folder example #
textures/tex1_32x32_8b5a1b4a83d4d7c7_14.ddsErrors textures folder can raise #
texture-copied: An unchanged copy of a game texturetexture-mipmaps: A DDS with mipmaps or extra bytestexture-size: A texture is too bigtexture-small: A picture smaller than, or not the shape of, the texture it replacestexture-png-unreadable: The game could not read a PNG texturetexture-png-budget: Too many PNG pixels across your modstexture-dds-budget: Too many DDS texture bytes across your modstexture-twice: The same texture as a PNG and a DDStexture-label: A label before a texture name breaks the label ruletexture-label-twice: Two files are one texture once their labels are taken offpicture-misnamed: A picture in the wrong kind of filepng-extra-data: A PNG with animation or app datatexture-format: A texture format the game cannot loadlog-texture-not-read: A texture file was left out
Each one, with the message you see and the fix, is in the errors list under Textures and images.
Guide to textures folder #
main.luasince 1 #
How the game uses main.lua #
Lua 5.4 source text, run once when the game starts. Bytecode is refused. The script registers handlers with on() and returns nothing. Each mod has its own Lua state, and mods cannot see each other's globals.
main.lua limits #
file.lua_bytes, 512 KB: The largest .lua file.lua.memory_bytes, 4 MB: Memory one mod's script may use. Over it, the script stops for the session.lua.budget, 200,000 instructions: Instructions one mod may run per event, counting all its handlers for that event together. The main chunk gets its own count. Library work is charged too: every 64 bytes allocated, every 4 pattern-matching steps and every element a table function touches. An allocation the memory limit refuses is charged too: one instruction for every 64 bytes the script holds. Over the limit, the script stops for the session.lua.deadline_ms, 250 milliseconds: Wall-clock backstop on a script's main chunk, for time the instruction count cannot see: one long call into C, or a garbage collection. The instruction budget is what stops a main chunk that does too much. On a slow device it is stretched by the device's pace (lua.pace_frame_ms).lua.event_deadline_ms, 125 milliseconds: Wall-clock backstop on one event run, for time the instruction count cannot see: one long call into C, or a garbage collection. The instruction budget is what stops an event run that does too much, and it counts the same on every device. On a slow device it is stretched by the device's pace (lua.pace_frame_ms). A busy device does not stop a mod that stays inside its budget.lua.handlers_per_event, 16 handlers: The most handlers one mod may register for one event.
main.lua example #
on("villager_talked", function(e) return { place = "before", line = "Hi " .. e.villager.name .. "!" } end)Errors main.lua can raise #
scripts-not-object: "scripts" must be an objectscripts-unknown-key: An unknown key in "scripts"scripts-main-missing: The script file is not in the modscripts-main: "scripts.main" must be a .lua filescripts-events: "scripts.events" is not a list of eventsscripts-permissions: "permissions" is not a list of commandsscripts-permissions-no-scripts: "permissions" without "scripts"manifest-exports: "exports" is not rightmanifest-exports-no-scripts: "exports" without "scripts"script-budget: Script took too longscript-slow: Script kept the game waitingscript-memory: Script ran out of memoryscript-on-event: on() with an event not in "scripts.events"script-on-late: on() called from inside a handlerscript-on-too-many: More than 16 handlers for one eventscript-store-no-town: store.set before a town is loadedscript-store-no-player: store.player.set with no player in the gameremote-not-exported: remote.add of a name "exports" does not listscript-remote: remote.add or remote.call refusedscript-store: store.set refused a valuescript-sandbox: Something scripts may not doscript-state-failed: The script could not keep runningscript-syntax: A Lua syntax errorscript-error: The script raised an errordependency-absent: A mod this one can use is not theredependency-version: A mod this one can use is another versiondependency-undeclared: remote.version asked about a mod mod.json does not name
Each one, with the message you see and the fix, is in the errors list under scripts in mod.json and Script stopped.
Guide to main.lua #
items.jsonsince 1 #
How the game uses items.json #
New furniture, each on a vanilla base piece. The game also refuses a base with no model, fossils, gyroids, clothing, design pieces and pieces a player carries as an item: umbrellas, fish, bugs, tools, balloons, fans, pinwheels and diaries. In the save, a mod item is its base piece. A file beside the save (mod-items.json) maps it back. Removing the mod therefore leaves the base piece behind, and reinstalling restores the mod item. That file belongs to the save it was written beside. Next to another save of the same town, such as a backup put back or an older town file imported, it is not used. Those pieces are then plain base pieces again. An item may carry its own pictures ("textures"). They replace the base piece's textures on that item alone, in a house and on Nook's floor. On the flower shop's bench a furniture good is a leaf. Every other copy of the base keeps its look.
items.json fields #
| Field | Value | Meaning |
|---|---|---|
items required | list, 1 to 64 entries | The new items. Each one stands on a base piece of the game's own furniture. |
items[].id required | string, matching ^[a-z0-9][a-z0-9-]{0,31}$ | The item's own id. Its full id is <mod id>:<id>. |
items[].name required | string, matching ^[A-Za-z0-9](?:[A-Za-z0-9 '.,!&-]{0,14}[A-Za-z0-9'.,!&-])?$ | 1 to 16 characters: letters, digits, space and ' . , ! & -. It starts with a letter or digit and does not end with a space. |
items[].base required | string, matching ^0x[0-9a-fA-F]{4}$ | A south-facing furniture id: 0x1000 to 0x1FFC or 0x3000 to 0x33C4, a multiple of 4. |
items[].price optional | integer, 1 to 99999 | The price in Bells. Leave it out for the base piece's price. |
items[].textures optional | string, at least 1 character | A folder inside the mod with this item's own pictures: 1 to 16 .png or .dds files named like a texture mod's files, with the base piece's texture names. Only this item draws them. The folder may not be inside content.textures or hold it. |
items.json limits #
items.per_mod, 64 items: Items in one mod's items file.items.total, 512 items: Mod items across every switched-on mod.items.price_max, 99,999 Bells: The highest price an item in a mod's items file may have.items.renames, 64 renames: Entries in one mod.json "renames".items.texture_files, 16 files: Pictures in one mod item's own textures folder (its "textures" setting), counting the files in its subfolders.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
items.json example #
{
"items": [
{
"id": "cup",
"name": "Tea cup",
"base": "0x1000",
"price": 800,
"textures": "items/cup/"
}
]
}Errors items.json can raise #
items-list: items.json needs an "items" listitem-not-object: An item is not an objectitem-setting: An unknown item settingitem-id: An item id is not alloweditem-id-twice: Two items share an iditem-name: An item name the game cannot showitem-base: An item "base" is not south-facing furnitureitem-price: An item price is out of rangeitem-textures: An item "textures" is not a folder in the moditem-textures-count: An item has more than 16 picturesitem-textures-name: A file in an item's textures folder is not a textureitem-textures-overlap: An item's textures folder is part of content.texturesitem-malformed: The game left out a malformed itemitem-base-refused: The game cannot use this base for a mod itemitems-too-many-total: More than 512 mod items across all modsshop-mod-item-unknown: A shop stocks an item this mod does not haveshop-furniture-shared: Two goods share one furnitureitem-renames: "renames" is not right
Each one, with the message you see and the fix, is in the errors list under New items. Any JSON file can also meet the ones under JSON files.
Guide to items.json #
mod-items.json (the game's)since 1 #
How the game uses mod-items.json (the game's) #
/save/card_a/mod-items.json. The game writes it beside the home save, and a mod never reads or writes it. It records which placed or carried base pieces are which mod item, and which renames have run. It rides in the cloud save and in a friend visit's town copy.
Guide to mod-items.json (the game's) #
letters.jsonsince 1 #
How the game uses letters.json #
Letter templates that a mod command (send_letter) mails through the mailbox, named "<mod id>:<letter id>". The game wraps the body at the paper's width in its own font and refuses one that needs more than 6 lines. It also refuses a present that is money, turnips, a ticket, a grab bag, a fossil or not an item. Either scope.
letters.json fields #
| Field | Value | Meaning |
|---|---|---|
letters required | list, 1 to 32 entries | The letter templates. A script mails one with cmd.send_letter, and a calendar day can name one. |
letters[].id required | string, matching ^[a-z0-9_.-]{1,48}$ | Unique in the file. |
letters[].header required | string, 1 to 32 characters | 1 to 24 characters besides at most one {player}, where the name goes. No line break. Plain text: printable ASCII, no { or }. |
letters[].body required | string, 1 to 192 characters | 1 to 192 characters on at most 6 lines. Plain text: printable ASCII, no { or }. |
letters[].footer required | string, 1 to 32 characters | The sign-off at the foot of the letter, 1 to 32 characters. Plain text: printable ASCII, no { or }. The mailbox list shows only its first 8 characters unless the letter has a sender. |
letters[].sender optional | string, 1 to 8 characters | Optional. The name in the mailbox list, 1 to 8 characters, which is all the list has room for. Without it the list shows the footer's first 8 characters, so "The Lantern Keepers" reads "The Lant". The letter itself always signs with the whole footer. Plain text: printable ASCII, no { or }. |
letters[].item optional | string, matching ^0x[0-9a-fA-F]{4}$ | A present, optional. |
letters[].paper optional | integer, 0 to 63 | The stationery, default 0. |
letters.json limits #
letters.per_file, 32 letters: Letters in one letters file.letters.header_chars, 24 characters: A letter header, not counting {player}.letters.body_chars, 192 characters: A letter body or a board notice.letters.body_lines, 6 lines: Lines on the letter paper or a board page.letters.footer_chars, 32 characters: A letter footer.letters.sender_chars, 8 characters: A letter's name in the mailbox list. It is the letter's optional sender. Without a sender, it is the footer's first 8 characters.commands.papers, 64 papers: Letter papers, numbered 0 to 63.commands.letters_per_day, 3 commands: send_letter per mod per game day in each town. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule. A command counts when the game applies it, and the count is kept across a reload. A command lost with a closed tab before then never counts. The limit check adds the commands still waiting. A command refused for where the player is (The City, a visit) does not count.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
letters.json example #
{
"letters": [
{
"id": "thanks",
"header": "Dear {player},",
"body": "Thank you for the help.\nHere is a little something.",
"footer": "The Fair Committee",
"sender": "The Fair",
"item": "0x2800",
"paper": 12
}
]
}Errors letters.json can raise #
target-not-object: A letter, calendar day or pool is not an objecttarget-id: A letter or calendar day "id" is not rightletters-file: letters.json needs a "letters" listletter-header: A letter "header" is not rightletter-body: A letter "body" is not rightpaper-fit: Text does not fit the letter paper or a board pageletter-footer: A letter "footer" is not 1 to 32 plain charactersletter-sender: A letter "sender" is not 1 to 8 plain charactersletter-item: A letter "item" is not rightletter-paper: A letter "paper" is not 0 to 63targets-out-of-memory: The game ran out of memory reading a file
Each one, with the message you see and the fix, is in the errors list under letters.json. Any JSON file can also meet the ones under JSON files.
Guide to letters.json #
calendar.jsonsince 1 #
How the game uses calendar.json #
Calendar days: dated days with safe effects only, and no script. A day can have a notice on the town bulletin board. The notice is posted once on the day in the player's own town, never on a visit or in The City, and needs scope world. A day can have villager lines: talk.json pools that name the day's id as their "day", in any place of the talk. A day with no notice and no letter is a date for those pools. A day can have a letter from the same mod's letters file. The letter is mailed once on the day to the player's mailbox in their own town, never on a visit or in The City, and counts against the mod's daily letter limit. A day cannot add decorations, because the game has no data format for them.
calendar.json fields #
| Field | Value | Meaning |
|---|---|---|
days required | list, 1 to 16 entries | The dated days. |
days[].id required | string, matching ^[a-z0-9_.-]{1,48}$ | Unique in the file. |
days[].date required | object | {month, day} (February 29 works) or {month, week 1 to 4 or "last", weekday 0 Sunday to 6}. |
days[].date.month required | integer, 1 to 12 | 1 for January to 12 for December. |
days[].date.day optional | integer, 1 to 31 | The day of the month. Not with week or weekday. |
days[].date.week optional | integer, 1 to 4 or one of "last" | The week of the month: 1 to 4, or "last". Needs weekday. |
days[].date.weekday optional | integer, 0 to 6 | 0 for Sunday to 6 for Saturday. Needs week. |
days[].board optional | string, 1 to 192 characters | A bulletin board notice: 1 to 192 characters on at most 6 lines. Plain text: printable ASCII, no { or }. Needs scope world. |
days[].letter optional | string, matching ^[a-z0-9_.-]{1,48}$ | The id of a letter in this mod's letters file, mailed on the day. It is mailed once per town per day, the first time the player is free in their own town. It follows the same rules as cmd.send_letter: it goes to the mailbox or else the post office, and counts against the daily letter limit. No permission or script is needed. |
calendar.json limits #
calendar.per_file, 16 days: Days in one calendar file.calendar.board_per_day, 3 notices: Board notices that go up on one day across every mod. The first ones in load order go up. On a full board, a mod notice first takes the place of an earlier day's mod notice. It never pushes off a page dated today.letters.body_chars, 192 characters: A letter body or a board notice.letters.body_lines, 6 lines: Lines on the letter paper or a board page.commands.letters_per_day, 3 commands: send_letter per mod per game day in each town. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule. A command counts when the game applies it, and the count is kept across a reload. A command lost with a closed tab before then never counts. The limit check adds the commands still waiting. A command refused for where the player is (The City, a visit) does not count.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
calendar.json example #
{
"days": [
{
"id": "harvest-fair",
"date": {
"month": 9,
"week": 3,
"weekday": 3
},
"board": "HARVEST FAIR TODAY!\nBring your best fruit."
},
{
"id": "lantern-night",
"date": {
"month": 11,
"week": 2,
"weekday": 5
},
"letter": "lanterns"
}
]
}Errors calendar.json can raise #
calendar-file: calendar.json needs a "days" listcalendar-date: A calendar day's "date" is not rightcalendar-letter: A calendar day's "letter" is not one of the mod's letterscalendar-board-world: A board notice needs "scope": "world"calendar-board: A calendar day's "board" notice is not right
Each one, with the message you see and the fix, is in the errors list under calendar.json. Any JSON file can also meet the ones under JSON files.
Guide to calendar.json #
talk.jsonsince 1 #
How the game uses talk.json #
Villager lines placed in a villager's talk. A talk is the hello, which ends in a menu (an errand, a chat, never mind); when the player chats, the game picks a topic, fresh every time: small talk (plain chat, the time of day, the weather, the month), a trade, a letter they got, a memory, a hint, or news of an event. Every pool's "place" says where its line goes; there is no default: "before" the hello (the hello and everything after it still play), as the "hello" (the menu and the topic still play; only an everyday greeting is replaced, never a hello with news such as a bee sting or a collection finished), as the "topic" (instead of the topic the game picked when it is one of the pool's "topics", small talk when it names none; the talk ends after it, as small talk does), "after" the topic (one more message before a chat ends), or the whole "conversation" (no hello, no menu, no topic: the pool's pages, then the talk ends). A line is one page or a list of pages. A special talk (a first meeting, an errand, a villager moving out, the first-job errands) never uses a pool, nor do a new player's first ten chats, whose topics are tips. For each place, the most specific pools that fit are used: this villager, else this personality, else everyone. A pool fits when its season, time, weather and calendar day, if it names them, are the ones now. Each pool that fits rolls its chance; the lines of the pools that pass are put together, from every mod, and one is picked, never the one this villager said last when there is another. When the most specific pools all roll no, that place stays the game's. A script's villager_talked line takes its place first. A pool kept to a calendar "day" speaks only on that day, in its place, like any other pool. A conversation pool is used only when no script took any place. Nothing is saved. Either scope. Pools run in The City too.
talk.json fields #
| Field | Value | Meaning |
|---|---|---|
pools required | list, 1 to 32 entries | The pools. A pool has a place in the talk, speaks for everyone, for one personality or for one villager, and can be kept to a season, a time of day, the weather or a calendar day. |
pools[].place required | one of "before", "hello", "topic", "after", "conversation" | Required: where the line goes in the talk. before: ahead of the hello. hello: instead of an everyday hello. topic: instead of the topic the game picked after a chat answer. after: after the topic, before a chat ends. conversation: the whole talk. |
pools[].topics optional | always "any" or list, 1 to 6 entries | Only with "place": "topic": the topics the line may stand in for. Default small_talk. "any" is all six. A first-job tip, the birthday question and "should I move?" are never replaced. |
pools[].personality optional | one of "normal", "peppy", "lazy", "jock", "cranky", "snooty" | Not with villager. |
pools[].villager optional | string, 1 to 8 characters | A villager's name, any case. Not with personality. |
pools[].season optional | one of "spring", "summer", "fall", "winter" | Only in this season: spring is March to May, summer June to August, fall September to November, winter December to February. |
pools[].time optional | one of "morning", "day", "evening", "night" | Only at this time of day, the game's own four: morning 5 to 12, day 12 to 17, evening 17 to midnight, night midnight to 5. |
pools[].weather optional | one of "clear", "rain", "snow" | Only in this weather. Cherry blossom and falling leaves count as clear. |
pools[].day optional | string, matching ^[a-z0-9_.-]{1,48}$ | Only on this day: the id of a day in the same mod's calendar file. This is how a calendar day gets villager lines, in any place. |
pools[].chance optional | integer, 1 to 100 | Talks in 100 where this pool's line is said, when the pool fits. Default 100: every talk it fits. |
pools[].lines required | list, 1 to 32 entries | The pool's lines. The game picks one each time. |
pools[].lines[] required | string, 1 to 160 characters or list, 1 to 8 entries | A villager line: one page, or a list of 1 to 8 pages. |
talk.json limits #
talk.pools, 32 pools: Pools in one talk file.talk.lines_per_pool, 32 lines: Lines in one pool.talk.line_chars, 160 characters: A page of a villager line (a pool's or a script's), in Unicode code points. It may have at most 3 line breaks. A line that is one string is one page, wrapped to as many windows as it needs.talk.line_newlines, 3 newlines: The most line breaks in a page of a villager line (a pool's or a script's).talk.pages, 8 pages: Pages in one villager line, when the line is a list of pages (a pool line, or a line a script returns). Each page starts on a clean window.talk.villager_chars, 8 characters: A pool's "villager" name, as the game spells it.file.json_bytes, 256 KB: The largest .json file other than mod.json.json.depth, 32 levels: How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32.
talk.json example #
{
"pools": [
{
"place": "topic",
"personality": "cranky",
"lines": [
"Hmph. Another day of\nyou walking around.",
"What now? I was just\ngetting comfortable."
]
},
{
"place": "hello",
"weather": "rain",
"lines": [
"Rain again! The flowers\nare loving it, at least."
]
},
{
"place": "topic",
"topics": [
"trade",
"news"
],
"chance": 30,
"lines": [
"No deals today. I just\nwant to chat."
]
},
{
"place": "after",
"season": "fall",
"time": "evening",
"lines": [
[
"The evenings come so\nearly now.",
"I like it, though."
]
]
}
]
}Errors talk.json can raise #
talk-file: talk.json needs a "pools" listtalk-no-place: A pool does not say its "place"talk-place: A pool's "place" is not a place in a talktalk-topics: A pool's "topics" are not topics the game pickstalk-day: A pool's "day" is not one of the mod's calendar daystalk-who: A pool names a personality and a villagertalk-personality: A pool's "personality" is not one the game hastalk-villager: A pool's "villager" is not a nametalk-when: A pool's "season", "time" or "weather" is not one the game hastalk-chance: A pool's "chance" is not 1 to 100talk-lines: A pool's "lines" are not right
Each one, with the message you see and the fix, is in the errors list under talk.json. Any JSON file can also meet the ones under JSON files.