Letters, calendar days and villager lines
A mod changes each of these three parts of the game through a file of its own. The file is checked when the mod is installed and again when the game starts.
What a mod can change #
A mod cannot patch any table in the game. It changes a fixed set of parts, each through its own file with its own rules. The rules keep saves and visits safe.
| Part | File | Scope |
|---|---|---|
| Letters | content.letters | either |
| Calendar days | content.calendar | world for a board notice, else either |
| Villager lines | content.talk | either |
Nook's store: see the Shops guide.
Letters #
A letters file holds letter templates. A script mails one with the send_letter command, as in cmd.send_letter{ template = "fair-thanks" }. Name the template by its id or by its full
name, "your.mod:fair-thanks". A mod can send only its own letters. A calendar day can mail one with no
script, see a day's letter.
{
"letters": [
{
"id": "fair-thanks",
"header": "Dear {player},",
"body": "Thank you for coming to the\nHarvest Fair! Here is an apple\nfrom the prize table. Plant it\nand see what grows.",
"footer": "The Fair Committee",
"sender": "The Fair",
"item": "0x2800",
"paper": 12
},
{
"id": "apple-day",
"header": "Dear {player},",
"body": "Happy Apple Day! Here is an\napple to share with a friend.\nOr plant it, and share the\ntree for years to come.",
"footer": "The Harvest Post",
"sender": "Harvest",
"item": "0x2800",
"paper": 12
}
]
}
- A file holds 1 to 32 letters. Each has its own
idof 1 to 48 characters from a-z, 0-9 and_ . -. - Letters are plain text. Use the letters, digits and signs on a US keyboard.
$ * ^ | \show as?. headeris up to 24 characters, plus{player}once where the name goes.bodyis up to 192 characters on at most 6 lines. The game wraps it at the paper's width in its own font. It refuses a body that then needs more than 6 lines.- The paper is 192 pixels wide and the font's letters are 4 to 10 pixels. Ordinary English fits about 30 characters a line. Narrow letters such as i, l and t fit more. Capitals, m and w fit fewer, and 19 W's fill a line. A word never splits, so a long word takes the next line whole.
- A script may build the text from a name or a number. Keep such text under about 150 characters with no more than 5 line breaks, and try the longest case once. A body that does not fit is refused when it is sent. The Mod log gives the reason.
footeris the sign-off at the foot of the letter, up to 32 characters.itemis a present. Money, turnips, tickets and fossils are refused.paperis the stationery, 0 to 63.senderis optional, up to 8 characters. It is the name the mailbox list shows. The list has room for 8 characters only. Without asenderit shows the footer's first 8, so a footer of "The Lantern Keepers" reads "The Lant" in the list. The letter itself always signs with the whole footer.playac-mod checkwarns about a footer the list would cut.
Reference: letters.json, with every field, limit and error code.
Calendar days #
A calendar day is a date of your own. It can put a notice on the bulletin board and mail a letter, and talk pools
can name it for villager lines on that day. The file's top-level key is "days":
{
"days": [
{
"id": "harvest-fair",
"date": { "month": 9, "week": 3, "weekday": 3 },
"board": "HARVEST FAIR TODAY!\nBring your best fruit and\nshow it to your neighbours.\nThe biggest apple wins\nbragging rights for a year."
},
{
"id": "apple-day",
"date": { "month": 10, "day": 21 },
"board": "APPLE DAY\nShare an apple with a friend\ntoday. Any apple will do,\nbut a red one says it best.",
"letter": "apple-day"
}
]
}
dateismonthandday. February 29 works.datecan also bemonth,weekandweekday, for the nth such weekday of the month. Weekday 0 is Sunday and 6 is Saturday."week": 2, "weekday": 5is the second Friday, the one between the 8th and the 14th."last"is the last one of the month.- The date is read from the town's clock, which is the device's clock.
boardis a notice in plain text, like a letter body. It goes up once on the day, in the player's own town only. It never goes up on a visit or in The City. It changes the town, so the mod must be a World mod.- At most 3 notices go up on one day across every mod the player has. The first ones in load order go up.
- On a full board, a notice first takes the place of a mod notice from an earlier day. It never pushes off a page dated today, so what the player wrote that day stays up.
- Villager lines for the day are talk pools that name the day's
idas theirday, in any place of the talk. On the day, a day's pools come ahead of every pool kept to no day. A day with no notice and no letter is fine: it is a date for those pools. letteris theidof one of your letters, as in"letter": "fair-thanks". The game mails it on the day with no script. It goes once per town that day, the first time the player is free in their own town. It never goes on a visit or in The City. It lands in the mailbox, or in the post office when the mailbox is full. It counts against your mod's 3 letters a day, like a script'ssend_letter. It needs nopermissions. The Mod log says when it went out, or why not.- A day needs a notice, lines or a letter, or any of them together. Decorations are not offered, because the game's own decorations belong to the game's festivals.
- A script calls
game.calendar_today()to ask which of its own calendar days fall on the town's date. It returns a list of their ids, empty on other days.
Reference: calendar.json, with every field, limit and error code.
Test your day #
- The quick way. Set the day's
dateto today, install the mod and restart. Walk outside for the notice, talk to a villager and choose to chat a few times for the lines and check the mailbox for the letter. Put the real date back before you share the mod. - On its real date. The game takes the date from your device's clock when it starts. Set the clock forward, reload the game, then set it back. Your town lives through the jump as it would on a GameCube. Weeds grow and a villager may move out. Make a backup first with Export with mod data in the Save panel.
- Installed in the middle of the day. The day still happens. The notice goes up the next time you walk outside in your town. The lines come in the next small talk, and the letter at the next moment you are free. A notice already on the board today is not posted again.
day_startedruns once per day, when the town first reaches that date. It does not run again after a restart the same day. A script that reacts to a calendar day should callgame.calendar_today()where it needs it, invillager_talkedorscene_entered, and not only inday_started.- Every notice, letter and refusal is in the Mod log.
Villager lines #
A talk file puts your lines in the villagers' talk, with no script. A pool's place says where: before the
hello, as the hello, as the topic after a chat answer (small talk unless its topics say
more), after the topic, or as the whole conversation. See places in a talk.
{
"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": "after", "season": "fall", "time": "evening", "chance": 30, "lines": ["The evenings come so\nearly now. I like it."] }
]
}- A pool names a
personality, avillagerby name, or neither. With neither, it is for everyone. The personalities are normal, peppy, lazy, jock, cranky and snooty. season,time,weatheranddaykeep a pool to a moment. Seasons are spring, summer, fall and winter. Times are morning, day, evening and night. Weather is clear, rain or snow. A day is theidof a day in your calendar file.linesis 1 to 32 lines, each up to 160 characters with at most 3 line breaks, or a list of up to 8 such pages.chanceis in how many talks in 100 the pool's line is said, when the pool fits. The default is 100.
The game picks each place's line like this:
- A script's
villager_talkedline for the place comes first. - The most specific pools of that place that fit decide: a pool kept to today's calendar
dayfirst, then this villager by name, else their personality, else everyone. A pool fits when the season, time, weather and day it names are the ones now. - Each fitting pool rolls its
chance. The lines of those that pass are put together and one is picked. When they all roll no, that part of the talk stays the game's.
- Between mods, pools are not ranked by load order. The lines of every mod's fitting pools at the same level go in together.
- Nothing is saved. A villager can say several of your lines in one day, and never the same line twice running when there is another.
- A line never comes in a first meeting, an errand going with the player, a villager moving out or with an islander, and never in place of a first-job tip or the "should I move?" topic.
- A script's
villager_talkedlines go by order: the first mod in the list to return a line for a place takes it. Shops are the opposite, where the lowest mod wins. See load order and two shop mods.
The Lines guide has every rule.
Reference: talk.json, with every field, limit and error code.