{
  "format": 1,
  "title": "Play AC Online mod API",
  "description": "Everything a mod may use. Nothing outside this file is promised. The game, the Mods tab's install check and the mod list's upload check are all tested against it. Versioning policy: https://playaconline.com/modding/reference/versioning/",
  "api": {
    "min": 1,
    "max": 1,
    "minor": 1,
    "policy": {
      "level_support_months": 12,
      "deprecation_levels": 2,
      "deprecation_days": 90,
      "description": "A level is read for at least 12 months after the next level ships. A deprecated name keeps working for at least two more levels and at least 90 days, whichever is later."
    },
    "levels": [
      {
        "level": 1,
        "date": "2026-11-16",
        "summary": "The first level. Content is textures (a file may carry a readable label before its name), lines (a messages file), shops (each by its id in the shop table, from Nook's store and the flower shop to Katrina's tent, one block shape for every shop, each block applying while its when holds), new furniture on a vanilla base with pictures of its own (an items file, renames), letter templates, calendar days and villager line pools. Scripts get the events in the events list, each handed one table. They also get log, message, the game queries, a store per town with a part per player and one per browser, settings, remote calls between mods, a seeded rng and timers on the game clock. Eight commands are declared in permissions: six (cmd.send_letter, give_item, show_line, ask, take_item, take_bells) are applied at the end of a frame's update, and two (cmd.set_shop_goods, set_shop_open) are set at the call. Mods also have depends and conflicts with version ranges, and data_version with the data_migrated event. Mods can name optional_depends, and a setting can be world or client.",
        "minors": [
          {
            "minor": 1,
            "date": "2026-11-26",
            "summary": "Additions, nothing removed or changed: a mod made for 1.0 works unchanged and keeps saying \"api\": 1. Commands cmd.save, cmd.set_weather and cmd.play_sound are applied at the end of a frame's update; cmd.set_hat, cmd.set_shirt and cmd.react are set at the call. The events button_pressed, button_released and player_acted. The queries game.input(), game.weather() and game.place(), and game.player() now also tells where the player stands and what they are doing. A playac-mod older than 1.1.0 does not know these names and says the tool may be out of date."
          }
        ]
      }
    ]
  },
  "limits": [
    {
      "name": "zip.bytes",
      "value": 16777216,
      "unit": "bytes",
      "since": 1,
      "description": "The largest mod ZIP, compressed."
    },
    {
      "name": "zip.unpacked_bytes",
      "value": 67108864,
      "unit": "bytes",
      "since": 1,
      "description": "What every file in one mod adds up to, unpacked."
    },
    {
      "name": "zip.files",
      "value": 2000,
      "unit": "files",
      "since": 1,
      "description": "The most files one mod may hold. Folder entries and repository files (rule repo_files: hidden names starting with a dot, __MACOSX, Thumbs.db, node_modules, and at the top README.md, CHANGELOG.md, LICENSE and the media folder) are dropped first and not counted."
    },
    {
      "name": "zip.path_bytes",
      "value": 160,
      "unit": "bytes",
      "since": 1,
      "description": "The longest path inside a mod, after the one top folder is stripped. ASCII only."
    },
    {
      "name": "file.manifest_bytes",
      "value": 65536,
      "unit": "bytes",
      "since": 1,
      "description": "The largest mod.json."
    },
    {
      "name": "file.json_bytes",
      "value": 262144,
      "unit": "bytes",
      "since": 1,
      "description": "The largest .json file other than mod.json."
    },
    {
      "name": "file.lua_bytes",
      "value": 524288,
      "unit": "bytes",
      "since": 1,
      "description": "The largest .lua file."
    },
    {
      "name": "json.depth",
      "value": 32,
      "unit": "levels",
      "since": 1,
      "description": "How deep JSON may nest. The top value is depth 0, and nothing may sit deeper than 32."
    },
    {
      "name": "mods.enabled",
      "value": 32,
      "unit": "mods",
      "since": 1,
      "description": "The most mods switched on at once."
    },
    {
      "name": "mods.enabled_unpacked_bytes",
      "value": 100663296,
      "unit": "bytes",
      "since": 1,
      "description": "Every switched-on mod together, unpacked, on a computer."
    },
    {
      "name": "mods.enabled_unpacked_bytes_phone",
      "value": 25165824,
      "unit": "bytes",
      "since": 1,
      "description": "Every switched-on mod together, unpacked, on a phone or a low-memory device."
    },
    {
      "name": "messages.lines",
      "value": 256,
      "unit": "lines",
      "since": 1,
      "description": "The most lines in one mod's messages file."
    },
    {
      "name": "messages.key_bytes",
      "value": 48,
      "unit": "bytes",
      "since": 1,
      "description": "The longest line key."
    },
    {
      "name": "messages.text_bytes",
      "value": 400,
      "unit": "bytes",
      "since": 1,
      "description": "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."
    },
    {
      "name": "shops.stock",
      "value": 6,
      "unit": "goods",
      "since": 1,
      "description": "The most goods in one block for the flower shop: one per bench spot."
    },
    {
      "name": "shops.blocks",
      "value": 8,
      "unit": "blocks",
      "since": 1,
      "description": "The most blocks in the list one shop takes in shops.json."
    },
    {
      "name": "shops.lines",
      "value": 8,
      "unit": "lines",
      "since": 1,
      "description": "The most lines in one slot of a block's \"lines\". The keeper says one of them each time."
    },
    {
      "name": "shops.percent_max",
      "value": 1000,
      "unit": "percent",
      "since": 1,
      "description": "The highest price_percent or buy_back_percent."
    },
    {
      "name": "shops.name_chars",
      "value": 40,
      "unit": "characters",
      "since": 1,
      "description": "The longest shop name (the flower shop's door sign), in Unicode code points."
    },
    {
      "name": "shops.line_chars",
      "value": 160,
      "unit": "characters",
      "since": 1,
      "description": "The longest shop line (a slot of \"lines\"), in Unicode code points."
    },
    {
      "name": "shops.line_newlines",
      "value": 3,
      "unit": "newlines",
      "since": 1,
      "description": "The most line breaks in one shop line."
    },
    {
      "name": "shops.price_max",
      "value": 99999,
      "unit": "Bells",
      "since": 1,
      "description": "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."
    },
    {
      "name": "lua.memory_bytes",
      "value": 4194304,
      "unit": "bytes",
      "since": 1,
      "description": "Memory one mod's script may use. Over it, the script stops for the session."
    },
    {
      "name": "lua.memory_total_bytes",
      "value": 16777216,
      "unit": "bytes",
      "since": 1,
      "description": "Memory every mod's script together may use."
    },
    {
      "name": "lua.budget",
      "value": 200000,
      "unit": "instructions",
      "since": 1,
      "description": "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."
    },
    {
      "name": "lua.deadline_ms",
      "value": 250,
      "unit": "milliseconds",
      "since": 1,
      "description": "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)."
    },
    {
      "name": "lua.handlers_per_event",
      "value": 16,
      "unit": "handlers",
      "since": 1,
      "description": "The most handlers one mod may register for one event."
    },
    {
      "name": "lua.log_per_event",
      "value": 20,
      "unit": "lines",
      "since": 1,
      "description": "Mod log lines kept per event for one mod: its log() lines and the refusals written when it called cmd.* or timer.*. The rest are dropped, and the log says so once."
    },
    {
      "name": "lua.log_per_session",
      "value": 500,
      "unit": "lines",
      "since": 1,
      "description": "Mod log lines kept per mod per session: log() lines and every refusal of its commands and timers. A script stop is always written."
    },
    {
      "name": "store.bytes",
      "value": 8192,
      "unit": "bytes",
      "since": 1,
      "description": "The whole store of one mod in one town, store.player's values included. The whole store.client of one mod has the same limit. A set that would go over is refused and changes nothing."
    },
    {
      "name": "store.key_bytes",
      "value": 64,
      "unit": "bytes",
      "since": 1,
      "description": "The longest store key."
    },
    {
      "name": "store.value_bytes",
      "value": 1024,
      "unit": "bytes",
      "since": 1,
      "description": "The longest string a store value may be."
    },
    {
      "name": "items.per_mod",
      "value": 64,
      "unit": "items",
      "since": 1,
      "description": "Items in one mod's items file."
    },
    {
      "name": "items.total",
      "value": 512,
      "unit": "items",
      "since": 1,
      "description": "Mod items across every switched-on mod."
    },
    {
      "name": "items.renames",
      "value": 64,
      "unit": "renames",
      "since": 1,
      "description": "Entries in one mod.json \"renames\"."
    },
    {
      "name": "items.texture_files",
      "value": 16,
      "unit": "files",
      "since": 1,
      "description": "Pictures in one mod item's own textures folder (its \"textures\" setting), counting the files in its subfolders."
    },
    {
      "name": "lua.event_deadline_ms",
      "value": 125,
      "unit": "milliseconds",
      "since": 1,
      "description": "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."
    },
    {
      "name": "lua.frame_budget_ms",
      "value": 4,
      "unit": "milliseconds",
      "since": 1,
      "description": "Lua time all mods together get per frame. Once it is spent, every game event without an answer waits for the next frame, and villager_talked is skipped for the rest of that frame. command_finished and question_answered always run. It never stops or strikes a mod. At least one waiting event runs each frame, so on a slow device events wait longer but still run."
    },
    {
      "name": "lua.slow_run_ms",
      "value": 8,
      "unit": "milliseconds",
      "since": 1,
      "description": "An event run longer than this is a strike. On a slow device it is stretched by the device's pace (lua.pace_frame_ms)."
    },
    {
      "name": "lua.slow_runs",
      "value": 3,
      "unit": "strikes",
      "since": 1,
      "description": "Strikes in a row before the script is stopped (\"kept the game waiting\"). A run under the limit clears the strikes."
    },
    {
      "name": "lua.pace_frame_ms",
      "value": 4,
      "unit": "milliseconds",
      "since": 1,
      "description": "The game's own work per frame that counts as full speed. Mods' Lua time is left out of it. When the game's recent frames take longer (a slow phone, a busy machine), the wall-clock limits are stretched. The stretch is recent frame work divided by this, from 1 up to lua.pace_stretch_max. It applies to lua.deadline_ms, lua.event_deadline_ms and lua.slow_run_ms. The frame cap and the instruction budget are never stretched."
    },
    {
      "name": "lua.pace_stretch_max",
      "value": 8,
      "unit": "times",
      "since": 1,
      "description": "The most a slow device stretches the wall-clock limits. At this stretch an event run's backstop is 1 second and a strike is a run over 64 ms."
    },
    {
      "name": "lua.deferred_events",
      "value": 64,
      "unit": "events",
      "since": 1,
      "description": "Events waiting for a later frame. Past that, an event is dropped and logged."
    },
    {
      "name": "textures.label_chars",
      "value": 40,
      "unit": "characters",
      "since": 1,
      "description": "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."
    },
    {
      "name": "textures.png_side",
      "value": 2048,
      "unit": "pixels",
      "since": 1,
      "description": "The longest side of a PNG texture."
    },
    {
      "name": "textures.png_decoded_bytes",
      "value": 100663296,
      "unit": "bytes",
      "since": 1,
      "description": "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."
    },
    {
      "name": "textures.png_decoded_bytes_phone",
      "value": 25165824,
      "unit": "bytes",
      "since": 1,
      "description": "The same on a phone or low-memory device."
    },
    {
      "name": "textures.dds_bytes",
      "value": 100663296,
      "unit": "bytes",
      "since": 1,
      "description": "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."
    },
    {
      "name": "textures.dds_bytes_phone",
      "value": 25165824,
      "unit": "bytes",
      "since": 1,
      "description": "The same on a phone or low-memory device."
    },
    {
      "name": "settings.per_mod",
      "value": 16,
      "unit": "settings",
      "since": 1,
      "description": "Settings one mod declares."
    },
    {
      "name": "depends.per_mod",
      "value": 16,
      "unit": "mods",
      "since": 1,
      "description": "Mods in depends, in optional_depends and in conflicts, each."
    },
    {
      "name": "data_version.max",
      "value": 1000000,
      "unit": "version",
      "since": 1,
      "description": "The largest data_version."
    },
    {
      "name": "store.towns",
      "value": 16,
      "unit": "towns",
      "since": 1,
      "description": "Towns whose mod data one browser keeps. Writing a 17th drops the file of the least recently written other town."
    },
    {
      "name": "remote.copy_bytes",
      "value": 65536,
      "unit": "bytes",
      "since": 1,
      "description": "Data a remote.call copies each way."
    },
    {
      "name": "remote.functions",
      "value": 32,
      "unit": "functions",
      "since": 1,
      "description": "Functions one mod offers with remote.add."
    },
    {
      "name": "exports.per_mod",
      "value": 32,
      "unit": "functions",
      "since": 1,
      "description": "Remote functions one mod.json \"exports\" lists. It is also the most that remote.add offers."
    },
    {
      "name": "exports.description_chars",
      "value": 120,
      "unit": "characters",
      "since": 1,
      "description": "One \"exports\" description, on one line."
    },
    {
      "name": "nook.stock",
      "value": 16,
      "unit": "goods",
      "since": 1,
      "description": "The most goods in one block for Nook's store."
    },
    {
      "name": "visitors.stock",
      "value": 6,
      "unit": "goods",
      "since": 1,
      "description": "The most goods in one block for a visiting seller (Crazy Redd, Saharah, the fireworks stall)."
    },
    {
      "name": "letters.per_file",
      "value": 32,
      "unit": "letters",
      "since": 1,
      "description": "Letters in one letters file."
    },
    {
      "name": "letters.header_chars",
      "value": 24,
      "unit": "characters",
      "since": 1,
      "description": "A letter header, not counting {player}."
    },
    {
      "name": "letters.body_chars",
      "value": 192,
      "unit": "characters",
      "since": 1,
      "description": "A letter body or a board notice."
    },
    {
      "name": "letters.body_lines",
      "value": 6,
      "unit": "lines",
      "since": 1,
      "description": "Lines on the letter paper or a board page."
    },
    {
      "name": "letters.footer_chars",
      "value": 32,
      "unit": "characters",
      "since": 1,
      "description": "A letter footer."
    },
    {
      "name": "letters.sender_chars",
      "value": 8,
      "unit": "characters",
      "since": 1,
      "description": "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."
    },
    {
      "name": "calendar.per_file",
      "value": 16,
      "unit": "days",
      "since": 1,
      "description": "Days in one calendar file."
    },
    {
      "name": "talk.pools",
      "value": 32,
      "unit": "pools",
      "since": 1,
      "description": "Pools in one talk file."
    },
    {
      "name": "talk.lines_per_pool",
      "value": 32,
      "unit": "lines",
      "since": 1,
      "description": "Lines in one pool."
    },
    {
      "name": "talk.line_chars",
      "value": 160,
      "unit": "characters",
      "since": 1,
      "description": "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."
    },
    {
      "name": "commands.per_event",
      "value": 4,
      "unit": "commands",
      "since": 1,
      "description": "Commands one mod may queue in one event."
    },
    {
      "name": "commands.sounds_per_event",
      "value": 2,
      "unit": "commands",
      "since": 1,
      "since_minor": 1,
      "description": "play_sound calls one mod may make in one event. They count toward commands.per_event too."
    },
    {
      "name": "commands.sounds_per_minute",
      "value": 10,
      "unit": "commands",
      "since": 1,
      "since_minor": 1,
      "description": "Sounds one mod may play in any 60 seconds of the player's real clock, the ones waiting to play included. A sound counts when the game plays it. One refused does not count. A sound has no daily limit."
    },
    {
      "name": "commands.waiting",
      "value": 32,
      "unit": "commands",
      "since": 1,
      "description": "Commands waiting, all mods together."
    },
    {
      "name": "commands.waiting_per_mod",
      "value": 8,
      "unit": "commands",
      "since": 1,
      "description": "Commands one mod may have waiting."
    },
    {
      "name": "commands.letters_per_day",
      "value": 3,
      "unit": "commands",
      "since": 1,
      "description": "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."
    },
    {
      "name": "commands.items_per_day",
      "value": 5,
      "unit": "commands",
      "since": 1,
      "description": "give_item 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."
    },
    {
      "name": "commands.lines_per_day",
      "value": 20,
      "unit": "commands",
      "since": 1,
      "description": "show_line per mod per game day in each town. One that cannot be drawn (command-not-shown) does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule."
    },
    {
      "name": "commands.asks_per_day",
      "value": 10,
      "unit": "commands",
      "since": 1,
      "description": "ask per mod per game day in each town. One that cannot be drawn (command-not-shown) does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule."
    },
    {
      "name": "commands.take_items_per_day",
      "value": 6,
      "unit": "commands",
      "since": 1,
      "description": "take_item per mod per game day in each town. A take counts when its question is shown, whatever the player answers. One that cannot be drawn (command-not-shown) does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule."
    },
    {
      "name": "commands.take_bells_per_day",
      "value": 6,
      "unit": "commands",
      "since": 1,
      "description": "take_bells per mod per game day in each town. A take counts when its question is shown, whatever the player answers. One that cannot be drawn (command-not-shown) does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule."
    },
    {
      "name": "commands.take_item_count",
      "value": 15,
      "unit": "items",
      "since": 1,
      "description": "The most pieces of one item a single take_item may ask for. It is the number of pockets."
    },
    {
      "name": "commands.take_bells_amount",
      "value": 99999,
      "unit": "Bells",
      "since": 1,
      "description": "The most Bells a single take_bells may ask for. It is the most a wallet holds."
    },
    {
      "name": "commands.weather_per_day",
      "value": 4,
      "unit": "commands",
      "since": 1,
      "since_minor": 1,
      "description": "set_weather per mod per game day in each town. A change counts when the game changes the weather. One refused, or one that found the town already in that weather (via unchanged), does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule: a sky that changes every few minutes is no weather."
    },
    {
      "name": "commands.saves_per_day",
      "value": 32,
      "unit": "commands",
      "since": 1,
      "since_minor": 1,
      "description": "save per mod per game day in each town. A save counts when the game writes the town. One refused, or one that found nothing changed (via unchanged), does not count. The count is per town and shared by its residents, not per player. It is a safety limit, not a game rule: every save also uploads the town to the cloud."
    },
    {
      "name": "commands.save_spacing_seconds",
      "value": 10,
      "unit": "seconds",
      "since": 1,
      "since_minor": 1,
      "description": "The least time between two saves by mods, all mods together, on the player's real clock. A save asked for sooner is refused with command-too-soon. A refused save does not start the wait; one that found nothing changed does."
    },
    {
      "name": "timers.per_mod",
      "value": 16,
      "unit": "timers",
      "since": 1,
      "description": "The most timers one mod may have waiting in one town."
    },
    {
      "name": "timers.minutes_max",
      "value": 10080,
      "unit": "minutes",
      "since": 1,
      "description": "The longest a timer may wait, in game minutes. It is 7 game days. A timer never waits longer than this from any moment, so a clock set back cannot strand one."
    },
    {
      "name": "timers.name_bytes",
      "value": 40,
      "unit": "bytes",
      "since": 1,
      "description": "The longest timer name. A name is letters, digits, _, - and . only."
    },
    {
      "name": "timers.data_bytes",
      "value": 240,
      "unit": "bytes",
      "since": 1,
      "description": "The longest text a timer's data may be."
    },
    {
      "name": "commands.letter_chars",
      "value": 192,
      "unit": "characters",
      "since": 1,
      "description": "A letter's text. It must also fit the letter's 6 lines of 192 pixels."
    },
    {
      "name": "commands.letter_from_chars",
      "value": 8,
      "unit": "characters",
      "since": 1,
      "description": "A letter's signature, also the mailbox list's sender. It is one line. A line break or another control character is refused."
    },
    {
      "name": "commands.line_bytes",
      "value": 400,
      "unit": "bytes",
      "since": 1,
      "description": "A show_line text."
    },
    {
      "name": "commands.ask_chars",
      "value": 120,
      "unit": "characters",
      "since": 1,
      "description": "An ask question."
    },
    {
      "name": "commands.choice_chars",
      "value": 16,
      "unit": "characters",
      "since": 1,
      "description": "One answer of an ask."
    },
    {
      "name": "commands.choices_min",
      "value": 2,
      "unit": "answers",
      "since": 1,
      "description": "The fewest answers an ask may offer."
    },
    {
      "name": "commands.choices_max",
      "value": 4,
      "unit": "answers",
      "since": 1,
      "description": "The most answers an ask may offer."
    },
    {
      "name": "commands.papers",
      "value": 64,
      "unit": "papers",
      "since": 1,
      "description": "Letter papers, numbered 0 to 63."
    },
    {
      "name": "commands.hat_side",
      "value": 32,
      "unit": "pixels",
      "since": 1,
      "since_minor": 1,
      "description": "The width and the height of a picture cmd.set_hat puts on the hat or cmd.set_shirt on the shirt. It must be exactly this size, the size of an Able Sisters design."
    },
    {
      "name": "commands.hat_colors",
      "value": 16,
      "unit": "colours",
      "since": 1,
      "since_minor": 1,
      "description": "The most colours a hat or shirt picture may have, as a design. Every pixel must be opaque. Colours are kept at 5 bits a channel, as the game keeps a design's."
    },
    {
      "name": "commands.hat_file_bytes",
      "value": 65536,
      "unit": "bytes",
      "since": 1,
      "since_minor": 1,
      "description": "The largest PNG file cmd.set_hat or cmd.set_shirt reads. A 32 x 32 picture is far smaller."
    },
    {
      "name": "calendar.board_per_day",
      "value": 3,
      "unit": "notices",
      "since": 1,
      "description": "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."
    },
    {
      "name": "store.towns_bytes",
      "value": 1572864,
      "unit": "bytes",
      "since": 1,
      "description": "What every town's mod data in one browser adds up to. Writing past it drops the least recently written other towns' files first. Mod data therefore never pushes a save over the cloud's 5 MB."
    },
    {
      "name": "talk.line_newlines",
      "value": 3,
      "unit": "newlines",
      "since": 1,
      "description": "The most line breaks in a page of a villager line (a pool's or a script's)."
    },
    {
      "name": "talk.pages",
      "value": 8,
      "unit": "pages",
      "since": 1,
      "description": "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."
    },
    {
      "name": "talk.villager_chars",
      "value": 8,
      "unit": "characters",
      "since": 1,
      "description": "A pool's \"villager\" name, as the game spells it."
    },
    {
      "name": "items.price_max",
      "value": 99999,
      "unit": "Bells",
      "since": 1,
      "description": "The highest price an item in a mod's items file may have."
    },
    {
      "name": "manifest.name_chars",
      "value": 60,
      "unit": "characters",
      "since": 1,
      "description": "The longest mod \"name\", in Unicode code points, spaces at the ends not counted."
    },
    {
      "name": "manifest.authors",
      "value": 8,
      "unit": "names",
      "since": 1,
      "description": "The most names in \"authors\"."
    },
    {
      "name": "manifest.author_chars",
      "value": 40,
      "unit": "characters",
      "since": 1,
      "description": "The longest name in \"authors\", spaces at the ends not counted."
    },
    {
      "name": "manifest.description_chars",
      "value": 500,
      "unit": "characters",
      "since": 1,
      "description": "The longest \"description\"."
    },
    {
      "name": "manifest.tags",
      "value": 5,
      "unit": "tags",
      "since": 1,
      "description": "The most different tags in \"tags\"."
    },
    {
      "name": "settings.label_chars",
      "value": 60,
      "unit": "characters",
      "since": 1,
      "description": "A setting's \"label\", spaces at the ends not counted."
    },
    {
      "name": "settings.description_chars",
      "value": 200,
      "unit": "characters",
      "since": 1,
      "description": "A setting's \"description\"."
    },
    {
      "name": "settings.choices_min",
      "value": 2,
      "unit": "choices",
      "since": 1,
      "description": "The fewest \"choices\" a choice setting lists."
    },
    {
      "name": "settings.choices",
      "value": 16,
      "unit": "choices",
      "since": 1,
      "description": "The most \"choices\" a choice setting lists."
    },
    {
      "name": "settings.choice_chars",
      "value": 40,
      "unit": "characters",
      "since": 1,
      "description": "One choice of a choice setting, on one line."
    },
    {
      "name": "settings.text_chars",
      "value": 200,
      "unit": "characters",
      "since": 1,
      "description": "The largest \"max_length\" a text setting may ask for."
    },
    {
      "name": "settings.number_max",
      "value": 1000000000,
      "unit": "number",
      "since": 1,
      "description": "A number setting's \"min\" and \"max\" lie within minus this and this."
    },
    {
      "name": "depends.range_bytes",
      "value": 64,
      "unit": "bytes",
      "since": 1,
      "description": "The longest version range in depends or conflicts."
    },
    {
      "name": "depends.range_parts",
      "value": 4,
      "unit": "comparisons",
      "since": 1,
      "description": "The most comparisons in one version range, like \">=1.0.0 <2.0.0\" (two)."
    },
    {
      "name": "commands.reacts_per_minute",
      "value": 10,
      "unit": "commands",
      "since": 1,
      "since_minor": 1,
      "description": "cmd.react per mod per minute of the game clock. A reaction the game refused does not count. It is a safety limit, so a mod cannot keep a player reacting in a friend's town or The City."
    }
  ],
  "manifest": [
    {
      "name": "$schema",
      "since": 1,
      "required": false,
      "description": "Optional. The JSON Schema an editor checks mod.json against, for autocomplete and errors as you type. The game ignores it.",
      "example": "https://playaconline.com/schemas/mod.schema.json",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "schema",
      "since": 1,
      "required": true,
      "description": "The manifest format. Always 1.",
      "example": 1,
      "schema": {
        "const": 1
      }
    },
    {
      "name": "api",
      "since": 1,
      "required": true,
      "description": "The mod API level the mod is made for. The game checks a mod by the rules of its own level. It runs an older level through shims while that level is supported. A level only changes for a breaking change; new names arrive as a minor version of the level (API 1.1), and a mod made for 1.0 still says 1. Use the newest level.",
      "example": 1,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 1
      }
    },
    {
      "name": "id",
      "since": 1,
      "required": true,
      "description": "author.mod-name, in lowercase letters, digits and dashes, with one dot. The author parts playaconline, official, admin and example are reserved for the site's own mods in the mod list. The mod list also refuses an author part that passes for one of them (official-, examples, playaconline-official).",
      "example": "yourname.tea-stall",
      "schema": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}$",
        "maxLength": 81
      }
    },
    {
      "name": "name",
      "since": 1,
      "required": true,
      "description": "The name players see, 1 to 60 characters after trimming spaces. The mod list also refuses a name with a line break, another control character or a hidden text-direction character.",
      "example": "Tea Stall",
      "schema": {
        "type": "string",
        "pattern": "^\\s*\\S(?:[\\s\\S]{0,58}\\S)?\\s*$"
      }
    },
    {
      "name": "version",
      "since": 1,
      "required": true,
      "description": "x.y.z, each part 1 to 9 digits with no leading zero. Every upload needs a version number this mod has not used yet. The number of a refused upload can be used again.",
      "example": "1.0.0",
      "schema": {
        "type": "string",
        "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
      }
    },
    {
      "name": "authors",
      "since": 1,
      "required": true,
      "description": "1 to 8 names, each 1 to 40 characters. The mod list also refuses a name with a line break, another control character or a hidden text-direction character.",
      "example": [
        "Your Name"
      ],
      "schema": {
        "type": "array",
        "minItems": 1,
        "maxItems": 8,
        "items": {
          "type": "string",
          "pattern": "^\\s*\\S(?:[\\s\\S]{0,38}\\S)?\\s*$"
        }
      }
    },
    {
      "name": "description",
      "since": 1,
      "required": false,
      "description": "Optional text of at most 500 characters. null is refused. Leave the key out instead.",
      "example": "The flower shop becomes a tea stall in the evening.",
      "schema": {
        "type": "string",
        "maxLength": 500
      }
    },
    {
      "name": "tags",
      "since": 1,
      "required": false,
      "description": "Optional. The mod list's filters: at most 5 different tags from a fixed list, lower case. Players filter the mod list by them. The game never reads them. Anything else is refused (manifest-tags).",
      "example": [
        "textures",
        "seasonal"
      ],
      "schema": {
        "type": "array",
        "maxItems": 5,
        "uniqueItems": true,
        "items": {
          "enum": [
            "textures",
            "clothing",
            "furniture",
            "scenery",
            "villagers",
            "dialogue",
            "shops",
            "seasonal",
            "holidays",
            "quality-of-life",
            "humor",
            "accessibility",
            "scripts"
          ]
        }
      }
    },
    {
      "name": "scope",
      "since": 1,
      "required": true,
      "description": "client is a Just you mod, which only you see. world is a World mod, which changes what a visitor to your town would see. Only a World mod may hold a shop (content.shops) or a calendar file with a board notice. A friend visit needs the same World mods that count (see visit_scope) on both sides.",
      "example": "client",
      "schema": {
        "enum": [
          "client",
          "world"
        ]
      }
    },
    {
      "name": "content",
      "since": 1,
      "required": false,
      "description": "What the mod adds, each a path inside the mod: textures, messages, shops, items, letters, calendar and talk. Anything else is refused. textures names a folder, and every other key names one file. Every text shows as written.",
      "example": {
        "messages": "messages.json"
      },
      "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "textures": {
            "type": "string",
            "minLength": 1,
            "description": "A folder with at least one texture file."
          },
          "messages": {
            "type": "string",
            "minLength": 1,
            "description": "The messages file: one .json file of lines, called messages.json by convention."
          },
          "shops": {
            "type": "string",
            "minLength": 1,
            "description": "The shops file. Needs scope world."
          },
          "items": {
            "type": "string",
            "minLength": 1,
            "description": "The items file."
          },
          "letters": {
            "type": "string",
            "minLength": 1,
            "description": "The letters file."
          },
          "calendar": {
            "type": "string",
            "minLength": 1,
            "description": "The calendar file. A board notice needs scope world."
          },
          "talk": {
            "type": "string",
            "minLength": 1,
            "description": "The talk pools file."
          }
        }
      },
      "keys": [
        "textures",
        "messages",
        "shops",
        "items",
        "letters",
        "calendar",
        "talk"
      ]
    },
    {
      "name": "scripts",
      "since": 1,
      "required": false,
      "description": "A Lua script and the events it listens to. events may list data_migrated only with a data_version.",
      "example": {
        "main": "main.lua",
        "events": [
          "villager_talked",
          "day_started"
        ]
      },
      "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "main",
          "events"
        ],
        "properties": {
          "main": {
            "type": "string",
            "pattern": "\\.lua$",
            "description": "The script file, ending in lowercase .lua."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/definitions/event"
            },
            "description": "Every event the script handles, each once."
          }
        }
      },
      "keys": [
        "main",
        "events"
      ]
    },
    {
      "name": "permissions",
      "since": 1,
      "required": false,
      "description": "The commands the mod's script may queue, each once. The game refuses any command the list leaves out. The Mods tab and the moderators' review show what the list lets the mod do. take_item and take_bells let the mod ask the player for items or Bells. The game itself shows the question with the true item and amount, and nothing is taken unless the player says yes. save lets the mod save the town where the player could save at Gyroid. play_sound lets the mod play the game's own sound effects, heard only by its own player. set_weather sets the town's weather for the day, and set_shop_goods and set_shop_open change a shop for the day. The three need scope world. set_hat and set_shirt change only how the player's hat or shirt looks on their own screen and work in any mod. react plays one of the reactions on the player's own character and works in any mod. Needs scripts.",
      "example": [
        "send_letter"
      ],
      "schema": {
        "type": "array",
        "minItems": 1,
        "uniqueItems": true,
        "items": {
          "enum": [
            "send_letter",
            "give_item",
            "show_line",
            "ask",
            "take_item",
            "take_bells",
            "save",
            "set_weather",
            "play_sound",
            "set_shop_goods",
            "set_shop_open",
            "set_hat",
            "set_shirt",
            "react"
          ]
        }
      },
      "keys": [
        "send_letter",
        "give_item",
        "show_line",
        "ask",
        "take_item",
        "take_bells",
        "save",
        "set_weather",
        "play_sound",
        "set_shop_goods",
        "set_shop_open",
        "set_hat",
        "set_shirt",
        "react"
      ]
    },
    {
      "name": "exports",
      "since": 1,
      "required": false,
      "description": "A library's remote functions by name, each with a one-line description. These are what other mods may remote.call. At most 32 names, each 1 to 32 of a-z 0-9 _. Each description is 1 to 120 characters on one line. When exports is declared, the game lets remote.add offer only these names. The Mod log says when a listed name was never offered. Needs scripts.",
      "example": {
        "count_pieces": "How many workshop pieces the player bought, as a whole number."
      },
      "schema": {
        "type": "object",
        "maxProperties": 32,
        "propertyNames": {
          "pattern": "^[a-z0-9_]{1,32}$"
        },
        "additionalProperties": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        }
      }
    },
    {
      "name": "assets_original",
      "since": 1,
      "required": true,
      "description": "Must be true. It is your promise that the mod holds only work its authors made, never files taken from the game.",
      "example": true,
      "schema": {
        "const": true
      }
    },
    {
      "name": "renames",
      "since": 1,
      "required": false,
      "description": "Maps an old full item id of this mod to the full id of an item in this mod's items file. At most 64. Needs content.items. Each rename runs once per save, and mod-items.json records it. A renamed item already in a house therefore keeps working.",
      "example": {
        "yourname.tea-stall:old-cup": "yourname.tea-stall:cup"
      },
      "schema": {
        "type": "object",
        "maxProperties": 64,
        "propertyNames": {
          "pattern": "^([a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}):([a-z0-9][a-z0-9-]{0,31})$"
        },
        "additionalProperties": {
          "type": "string",
          "pattern": "^([a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}):([a-z0-9][a-z0-9-]{0,31})$"
        }
      }
    },
    {
      "name": "depends",
      "since": 1,
      "required": false,
      "description": "Mods this one needs, as mod id to version range. A range is \"*\", or up to 4 comparisons (>= <= > < = and a version) split by one space. At most 16. This mod loads after them. It does not load when one is missing, off, out of range or not loading. The game checks again when it starts: a mod whose dependency is not loaded before it, in range, is not loaded at all.",
      "example": {
        "yourname.tea-lib": ">=1.0.0 <2.0.0"
      },
      "schema": {
        "type": "object",
        "maxProperties": 16,
        "propertyNames": {
          "pattern": "^[a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}$"
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^(\\*|((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))( ((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))){0,3})$"
        }
      }
    },
    {
      "name": "optional_depends",
      "since": 1,
      "required": false,
      "description": "Mods this one can use but does not need, as mod id to version range. Ranges are written as in depends. At most 16. This mod always loads. An optional dependency is present when it is installed, switched on, loading and inside the range. A present one loads before this mod. One that is missing, off, not loading or outside the range is absent, and nothing waits for it. A script asks with remote.version(id). remote.call to an absent one returns nil, a message and a code. It is not an error. A mod id may be in only one of depends, optional_depends and conflicts.",
      "example": {
        "yourname.tea-lib": ">=1.0.0 <2.0.0"
      },
      "schema": {
        "type": "object",
        "maxProperties": 16,
        "propertyNames": {
          "pattern": "^[a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}$"
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^(\\*|((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))( ((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))){0,3})$"
        }
      }
    },
    {
      "name": "conflicts",
      "since": 1,
      "required": false,
      "description": "Mods this one cannot run with, as mod id to version range. At most 16. A mod id may be in only one of depends, optional_depends and conflicts. This mod stays off while a matching one is on.",
      "example": {
        "someone.other-shop": "*"
      },
      "schema": {
        "type": "object",
        "maxProperties": 16,
        "propertyNames": {
          "pattern": "^[a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}$"
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^(\\*|((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))( ((>=|<=|>|<|=)?(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8}))){0,3})$"
        }
      }
    },
    {
      "name": "data_version",
      "since": 1,
      "required": false,
      "description": "A whole number 1 to 1000000 for the shape of what the scripts save. When it changes, the data_migrated event runs once per town. Listing data_migrated in scripts.events needs it.",
      "example": 1,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 1000000
      }
    },
    {
      "name": "settings",
      "since": 1,
      "required": false,
      "description": "At most 16 settings the player sets on the Mods tab and scripts read with settings.get. The types are bool, number (whole, with min and max), choice (2 to 16 choices) and text (max_length 1 to 200). A setting may say \"scope\". \"world\" is the default: the value is part of the town, a friend visit compares it, and a visitor lent the mod runs the host's value. \"client\" is the player's own: it is never compared or sent, and each player keeps theirs on a visit. Use client for a choice that only changes what its own player sees or hears.",
      "example": [
        {
          "name": "greet",
          "type": "bool",
          "label": "Say hello",
          "default": true,
          "scope": "client"
        }
      ],
      "schema": {
        "type": "array",
        "maxItems": 16,
        "items": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "type",
                "label",
                "default"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "description": "1 to 60 characters, trimmed, on one line. No control, format (zero width, text-direction) or blank filler character."
                },
                "description": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "At most 200 characters. Line breaks are allowed. No other control, format (zero width, text-direction) or blank filler character."
                },
                "scope": {
                  "enum": [
                    "world",
                    "client"
                  ],
                  "description": "Whose the value is on a friend visit. world (the default): the host's. client: each player's own."
                },
                "type": {
                  "const": "bool"
                },
                "default": {
                  "type": "boolean"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "type",
                "label",
                "default",
                "min",
                "max"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "description": "1 to 60 characters, trimmed, on one line. No control, format (zero width, text-direction) or blank filler character."
                },
                "description": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "At most 200 characters. Line breaks are allowed. No other control, format (zero width, text-direction) or blank filler character."
                },
                "scope": {
                  "enum": [
                    "world",
                    "client"
                  ],
                  "description": "Whose the value is on a friend visit. world (the default): the host's. client: each player's own."
                },
                "type": {
                  "const": "number"
                },
                "default": {
                  "type": "integer",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                },
                "min": {
                  "type": "integer",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                },
                "max": {
                  "type": "integer",
                  "minimum": -1000000000,
                  "maximum": 1000000000
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "type",
                "label",
                "default",
                "choices"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "description": "1 to 60 characters, trimmed, on one line. No control, format (zero width, text-direction) or blank filler character."
                },
                "description": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "At most 200 characters. Line breaks are allowed. No other control, format (zero width, text-direction) or blank filler character."
                },
                "scope": {
                  "enum": [
                    "world",
                    "client"
                  ],
                  "description": "Whose the value is on a friend visit. world (the default): the host's. client: each player's own."
                },
                "type": {
                  "const": "choice"
                },
                "default": {
                  "type": "string"
                },
                "choices": {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 16,
                  "uniqueItems": true,
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "type",
                "label",
                "default",
                "max_length"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "description": "1 to 60 characters, trimmed, on one line. No control, format (zero width, text-direction) or blank filler character."
                },
                "description": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "At most 200 characters. Line breaks are allowed. No other control, format (zero width, text-direction) or blank filler character."
                },
                "scope": {
                  "enum": [
                    "world",
                    "client"
                  ],
                  "description": "Whose the value is on a friend visit. world (the default): the host's. client: each player's own."
                },
                "type": {
                  "const": "text"
                },
                "default": {
                  "type": "string"
                },
                "max_length": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 200
                }
              }
            }
          ]
        }
      }
    }
  ],
  "unbuilt_keys": {
    "since": 1,
    "description": "Top-level keys reserved for planned features. Each is refused, even when null, so no mod carries one a later game would start obeying.",
    "keys": [
      "game",
      "save"
    ]
  },
  "rules": [
    {
      "name": "shops_need_world",
      "since": 1,
      "description": "content.shops requires scope world."
    },
    {
      "name": "shop_fields",
      "since": 1,
      "description": "Every shop takes the same block, and each field means the same on every shop. The shop table (files.shops.shop_table) lists the fields each shop has, and it is read from the game itself. A field a shop does not have is left out, not refused: the rest of the block applies and the mod's row in the Mods tab names the shop and the field (code shop-field-ignored). Nook's store and Able Sisters have no lines, because their keepers speak only the disc's own words."
    },
    {
      "name": "unknown_keys",
      "since": 1,
      "description": "A key the game does not know is refused. This applies at the top of mod.json, at the top of the shops, items, letters, calendar and talk files, and in each of their entries (a shop block, a good, a \"when\" and its hours, an item, a letter, a calendar day, a talk pool). The messages file is the exception, because its keys are the lines. The message is <file>: unknown key \"<key>\", followed by (did you mean \"<known>\"?) when a known key is close. $schema is known wherever a file may carry it. Keys are case-sensitive."
    },
    {
      "name": "json_strict",
      "since": 1,
      "description": "Duplicate keys and \\u0000 are refused in every JSON file."
    },
    {
      "name": "extensions",
      "since": 1,
      "description": "A mod may hold only these file types (case-insensitive).",
      "values": [
        ".json",
        ".lua",
        ".dds",
        ".png",
        ".txt",
        ".md"
      ]
    },
    {
      "name": "repo_files",
      "since": 1,
      "description": "Files a mod repository holds for people, not for the game. playac-mod pack leaves them out, and the game and the mod list ignore them in any ZIP: they are dropped before any other rule, never unpacked or stored, and counted toward no limit. So a ZIP made by hand of a whole mod repository installs. They are any part of a path that starts with a dot (.git, .github, .gitignore, .vscode, .playac, .DS_Store), any part named in any_parts, and at the top of the mod (inside the one top folder, when the ZIP has one) a file named in top_files, a file whose name before its extension is in top_stems (LICENSE, LICENSE.md, license.txt), and everything in a folder named in top_folders (media/, for the README's pictures, film and media.json). Names match in any letter case.",
      "any_parts": [
        "__MACOSX",
        "Thumbs.db",
        "node_modules"
      ],
      "top_files": [
        "README.md",
        "CHANGELOG.md"
      ],
      "top_stems": [
        "LICENSE",
        "LICENCE"
      ],
      "top_folders": [
        "media"
      ]
    },
    {
      "name": "frame_cap",
      "since": 1,
      "description": "All mods share 4 ms of Lua time a frame. Past it, every game event without an answer (day_started, item_picked_up, scene_entered and the others) waits for the next frame. Events wait in order for each mod, at most 64 at a time, and one past that is dropped. villager_talked is skipped for the rest of that frame, so the villager says their own greeting. A mod with events still waiting is not asked for a villager_talked line until they have run. The next mod is asked instead. Each mod therefore sees its own events in the order they happened. A remote.call into a mod is not one of its events. It runs at once, inside the caller's event. command_finished and question_answered wait too, but are never dropped or skipped. villager_answered runs at once: the player is waiting on it. A command queued by a command_finished handler is applied at the next frame boundary, not the one that delivered the result. data_migrated runs as a town loads, outside the limit."
    },
    {
      "name": "data_migrated_needs_data_version",
      "since": 1,
      "description": "scripts.events may list data_migrated only with a data_version."
    },
    {
      "name": "depends_not_conflicts",
      "since": 1,
      "description": "A mod id may be in only one of depends, optional_depends and conflicts. None of them may name the mod itself."
    },
    {
      "name": "settings_world_hash",
      "since": 1,
      "description": "A World mod that declares world settings adds a hash of their values to its entry in the list of mods a friend visit compares. The entry gains +<sha256 of \"name=value\\n\" per world setting, sorted>. The visit's list of mods carries that hash and the values too, so two towns on one mod with different settings are told \"same mod, different settings\". A setting whose scope is client is not in the hash, and its value is never in the list. A mod with only client settings adds no hash. A mod with no client setting hashes as it did before scopes existed."
    },
    {
      "name": "visit_scope",
      "since": 1,
      "description": "Which mods a friend visit compares. A Just you mod never counts. A World mod counts if its content has textures, shops or items (visit_scope_content), if its permissions name set_shop_goods or set_shop_open (they change a shop), or if its permissions are not a list of strings. Every other World mod does not count. That covers a mod with only lines, letters, calendar days or talk pools. No command makes a mod count. send_letter, give_item, take_item, take_bells, save and set_weather are refused on a visit, show_line, ask and play_sound reach only their own player, set_hat and set_shirt change only how the player's hat or shirt looks on their own screen, and react moves only the player's own character. A visitor sees the host's weather through the game itself, with or without the mod that set it. Only mods that count must match between the two towns. An optional dependency is a mod like any other here. When it is a World mod that counts, it is in the list, and installing it changes what a visit compares.",
      "values": [
        "send_letter",
        "give_item",
        "show_line",
        "ask",
        "take_item",
        "take_bells",
        "save",
        "set_weather",
        "play_sound",
        "set_hat",
        "set_shirt",
        "react"
      ]
    },
    {
      "name": "visit_scope_content",
      "since": 1,
      "description": "The content keys that make a World mod count for visits, whatever its permissions. They are what a visitor must draw or meet in the town.",
      "values": [
        "textures",
        "shops",
        "items"
      ]
    },
    {
      "name": "world_scope",
      "since": 1,
      "description": "What needs scope world, because it changes the town a visitor sees: a shops file (content.shops), a calendar file with a board notice, and the permissions set_weather, set_shop_goods and set_shop_open. Everything else may be client (only you see it) or world.",
      "values": [
        "shops",
        "board",
        "set_weather",
        "set_shop_goods",
        "set_shop_open"
      ]
    },
    {
      "name": "load_order_last_wins",
      "since": 1,
      "description": "When two mods change the same thing, the last in load order wins it whole. For a shop that is per shop id: the later mod's blocks are that shop, and the earlier mod's change to it is not used. Two mods that change different shops both apply. The earlier mod's row in the Mods tab names the shop and the mod that has it. Inside the mod that has a shop, all its blocks for it apply. For a texture, the kind of file comes first. A file for one exact palette (tex1_..._<tlut>_<fmt>) beats any mod's every-palette file (tex1_..._$_<fmt>) for the same texture, whatever the order. Between two files of the same kind, the later mod's is drawn. A mod's texture of either kind beats the HD pack's.",
      "values": [
        "textures",
        "shops"
      ]
    },
    {
      "name": "load_order_first_wins",
      "since": 1,
      "description": "A villager's talk has five places for a mod's words: before, hello, topic, after and conversation. Each takes one line per talk, and every line names its place. Every mod's villager_talked handler runs, in load order, and the first line a handler returns for a place takes it. A conversation takes the whole talk, so it needs every place free; once one is taken, the event stops. Lines a script did not take a place with come from talk files, which are not first-wins: every mod's fitting pools of that place are put together and one line is picked from all of them, fresh on every talk.",
      "values": [
        "villager_talked"
      ]
    },
    {
      "name": "dev_reload_hot",
      "since": 1,
      "description": "Developer mode reloads these while you play, with no restart: the content files named here, any .lua script (\"scripts\") and the files under content.textures. Developer mode means a mod loaded from a folder or from playac-mod dev. Each value is a content key, or \"scripts\".",
      "values": [
        "messages",
        "shops",
        "talk",
        "letters",
        "calendar",
        "items",
        "scripts",
        "textures"
      ]
    },
    {
      "name": "dev_reload_restart",
      "since": 1,
      "description": "Developer mode loads a change to these only when the game restarts: mod.json and the content files named here. mod.json is read once at start, and so is a file added or removed. Each value is \"mod.json\" or a content key.",
      "values": [
        "mod.json"
      ]
    },
    {
      "name": "visit_lend",
      "since": 1,
      "description": "Visiting with the host's mods. When every World mod of the host that counts is a reviewed version from the mod list, a visitor can load them for that visit only, after agreeing. They run with the host's world settings. Each mod's world values travel with the visit, are checked against what its mod.json allows, and are never kept on the visitor's game. A text setting the host changed from its default must pass the site's word checks (no rude words, contact details or risky phrases). If it does not, the visit is refused instead of lent. A client setting is the visitor's own. It keeps the value the visitor set on their installed copy of the mod, and it is the default when the visitor does not have the mod. Nothing is installed. The game restarts with the lent mods, and their scripts start with an empty store that is never saved. A lent mod acts only in the host's town. At home, in the restart before the trip and the one after it, its shop, Nook goods, board notices, items, renames and commands do nothing. It therefore never changes the visitor's own town or save. A mod installed from a file cannot be lent. Nothing is lent while mods are switched off for everyone. A set that would not load whole on the visitor's game, in the host's order, with the visitor's own Just you mods and under the same limits, is refused before the restart."
    },
    {
      "name": "city_set",
      "since": 1,
      "description": "The City's own mod set is a short list chosen by the site and changed only with a release. A City mod may hold only textures and messages. It has no shops, no scripts and no permissions."
    },
    {
      "name": "calendar_board_world",
      "since": 1,
      "description": "A calendar file with a board notice requires scope world. The board is the town's, and a visitor reads it."
    },
    {
      "name": "calendar_letter_once",
      "since": 1,
      "description": "A calendar day's \"letter\" goes out once per day per town. It goes out only in the player's own town, not on a visit and not in The City. It counts against the mod's daily send_letter limit. A refusal is written to the Mod log, never to a script."
    },
    {
      "name": "font_characters",
      "since": 1,
      "description": "The characters the game's font draws in a mod's lines (messages, talk lines, shop greetings, show_line and ask). Every printable ASCII character is drawn, except $ * ^ | \\ which are each drawn as ?. The characters # + / ; are drawn by the font's own signs. [ ] { } are drawn as ( ), ` as ' and ~ as the villagers' wavy tilde. The letters and signs listed here are drawn too. Curly quotes, dashes, the ellipsis and a no-break space become their ASCII spelling. Any other character is drawn as ?. Letters and board notices take plain ASCII only. values holds the extra characters, from the font's own table.",
      "values": [
        "¿",
        "Ä",
        "À",
        "Á",
        "Â",
        "Ã",
        "Å",
        "Ç",
        "È",
        "É",
        "Ê",
        "Ë",
        "Ì",
        "Í",
        "Î",
        "Ï",
        "Ð",
        "Ñ",
        "Ò",
        "Ó",
        "Ô",
        "Õ",
        "Ö",
        "Ù",
        "Ú",
        "Û",
        "Ü",
        "ß",
        "Þ",
        "à",
        "á",
        "â",
        "ã",
        "ä",
        "å",
        "ç",
        "è",
        "é",
        "ê",
        "ë",
        "ì",
        "í",
        "î",
        "ï",
        "·",
        "ð",
        "ñ",
        "ò",
        "ó",
        "ô",
        "õ",
        "ö",
        "ù",
        "ú",
        "û",
        "ü",
        "ý",
        "ÿ",
        "þ",
        "Ý",
        "§",
        "ª",
        "º",
        "µ",
        "³",
        "²",
        "¹",
        "Æ",
        "æ",
        "«",
        "»",
        "×",
        "÷"
      ]
    },
    {
      "name": "permissions_need_scripts",
      "since": 1,
      "description": "permissions requires scripts, because only a script can use a command."
    },
    {
      "name": "exports_need_scripts",
      "since": 1,
      "description": "exports requires scripts, because only a script offers functions."
    },
    {
      "name": "own_game_only",
      "since": 1,
      "description": "Nothing of a mod runs outside the player's own game. At the title screen, at player select and in the intro no event fires, no timer fires, no command is applied, no calendar letter goes out and no town data is loaded, so data_migrated does not run there either. The title screen plays a demo in the player's own save with the clock set to a date in 2001. A script never sees that date. Whatever was waiting keeps waiting and carries on when play starts: a timer that came due fires then, and a command queued before a save and quit is applied then. The one part of a script that runs outside the game is its main chunk, at start, before a town loads."
    },
    {
      "name": "commands_between_frames",
      "since": 1,
      "description": "An event handler never changes the game. Each cmd.* call queues a command. The game applies the queue at one point in each frame: at the end of the game's update, after the world moves and before that frame is drawn. It applies commands only while the player is free, which means not in a talk, menu, cutscene, door or scene change. A sound (play_sound) is the one exception: it changes nothing, so it plays at the next point in a frame wherever the player is, and never waits behind a line. A command's result comes back as a command_finished event to the mod that queued it."
    },
    {
      "name": "commands_host_only",
      "since": 1,
      "description": "Every command but set_hat, set_shirt and react is refused in The City. On a visit to a friend's town, send_letter, give_item, take_item, take_bells, save and set_weather are refused, because only the town owner's game changes a town, its weather or a player's save. show_line, ask, play_sound, set_hat, set_shirt and react still run, for the visitor only. The last three change only the player's own character and nothing saved."
    },
    {
      "name": "command_items",
      "since": 1,
      "description": "A letter's present and a given item follow the shop's item rules: no money, turnips, tickets, grab bags, fossils or reserve ids. give_item also takes this mod's own new item by its full id. Full pockets refuse a mod item, because a letter cannot carry its identity. A plain item comes by letter instead."
    },
    {
      "name": "ids_are_numbers",
      "since": 1,
      "description": "In Lua an id is always a number, never a hex string. That holds for an item, a villager and a scene. JSON data files write an item as a string, \"0x2800\". The commands take an item as a number, as \"0x2800\", or as the mod's own \"author.mod:thing\"."
    },
    {
      "name": "settings_scope",
      "since": 1,
      "description": "A setting is world or client. A world setting is part of the town. A friend visit compares it, and a visitor lent the mod runs the host's value. A client setting is the player's own. It is never compared and never sent, and on a visit each player runs their own value. A client setting may decide only what its own player sees or hears: a line, a question, a display choice. It may not decide what the town gets or gives up. The game checks this where it can. In an event that read a client setting with settings.get, a command that changes the town is refused with the code command-client-setting. Those commands are the values of this rule. The check covers one event. A value kept in a variable, in store or in a timer's data and used in a later event is not caught, and neither is a value passed through remote.call. timer.after is not refused after a client setting was read, because a timer that only shows its player a line later is a proper use. Those cases are the modder's to avoid. Their failure is silent: the host's town gets what the host's value says, while a visitor's copy of the mod runs the visitor's value and can show a line that does not match.",
      "values": [
        "send_letter",
        "give_item",
        "take_item",
        "take_bells",
        "set_weather"
      ]
    },
    {
      "name": "optional_depends_order",
      "since": 1,
      "description": "Load order with optional dependencies. A present optional dependency loads before the mod that names it, exactly as a needed one does. An absent one changes nothing. Present means installed, switched on, loading and inside the range. A mod whose optional dependency is outside the range still loads, and that dependency counts as absent for it."
    },
    {
      "name": "optional_depends_cycle",
      "since": 1,
      "description": "A cycle through an optional dependency never stops a mod from loading. When every mod left to place waits for another, the earliest of them in the player's order whose needed dependencies are all placed loads next. It loads before the optional dependencies it was waiting for, and they load after it. Such a dependency is still present. remote.version and remote.call work in events. Only the promise that it loads first is dropped for that one mod, so its main chunk must not count on the dependency. A cycle made only of needed dependencies is still refused."
    }
  ],
  "files": [
    {
      "name": "shops",
      "since": 1,
      "manifest_key": "content.shops",
      "format": "json",
      "title": "shops.json",
      "guides": [
        {
          "path": "/modding/guides/shops/#file",
          "title": "One file, every shop"
        },
        {
          "path": "/modding/guides/shops/#when",
          "title": "When a block applies"
        },
        {
          "path": "/modding/guides/shops/#table",
          "title": "What each shop has"
        }
      ],
      "error_areas": [
        "shops"
      ],
      "limits": [
        "shops.blocks",
        "shops.stock",
        "nook.stock",
        "visitors.stock",
        "shops.lines",
        "shops.name_chars",
        "shops.line_chars",
        "shops.line_newlines",
        "shops.price_max",
        "shops.percent_max"
      ],
      "schema_file": "shops.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "required": [
          "shops"
        ],
        "additionalProperties": false,
        "$defs": {
          "block": {
            "type": "object",
            "additionalProperties": false,
            "minProperties": 1,
            "not": {
              "required": [
                "when"
              ],
              "maxProperties": 1,
              "description": "A block needs at least one field besides \"when\"."
            },
            "description": "One change to a shop. It needs at least one field besides \"when\".",
            "properties": {
              "when": {
                "$ref": "#/$defs/when"
              },
              "open": {
                "type": "boolean",
                "description": "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."
              },
              "own_goods": {
                "type": "boolean",
                "description": "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."
              },
              "goods": {
                "type": "array",
                "minItems": 1,
                "maxItems": 16,
                "description": "The goods. Each stands in a spot of its own kind. The shop table gives each shop's most goods in a block.",
                "items": {
                  "type": "object",
                  "required": [
                    "item"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "item": {
                      "type": "string",
                      "description": "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.",
                      "anyOf": [
                        {
                          "pattern": "^0x[0-9a-fA-F]{4}$"
                        },
                        {
                          "pattern": "^([a-z0-9][a-z0-9-]{0,31}\\.[a-z0-9][a-z0-9-]{0,47}):([a-z0-9][a-z0-9-]{0,31})$"
                        }
                      ]
                    },
                    "price": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 99999,
                      "description": "The price in Bells. Leave it out for the shop's own price."
                    },
                    "when": {
                      "$ref": "#/$defs/when"
                    }
                  }
                }
              },
              "price_percent": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000,
                "description": "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."
              },
              "buy_back_percent": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000,
                "description": "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."
              },
              "services": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 99999,
                  "description": "The service's price in Bells, 1 to 99999."
                },
                "description": "A service's price in Bells, by the service's name in the shop table (a haircut, a design, a dream, a fortune)."
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40,
                "pattern": "^[^\\n]*$",
                "description": "The shop's name where the game shows it: the flower shop's door sign while the shop is shut. One line."
              },
              "lines": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160,
                      "description": "1 to 160 characters, at most 3 line breaks."
                    },
                    {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 8,
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160,
                        "description": "1 to 160 characters, at most 3 line breaks."
                      }
                    }
                  ],
                  "description": "One line, or a list of 1 to 8 lines the keeper picks from."
                },
                "description": "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."
              }
            }
          },
          "when": {
            "type": "object",
            "additionalProperties": false,
            "minProperties": 1,
            "description": "When the block or the good applies: while every key here holds. Leave it out for always.",
            "properties": {
              "hours": {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false,
                "properties": {
                  "from": {
                    "type": "string",
                    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
                    "description": "From this time, on a 24-hour clock."
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
                    "description": "Up to this time, on a 24-hour clock. It may be past midnight."
                  }
                },
                "description": "HH:MM to HH:MM. From and to must differ."
              },
              "time": {
                "enum": [
                  "morning",
                  "day",
                  "evening",
                  "night"
                ],
                "description": "The game's four times of day: morning 5 to 12, day 12 to 17, evening 17 to midnight, night midnight to 5."
              },
              "season": {
                "enum": [
                  "spring",
                  "summer",
                  "fall",
                  "winter"
                ],
                "description": "Spring is March to May, summer June to August, fall September to November, winter December to February."
              },
              "weather": {
                "enum": [
                  "clear",
                  "rain",
                  "snow"
                ],
                "description": "Cherry blossom and falling leaves count as clear."
              },
              "weekday": {
                "type": "array",
                "minItems": 1,
                "maxItems": 7,
                "uniqueItems": true,
                "items": {
                  "enum": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday",
                    "saturday",
                    "sunday"
                  ],
                  "description": "A day of the week, monday to sunday, in lowercase."
                },
                "description": "Only on these days of the week."
              },
              "month": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "uniqueItems": true,
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12,
                  "description": "A month, 1 (January) to 12."
                },
                "description": "Only in these months, 1 (January) to 12."
              },
              "setting": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,31}$",
                "description": "The name of one of this mod's settings of type bool with scope world. Holds while it is on."
              }
            }
          }
        },
        "properties": {
          "$schema": {
            "type": "string"
          },
          "shops": {
            "type": "object",
            "minProperties": 1,
            "additionalProperties": false,
            "properties": {
              "nook": {
                "description": "Nook's store: open, own_goods, goods, price_percent, buy_back_percent, at most 16 goods in a block.",
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/$defs/block"
                      },
                      {
                        "properties": {
                          "goods": {
                            "maxItems": 16
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/$defs/block"
                        },
                        {
                          "properties": {
                            "goods": {
                              "maxItems": 16
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              },
              "flower": {
                "description": "The flower shop: open, own_goods, goods, price_percent, name, lines, at most 6 goods in a block. Line slots: greeting, stock.",
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/$defs/block"
                      },
                      {
                        "properties": {
                          "goods": {
                            "maxItems": 6
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/$defs/block"
                        },
                        {
                          "properties": {
                            "goods": {
                              "maxItems": 6
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              },
              "redd": {
                "description": "Crazy Redd: own_goods, goods, price_percent, at most 6 goods in a block.",
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/$defs/block"
                      },
                      {
                        "properties": {
                          "goods": {
                            "maxItems": 6
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/$defs/block"
                        },
                        {
                          "properties": {
                            "goods": {
                              "maxItems": 6
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              },
              "saharah": {
                "description": "Saharah: own_goods, goods, price_percent, at most 6 goods in a block.",
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/$defs/block"
                      },
                      {
                        "properties": {
                          "goods": {
                            "maxItems": 6
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/$defs/block"
                        },
                        {
                          "properties": {
                            "goods": {
                              "maxItems": 6
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              },
              "fireworks": {
                "description": "The fireworks stall: own_goods, goods, price_percent, at most 6 goods in a block.",
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/$defs/block"
                      },
                      {
                        "properties": {
                          "goods": {
                            "maxItems": 6
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "allOf": [
                        {
                          "$ref": "#/$defs/block"
                        },
                        {
                          "properties": {
                            "goods": {
                              "maxItems": 6
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              },
              "able": {
                "description": "Able Sisters: services. Services: design.",
                "anyOf": [
                  {
                    "$ref": "#/$defs/block"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "$ref": "#/$defs/block"
                    }
                  }
                ]
              },
              "barber": {
                "description": "The barber shop: open, services. Services: haircut.",
                "anyOf": [
                  {
                    "$ref": "#/$defs/block"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "$ref": "#/$defs/block"
                    }
                  }
                ]
              },
              "dream": {
                "description": "The Dream Suite: services. Services: dream.",
                "anyOf": [
                  {
                    "$ref": "#/$defs/block"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "$ref": "#/$defs/block"
                    }
                  }
                ]
              },
              "katrina": {
                "description": "Katrina: services. Services: fortune.",
                "anyOf": [
                  {
                    "$ref": "#/$defs/block"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "items": {
                      "$ref": "#/$defs/block"
                    }
                  }
                ]
              }
            },
            "description": "The shops this file changes, by id. Each takes one block or a list of blocks."
          }
        }
      },
      "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
              }
            ]
          }
        }
      },
      "shop_table": [
        {
          "id": "nook",
          "words": "Nook's store",
          "title": "Nook's store",
          "goods_limit": "nook.stock",
          "fields": [
            "when",
            "open",
            "own_goods",
            "goods",
            "price_percent",
            "buy_back_percent"
          ],
          "spots": "Spots by kind (furniture, stationery, clothing, carpets, wallpaper, tools, umbrellas, paint, saplings, flower bags), more in a bigger store. A new set of goods is picked each day when a block lists more than the spots.",
          "opens": "open: true opens it when it is shut for the night, but not before its morning opening, on a renovation day or in a sale's hours. open: false shuts it."
        },
        {
          "id": "flower",
          "words": "the flower shop",
          "title": "The flower shop",
          "goods_limit": "shops.stock",
          "fields": [
            "when",
            "open",
            "own_goods",
            "goods",
            "price_percent",
            "name",
            "lines"
          ],
          "lines": [
            "greeting",
            "stock"
          ],
          "spots": "Six spots on the benches, one kind.",
          "opens": "open: true opens it when the clock has it shut (2 AM to 7 AM), but not while its keeper is out on her Sunday round. open: false shuts it, with its name on the door sign."
        },
        {
          "id": "redd",
          "words": "Crazy Redd's tent",
          "title": "Crazy Redd",
          "goods_limit": "visitors.stock",
          "fields": [
            "when",
            "own_goods",
            "goods",
            "price_percent"
          ],
          "spots": "Three furniture spots, set out each time the tent is entered while he is in town."
        },
        {
          "id": "saharah",
          "words": "Saharah",
          "title": "Saharah",
          "goods_limit": "visitors.stock",
          "fields": [
            "when",
            "own_goods",
            "goods",
            "price_percent"
          ],
          "spots": "One carpet, the one she offers for yours when the player talks to her. price_percent is her fee."
        },
        {
          "id": "fireworks",
          "words": "the fireworks stall",
          "title": "The fireworks stall",
          "goods_limit": "visitors.stock",
          "fields": [
            "when",
            "own_goods",
            "goods",
            "price_percent"
          ],
          "spots": "Its goods for the night: fans, pinwheels and balloons, set out when the stall is set up."
        },
        {
          "id": "able",
          "words": "Able Sisters",
          "title": "Able Sisters",
          "fields": [
            "when",
            "services"
          ],
          "services": [
            "design"
          ],
          "spots": "No goods. Mabel sells one service, a design."
        },
        {
          "id": "barber",
          "words": "the barber shop",
          "title": "The barber shop",
          "fields": [
            "when",
            "open",
            "services"
          ],
          "services": [
            "haircut"
          ],
          "spots": "No goods. Monique sells one service, a haircut.",
          "opens": "open: true opens it when the clock has it shut (2 AM to 7 AM). open: false shuts it."
        },
        {
          "id": "dream",
          "words": "the Dream Suite",
          "title": "The Dream Suite",
          "fields": [
            "when",
            "services"
          ],
          "services": [
            "dream"
          ],
          "spots": "No goods. Katrina sells one service, a dream visit. The suite keeps no hours, so it has no open."
        },
        {
          "id": "katrina",
          "words": "Katrina's tent",
          "title": "Katrina",
          "fields": [
            "when",
            "services"
          ],
          "services": [
            "fortune"
          ],
          "spots": "No goods. Katrina sells one service, a fortune, on the nights she visits."
        }
      ]
    },
    {
      "name": "messages",
      "since": 1,
      "manifest_key": "content.messages",
      "format": "json",
      "title": "messages file",
      "guides": [
        {
          "path": "/modding/guides/lines/#file",
          "title": "Lines and messages: the messages file"
        }
      ],
      "error_areas": [
        "messages"
      ],
      "limits": [
        "messages.lines",
        "messages.key_bytes",
        "messages.text_bytes"
      ],
      "schema_file": "messages.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "maxProperties": 256,
        "propertyNames": {
          "pattern": "^[a-z0-9_.-]{1,48}$"
        },
        "additionalProperties": {
          "type": "string",
          "minLength": 1,
          "description": "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."
        }
      },
      "example": {
        "gossip1": "Did you hear? The museum got a new fossil!"
      }
    },
    {
      "name": "textures",
      "since": 1,
      "manifest_key": "content.textures",
      "format": "folder",
      "title": "textures folder",
      "guides": [
        {
          "path": "/modding/guides/textures/",
          "title": "Textures"
        }
      ],
      "error_areas": [
        "textures"
      ],
      "limits": [
        "textures.label_chars",
        "textures.png_side",
        "textures.png_decoded_bytes",
        "textures.png_decoded_bytes_phone",
        "textures.dds_bytes",
        "textures.dds_bytes_phone"
      ],
      "description": "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/).",
      "naming": [
        {
          "pattern": "tex1_<w>x<h>_<data>_<fmt>.dds",
          "description": "A texture without a palette."
        },
        {
          "pattern": "tex1_<w>x<h>_<data>_<tlut>_<fmt>.dds",
          "description": "A palette (C4, C8) texture. <tlut> is the palette's hash."
        },
        {
          "pattern": "tex1_<w>x<h>_<data>_$_<fmt>.dds",
          "description": "A palette texture under any palette."
        },
        {
          "pattern": "tex1_<w>x<h>_<data>[_<tlut>|_$]_<fmt>.png",
          "description": "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."
        },
        {
          "pattern": "<label>_tex1_<w>x<h>_<data>[_<tlut>|_$]_<fmt>.dds",
          "description": "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."
        }
      ],
      "name_regex": "^([a-z0-9-]{1,40}_)?tex1_[0-9]+x[0-9]+_[0-9a-fA-F]{16}(_([0-9a-fA-F]{16}|\\$))?_[0-9]+\\.([dD][dD][sS]|[pP][nN][gG])$",
      "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.",
      "example": "textures/tex1_32x32_8b5a1b4a83d4d7c7_14.dds"
    },
    {
      "name": "scripts",
      "since": 1,
      "manifest_key": "scripts.main",
      "format": "lua",
      "title": "main.lua",
      "guides": [
        {
          "path": "/modding/guides/scripts/",
          "title": "Scripts (Lua)"
        }
      ],
      "error_areas": [
        "scripts",
        "script"
      ],
      "limits": [
        "file.lua_bytes",
        "lua.memory_bytes",
        "lua.budget",
        "lua.deadline_ms",
        "lua.event_deadline_ms",
        "lua.handlers_per_event"
      ],
      "description": "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.",
      "example": "on(\"villager_talked\", function(e) return { place = \"before\", line = \"Hi \" .. e.villager.name .. \"!\" } end)"
    },
    {
      "name": "items",
      "since": 1,
      "manifest_key": "content.items",
      "format": "json",
      "title": "items.json",
      "guides": [
        {
          "path": "/modding/guides/mod-items/",
          "title": "New items"
        },
        {
          "path": "/modding/guides/mod-items/#look",
          "title": "New items: its own look"
        }
      ],
      "error_areas": [
        "items"
      ],
      "limits": [
        "items.per_mod",
        "items.total",
        "items.price_max",
        "items.renames",
        "items.texture_files"
      ],
      "schema_file": "mod-items.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "required": [
          "items"
        ],
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "base"
              ],
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{0,31}$",
                  "description": "The item's own id. Its full id is <mod id>:<id>."
                },
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9 '.,!&-]{0,14}[A-Za-z0-9'.,!&-])?$",
                  "description": "1 to 16 characters: letters, digits, space and ' . , ! & -. It starts with a letter or digit and does not end with a space."
                },
                "base": {
                  "type": "string",
                  "pattern": "^0x[0-9a-fA-F]{4}$",
                  "description": "A south-facing furniture id: 0x1000 to 0x1FFC or 0x3000 to 0x33C4, a multiple of 4."
                },
                "price": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 99999,
                  "description": "The price in Bells. Leave it out for the base piece's price."
                },
                "textures": {
                  "type": "string",
                  "minLength": 1,
                  "description": "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."
                }
              }
            },
            "description": "The new items. Each one stands on a base piece of the game's own furniture."
          }
        }
      },
      "example": {
        "items": [
          {
            "id": "cup",
            "name": "Tea cup",
            "base": "0x1000",
            "price": 800,
            "textures": "items/cup/"
          }
        ]
      }
    },
    {
      "name": "mod-items sidecar",
      "since": 1,
      "manifest_key": "none (engine-owned)",
      "format": "json",
      "title": "mod-items.json (the game's)",
      "guides": [
        {
          "path": "/modding/guides/mod-items/#save",
          "title": "New items: how it is kept"
        }
      ],
      "error_areas": [],
      "limits": [],
      "description": "/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."
    },
    {
      "name": "letters",
      "since": 1,
      "manifest_key": "content.letters",
      "format": "json",
      "title": "letters.json",
      "guides": [
        {
          "path": "/modding/guides/more-targets/#letters",
          "title": "Letters"
        }
      ],
      "error_areas": [
        "letters"
      ],
      "limits": [
        "letters.per_file",
        "letters.header_chars",
        "letters.body_chars",
        "letters.body_lines",
        "letters.footer_chars",
        "letters.sender_chars",
        "commands.papers",
        "commands.letters_per_day"
      ],
      "schema_file": "letters.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "required": [
          "letters"
        ],
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "type": "string"
          },
          "letters": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "object",
              "required": [
                "id",
                "header",
                "body",
                "footer"
              ],
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9_.-]{1,48}$",
                  "description": "Unique in the file."
                },
                "header": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32,
                  "description": "1 to 24 characters besides at most one {player}, where the name goes. No line break. Plain text: printable ASCII, no { or }."
                },
                "body": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 192,
                  "description": "1 to 192 characters on at most 6 lines. Plain text: printable ASCII, no { or }."
                },
                "footer": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32,
                  "description": "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."
                },
                "sender": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 8,
                  "description": "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 }."
                },
                "item": {
                  "type": "string",
                  "pattern": "^0x[0-9a-fA-F]{4}$",
                  "description": "A present, optional."
                },
                "paper": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 63,
                  "description": "The stationery, default 0."
                }
              }
            },
            "description": "The letter templates. A script mails one with cmd.send_letter, and a calendar day can name one."
          }
        }
      },
      "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
          }
        ]
      }
    },
    {
      "name": "calendar",
      "since": 1,
      "manifest_key": "content.calendar",
      "format": "json",
      "title": "calendar.json",
      "guides": [
        {
          "path": "/modding/guides/more-targets/#calendar",
          "title": "Calendar days"
        }
      ],
      "error_areas": [
        "calendar"
      ],
      "limits": [
        "calendar.per_file",
        "calendar.board_per_day",
        "letters.body_chars",
        "letters.body_lines",
        "commands.letters_per_day"
      ],
      "schema_file": "calendar.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "required": [
          "days"
        ],
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "type": "string"
          },
          "days": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "type": "object",
              "required": [
                "id",
                "date"
              ],
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9_.-]{1,48}$",
                  "description": "Unique in the file."
                },
                "date": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "month"
                  ],
                  "description": "{month, day} (February 29 works) or {month, week 1 to 4 or \"last\", weekday 0 Sunday to 6}.",
                  "properties": {
                    "month": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12,
                      "description": "1 for January to 12 for December."
                    },
                    "day": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 31,
                      "description": "The day of the month. Not with week or weekday."
                    },
                    "week": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        },
                        {
                          "enum": [
                            "last"
                          ]
                        }
                      ],
                      "description": "The week of the month: 1 to 4, or \"last\". Needs weekday."
                    },
                    "weekday": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 6,
                      "description": "0 for Sunday to 6 for Saturday. Needs week."
                    }
                  }
                },
                "board": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 192,
                  "description": "A bulletin board notice: 1 to 192 characters on at most 6 lines. Plain text: printable ASCII, no { or }. Needs scope world."
                },
                "letter": {
                  "type": "string",
                  "pattern": "^[a-z0-9_.-]{1,48}$",
                  "description": "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."
                }
              }
            },
            "description": "The dated days."
          }
        }
      },
      "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"
          }
        ]
      }
    },
    {
      "name": "talk",
      "since": 1,
      "manifest_key": "content.talk",
      "format": "json",
      "title": "talk.json",
      "guides": [
        {
          "path": "/modding/guides/more-targets/#talk",
          "title": "Villager lines"
        }
      ],
      "error_areas": [
        "talk"
      ],
      "limits": [
        "talk.pools",
        "talk.lines_per_pool",
        "talk.line_chars",
        "talk.line_newlines",
        "talk.pages",
        "talk.villager_chars"
      ],
      "schema_file": "talk.schema.json",
      "description": "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.",
      "schema": {
        "type": "object",
        "required": [
          "pools"
        ],
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "type": "string"
          },
          "pools": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "object",
              "required": [
                "place",
                "lines"
              ],
              "additionalProperties": false,
              "properties": {
                "place": {
                  "enum": [
                    "before",
                    "hello",
                    "topic",
                    "after",
                    "conversation"
                  ],
                  "description": "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."
                },
                "topics": {
                  "anyOf": [
                    {
                      "const": "any"
                    },
                    {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 6,
                      "uniqueItems": true,
                      "items": {
                        "enum": [
                          "small_talk",
                          "trade",
                          "letter",
                          "memory",
                          "hint",
                          "news"
                        ]
                      }
                    }
                  ],
                  "description": "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."
                },
                "personality": {
                  "enum": [
                    "normal",
                    "peppy",
                    "lazy",
                    "jock",
                    "cranky",
                    "snooty"
                  ],
                  "description": "Not with villager."
                },
                "villager": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 8,
                  "description": "A villager's name, any case. Not with personality."
                },
                "season": {
                  "enum": [
                    "spring",
                    "summer",
                    "fall",
                    "winter"
                  ],
                  "description": "Only in this season: spring is March to May, summer June to August, fall September to November, winter December to February."
                },
                "time": {
                  "enum": [
                    "morning",
                    "day",
                    "evening",
                    "night"
                  ],
                  "description": "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."
                },
                "weather": {
                  "enum": [
                    "clear",
                    "rain",
                    "snow"
                  ],
                  "description": "Only in this weather. Cherry blossom and falling leaves count as clear."
                },
                "day": {
                  "type": "string",
                  "pattern": "^[a-z0-9_.-]{1,48}$",
                  "description": "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."
                },
                "chance": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100,
                  "description": "Talks in 100 where this pool's line is said, when the pool fits. Default 100: every talk it fits."
                },
                "lines": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 32,
                  "items": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160,
                        "description": "A page: 1 to 160 characters, at most 3 line breaks."
                      },
                      {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 8,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 160,
                          "description": "A page: 1 to 160 characters, at most 3 line breaks."
                        },
                        "description": "A line of 1 to 8 pages, each starting on a clean window."
                      }
                    ],
                    "description": "A villager line: one page, or a list of 1 to 8 pages."
                  },
                  "description": "The pool's lines. The game picks one each time."
                }
              }
            },
            "description": "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."
          }
        }
      },
      "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."
              ]
            ]
          }
        ]
      }
    }
  ],
  "globals": [
    {
      "name": "on",
      "kind": "function",
      "since": 1,
      "description": "Registers a handler for an event. Call it while the mod's own script loads, not from inside a handler and not from a function another mod calls with remote.call. The event must be in mod.json's scripts.events. At most 16 handlers per event. A handler gets one table, e, holding the event's fields.",
      "params": [
        {
          "name": "event",
          "type": "string",
          "description": "An event name."
        },
        {
          "name": "fn",
          "type": "function",
          "description": "Called with one table, e, holding the event's fields."
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "log",
      "kind": "function",
      "since": 1,
      "description": "Writes a line to the Mods tab's Mod log and the browser console as \"[Mods] <id>: ...\". Arguments are joined with spaces. A line is cut at 299 bytes. At most 20 lines per event and 500 per session. A refused cmd.* or timer.* call writes a line of its own, and those lines count toward the same two limits. A script error or stop is written to the Mod log too, with a Lua traceback, whatever the limits. The log keeps the newest 400 lines of all mods. When it is full, the oldest line of the mod with the most lines goes first, so one mod cannot push out another mod's lines.",
      "params": [
        {
          "name": "...",
          "type": "any",
          "description": "Values to print."
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "message",
      "kind": "function",
      "since": 1,
      "description": "A line from a messages file. \"key\" reads this mod's own line, and \"author.mod:key\" reads another mod's. Returns nil when there is no such line.",
      "params": [
        {
          "name": "key",
          "type": "string",
          "description": "\"key\" or \"author.mod:key\"."
        }
      ],
      "returns": {
        "type": "string|nil"
      }
    },
    {
      "name": "game",
      "kind": "table",
      "since": 1,
      "description": "Read-only facts about the game.",
      "members": [
        {
          "name": "time",
          "kind": "function",
          "since": 1,
          "description": "The game's clock now.",
          "params": [],
          "returns": {
            "type": "table",
            "fields": [
              {
                "name": "year",
                "type": "integer"
              },
              {
                "name": "month",
                "type": "integer",
                "description": "1 to 12."
              },
              {
                "name": "day",
                "type": "integer",
                "description": "1 to 31."
              },
              {
                "name": "hour",
                "type": "integer",
                "description": "0 to 23."
              },
              {
                "name": "minute",
                "type": "integer",
                "description": "0 to 59."
              },
              {
                "name": "weekday",
                "type": "integer",
                "description": "0 (Sunday) to 6."
              }
            ]
          }
        },
        {
          "name": "day_number",
          "kind": "function",
          "since": 1,
          "description": "The game clock's day as one whole number: days since 2000-01-01. It goes up by one each game day, so it tells one day from the next without date maths.",
          "params": [],
          "returns": {
            "type": "integer"
          }
        },
        {
          "name": "pockets",
          "kind": "function",
          "since": 1,
          "description": "The items the player holds, in slot order: { { slot, item, mod_item }, ... }. Only held items are listed, so an empty slot has no entry. Returns {} when the pockets are empty or before a town is loaded.",
          "params": [],
          "returns": {
            "type": "table",
            "items": {
              "name": "pocket_item",
              "type": "table",
              "fields": [
                {
                  "name": "slot",
                  "type": "integer",
                  "description": "1 to 15."
                },
                {
                  "name": "item",
                  "type": "integer",
                  "description": "The item number (items.json). For a mod item, it is the base piece the item stands on."
                },
                {
                  "name": "mod_item",
                  "type": "string|nil",
                  "description": "The full id (\"author.mod:thing\") when the slot holds a mod item, else nil."
                }
              ]
            }
          }
        },
        {
          "name": "bells",
          "kind": "function",
          "since": 1,
          "description": "The wallet, or nil before a town is loaded.",
          "params": [],
          "returns": {
            "type": "integer|nil"
          }
        },
        {
          "name": "town",
          "kind": "function",
          "since": 1,
          "description": "The town: { name, id, year, month, day, hour, minute, weekday, season }, or nil before a town is loaded. season is spring, summer, fall or winter, the word talk pools and shops use.",
          "params": [],
          "returns": {
            "type": "table|nil",
            "fields": [
              {
                "name": "name",
                "type": "string"
              },
              {
                "name": "id",
                "type": "integer"
              },
              {
                "name": "year",
                "type": "integer"
              },
              {
                "name": "month",
                "type": "integer"
              },
              {
                "name": "day",
                "type": "integer"
              },
              {
                "name": "hour",
                "type": "integer"
              },
              {
                "name": "minute",
                "type": "integer"
              },
              {
                "name": "weekday",
                "type": "integer"
              },
              {
                "name": "season",
                "type": "string|nil",
                "description": "spring, summer, fall or winter. nil when the game cannot tell."
              }
            ]
          }
        },
        {
          "name": "villagers",
          "kind": "function",
          "since": 1,
          "description": "The town's villagers: { { id, name, species, personality }, ... }. Returns {} before a town is loaded.",
          "params": [],
          "returns": {
            "type": "table",
            "items": {
              "name": "villager",
              "type": "table",
              "description": "One villager of the town.",
              "fields": [
                {
                  "name": "id",
                  "type": "integer",
                  "description": "The villager's id (villagers.json)."
                },
                {
                  "name": "name",
                  "type": "string",
                  "description": "The villager's name."
                },
                {
                  "name": "species",
                  "type": "string|nil",
                  "description": "cat, dog and so on (villagers.json). nil when the game cannot tell."
                },
                {
                  "name": "personality",
                  "type": "string|nil",
                  "description": "normal, peppy, lazy, jock, cranky or snooty. nil when the game cannot tell."
                }
              ]
            }
          }
        },
        {
          "name": "player",
          "kind": "function",
          "since": 1,
          "description": "The player playing this game: who they are, where they stand, what they hold and what they are doing, or nil before a town is loaded. A town has up to 4 residents, each playing it from their own save slot. Every call reads the game as it is now, so it is cheap to call from any event, such as button_pressed or timer_fired. On a visit it is the visitor, standing in the host's town. Where the player stands and what they do (every field after id) is nil while the scene is still being built, such as in day_started as the game starts.",
          "params": [],
          "returns": {
            "type": "table|nil",
            "fields": [
              {
                "name": "name",
                "type": "string"
              },
              {
                "name": "id",
                "type": "integer",
                "description": "Stays the same for that resident in that town. It holds the resident's save slot. A new resident who later takes a freed slot can get the same id, and never gets the old resident's store.player data: the game deletes that when a resident is deleted and again when a new one is made in the slot. On a visit it is the visitor's own number, never equal to a resident's."
              },
              {
                "name": "x",
                "type": "number|nil",
                "description": "Where the player stands, east to west, in the game's units: a ground tile is 40 across, and an acre 16 tiles (640). It grows to the east. Inside a building it is the room's own."
              },
              {
                "name": "y",
                "type": "number|nil",
                "description": "The player's height in the same units. It changes on a cliff or a slope."
              },
              {
                "name": "z",
                "type": "number|nil",
                "description": "Where the player stands, north to south, in the same units. It grows to the south, down the screen."
              },
              {
                "name": "angle",
                "type": "integer|nil",
                "description": "Which way the player faces, in whole degrees from 0 to 359: 0 faces south (toward the camera), 90 east, 180 north and 270 west."
              },
              {
                "name": "acre",
                "type": "table|nil",
                "description": "The town acre the player stands in, as the map counts them. nil in any scene but the town.",
                "fields": [
                  {
                    "name": "x",
                    "type": "integer",
                    "description": "The acre's column, 1 to 5 from west to east. 0 and 6 are the town's edges."
                  },
                  {
                    "name": "z",
                    "type": "integer",
                    "description": "The acre's row, 1 to 6 from north to south: 1 is the row with the train station (A on the map), 6 the beach row (F). 0 is the edge above, and 7 and up are the sea and the island."
                  }
                ]
              },
              {
                "name": "scene",
                "type": "string|nil",
                "description": "The scene's name from scenes.json, like \"town\", as scene_entered names it. nil for a scene with no published name."
              },
              {
                "name": "tool",
                "type": "string|nil",
                "description": "The tool in the player's hand: \"axe\", \"net\", \"rod\", \"shovel\" or \"umbrella\". A golden tool counts as its kind. nil when the hand is empty or holds something else, such as a balloon, a pinwheel or a fan."
              },
              {
                "name": "state",
                "type": "string|nil",
                "description": "What the player is doing, in one word: \"standing\", \"walking\", \"running\", \"sitting\" (on a chair, a sofa, a rock or a stump), \"lying\" (on a bed), \"wading\" (walking over into the next acre while the screen scrolls; the town has no water a player can wade into) or \"busy\" (anything else, such as a tool swing, picking something up, a talk, a door or a cutscene). The list may grow: treat a word you do not know as \"busy\"."
              }
            ]
          }
        },
        {
          "name": "calendar_today",
          "kind": "function",
          "since": 1,
          "description": "The ids of this mod's own calendar days that fall on the town's date today, in file order. Returns {} when there are none, or before a town is loaded. Only the calling mod's days are listed.",
          "params": [],
          "returns": {
            "type": "table",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "name": "weather",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "The weather where the player is now: { kind, intensity }, or nil before a town is loaded. kind is clear, rain or snow, the words shops and talk pools use: cherry blossom petals and falling leaves count as clear. Indoors it is the weather outside, on the island it is the island's, and on a visit it is the weather of the town being visited. Reading it changes nothing and needs no permission.",
          "params": [],
          "returns": {
            "type": "table|nil",
            "fields": [
              {
                "name": "kind",
                "type": "string",
                "description": "clear, rain or snow."
              },
              {
                "name": "intensity",
                "type": "string",
                "description": "light, normal or heavy for rain and snow. none when clear."
              }
            ]
          }
        },
        {
          "name": "place",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Where the player is now: { scene, name, island, acre, acre_x, acre_z, unit_x, unit_z }, or nil before a town is loaded. scene and name are the scene, as scene_entered gives them. The acre fields are there only outdoors in the town or on the island, standing in an acre the town map shows. It names the acre and the square inside it, one of the 16 by 16 squares of an acre, the way the town map does; game.player() gives the exact position. Both are only ever the player's own: a mod never sees where another player is. On a visit it is the place in the town being visited, the same town game.town() names. Reading it changes nothing and needs no permission.",
          "params": [],
          "returns": {
            "type": "table|nil",
            "fields": [
              {
                "name": "scene",
                "type": "integer",
                "description": "The scene number (scenes.json)."
              },
              {
                "name": "name",
                "type": "string|nil",
                "description": "The scene's name from scenes.json, like \"town\". nil for a scene with no published name."
              },
              {
                "name": "island",
                "type": "boolean",
                "description": "true on the island, outdoors or in a cottage."
              },
              {
                "name": "acre",
                "type": "string|nil",
                "description": "The acre as the town map labels it: the row letter and the column, \"A-1\" to \"F-5\". On the island \"island-1\" or \"island-2\", from the left. nil indoors."
              },
              {
                "name": "acre_x",
                "type": "integer|nil",
                "description": "The acre's column: 1 to 5 in town, 1 or 2 on the island. nil indoors."
              },
              {
                "name": "acre_z",
                "type": "integer|nil",
                "description": "The acre's row: 1 (A) to 6 (F). nil on the island and indoors."
              },
              {
                "name": "unit_x",
                "type": "integer|nil",
                "description": "The unit inside the acre, 0 (west) to 15 (east). nil indoors."
              },
              {
                "name": "unit_z",
                "type": "integer|nil",
                "description": "The unit inside the acre, 0 (north) to 15 (south). nil indoors."
              }
            ]
          }
        },
        {
          "name": "input",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "The player's game inputs right now: { a, b, x, y, z, l, r, start, dpad_up, dpad_down, dpad_left, dpad_right, c_up, c_down, c_left, c_right, stick_x, stick_y }. Each button is true while held. The player's game inputs are the controller the game itself reads, so a keyboard key, a controller button and the on-screen touch pad are all the same button here, with the player's own key and button settings applied. A mod never sees which key was typed: the keyboard reaches it only through the buttons it plays, and nothing reaches it while the game's text editor is open (writing a letter or a name, by keyboard or by controller). It is nil while the text editor is open. Use it for a stick or a combination, such as L held while A is pressed; use button_pressed for a single press. It reads the controller when it is called, which in a button event that waited for a busy frame is a frame or two after the press.",
          "params": [],
          "returns": {
            "type": "table|nil",
            "fields": [
              {
                "name": "a",
                "type": "boolean"
              },
              {
                "name": "b",
                "type": "boolean"
              },
              {
                "name": "x",
                "type": "boolean"
              },
              {
                "name": "y",
                "type": "boolean"
              },
              {
                "name": "z",
                "type": "boolean"
              },
              {
                "name": "l",
                "type": "boolean"
              },
              {
                "name": "r",
                "type": "boolean"
              },
              {
                "name": "start",
                "type": "boolean"
              },
              {
                "name": "dpad_up",
                "type": "boolean"
              },
              {
                "name": "dpad_down",
                "type": "boolean"
              },
              {
                "name": "dpad_left",
                "type": "boolean"
              },
              {
                "name": "dpad_right",
                "type": "boolean"
              },
              {
                "name": "c_up",
                "type": "boolean"
              },
              {
                "name": "c_down",
                "type": "boolean"
              },
              {
                "name": "c_left",
                "type": "boolean"
              },
              {
                "name": "c_right",
                "type": "boolean"
              },
              {
                "name": "stick_x",
                "type": "number",
                "description": "The main stick, from -1 (left) to 1 (right). 0 at rest. A keyboard's movement keys tilt it fully."
              },
              {
                "name": "stick_y",
                "type": "number",
                "description": "The main stick, from -1 (down) to 1 (up). 0 at rest."
              }
            ]
          }
        }
      ]
    },
    {
      "name": "store",
      "kind": "table",
      "since": 1,
      "description": "A small saved table per mod, per town. It holds strings, numbers and booleans, up to 8 KB per mod per town. It travels with the town (cloud save, backups, Export with mod data). No town is loaded while the main chunk runs, so get answers nil and set raises an error there. On a visit or in The City it lives in memory only. store.player is this player's part of it. store.client is a separate store per browser. A key cannot start with a control character (a byte under 0x20). Every store.set, store.player.set and store.client.set writes the mod's file in the save folder before it returns. The browser keeps the save folder in IndexedDB at the game's next save sync. That sync happens at a game save, and for the cloud at a mod-data upload at most every 2 minutes. A tab closed before that sync loses the last sets. Daily command counts and the rng counter are written the same way.",
      "members": [
        {
          "name": "get",
          "kind": "function",
          "since": 1,
          "description": "A value this mod saved in this town, or nil. It is nil while the main chunk runs. Integers come back as integers.",
          "params": [
            {
              "name": "key",
              "type": "string"
            }
          ],
          "returns": {
            "type": "string|number|boolean|nil"
          }
        },
        {
          "name": "set",
          "kind": "function",
          "since": 1,
          "description": "Saves a string, number or boolean under a key in this town. nil deletes the key. Keys are up to 64 bytes and strings up to 1024. A set that would take this town's store over 8 KB raises an error and changes nothing. So does a set before a town is loaded, in the main chunk.",
          "params": [
            {
              "name": "key",
              "type": "string"
            },
            {
              "name": "value",
              "type": "string|number|boolean|nil"
            }
          ],
          "returns": {
            "type": "nil"
          }
        },
        {
          "name": "town",
          "kind": "function",
          "since": 1,
          "description": "Which town the store is for now, as an opaque text that changes when the town does (\"v:...\" away from home). nil before a town is loaded. Compare it to reload what you keep in locals when the player moves to another town.",
          "params": [],
          "returns": {
            "type": "string|nil"
          }
        },
        {
          "name": "client",
          "kind": "table",
          "since": 1,
          "description": "The per-browser store. It has the same get, set and limits, with one store per mod per browser whatever town is loaded.",
          "members": [
            {
              "name": "get",
              "kind": "function",
              "since": 1,
              "description": "A value this mod saved in this browser, or nil.",
              "params": [
                {
                  "name": "key",
                  "type": "string"
                }
              ],
              "returns": {
                "type": "string|number|boolean|nil"
              }
            },
            {
              "name": "set",
              "kind": "function",
              "since": 1,
              "description": "Saves a value in this browser. nil deletes it. 8 KB per mod.",
              "params": [
                {
                  "name": "key",
                  "type": "string"
                },
                {
                  "name": "value",
                  "type": "string|number|boolean|nil"
                }
              ],
              "returns": {
                "type": "nil"
              }
            }
          ]
        },
        {
          "name": "player",
          "kind": "table",
          "since": 1,
          "description": "This player's part of the town store. It has the same get and set, per mod, per town, per player (game.player().id). It lives inside the mod's town store and shares its 8 KB. Before a town is loaded, get answers nil and set raises an error. With a town but no player in the game yet, get answers nil and set raises its own error (no player is in the game yet). When a resident is deleted, everything mods saved for them here is deleted too and its room is given back. A new resident in that save slot starts with nothing. On a visit it lives in memory only.",
          "members": [
            {
              "name": "get",
              "kind": "function",
              "since": 1,
              "description": "A value this mod saved for this player in this town, or nil.",
              "params": [
                {
                  "name": "key",
                  "type": "string"
                }
              ],
              "returns": {
                "type": "string|number|boolean|nil"
              }
            },
            {
              "name": "set",
              "kind": "function",
              "since": 1,
              "description": "Saves a value for this player in this town. nil deletes it. The key and value rules are the same as for store.set.",
              "params": [
                {
                  "name": "key",
                  "type": "string"
                },
                {
                  "name": "value",
                  "type": "string|number|boolean|nil"
                }
              ],
              "returns": {
                "type": "nil"
              }
            }
          ]
        }
      ]
    },
    {
      "name": "settings",
      "kind": "table",
      "since": 1,
      "description": "The mod's settings from mod.json \"settings\", as the player set them on the Mods tab. They are read when the game starts.",
      "members": [
        {
          "name": "get",
          "kind": "function",
          "since": 1,
          "description": "A setting's value: the player's, else the default. It is a boolean, an integer or a string. nil for a name the mod does not declare.",
          "params": [
            {
              "name": "name",
              "type": "string"
            }
          ],
          "returns": {
            "type": "boolean|integer|string|nil"
          }
        }
      ]
    },
    {
      "name": "remote",
      "kind": "table",
      "since": 1,
      "description": "Calls between mods. One mod offers named functions and another calls them. Values are deep copies of nil, booleans, numbers, strings and tables of them, within 64 KB, 16 levels, 4096 values and 8 results. The called function runs on the caller's budget and clock, and going over stops the caller. Its commands count toward the caller's per-event limit. Its rng draws from its own counter. A call into a mod that is already running is refused.",
      "members": [
        {
          "name": "add",
          "kind": "function",
          "since": 1,
          "description": "Offers a function to other mods, while the script loads. Names are 1 to 32 of a-z 0-9 _, at most 32 per mod. With mod.json \"exports\", only the names it lists.",
          "params": [
            {
              "name": "name",
              "type": "string"
            },
            {
              "name": "fn",
              "type": "function"
            }
          ],
          "returns": {
            "type": "nil"
          }
        },
        {
          "name": "call",
          "kind": "function",
          "since": 1,
          "description": "Calls a function another running mod offers. Its errors come back as yours, and it keeps running. When the mod is one of this mod's optional_depends and it is absent, nothing is called and nothing is raised: the call returns nil, a message and a code from dependency_codes.",
          "params": [
            {
              "name": "mod",
              "type": "string"
            },
            {
              "name": "name",
              "type": "string"
            },
            {
              "name": "...",
              "type": "any",
              "description": "Copied arguments."
            }
          ],
          "returns": {
            "type": "any"
          }
        },
        {
          "name": "has",
          "kind": "function",
          "since": 1,
          "description": "Whether a running mod offers that function.",
          "params": [
            {
              "name": "mod",
              "type": "string"
            },
            {
              "name": "name",
              "type": "string"
            }
          ],
          "returns": {
            "type": "boolean"
          }
        },
        {
          "name": "version",
          "kind": "function",
          "since": 1,
          "description": "Whether a mod this one names in depends or optional_depends is present, and at what version. Returns its version, such as \"1.2.0\", when it loaded inside the range. Returns nil, a message and a code from dependency_codes when it did not. Ask in an event. In the main chunk an optional dependency that the cycle rule placed after this mod has loaded no script yet.",
          "params": [
            {
              "name": "mod",
              "type": "string"
            }
          ],
          "returns": {
            "type": "string|nil",
            "name": "version",
            "description": "The version, or nil.",
            "more": [
              {
                "name": "message",
                "type": "string|nil"
              },
              {
                "name": "code",
                "type": "DependencyCode|nil"
              }
            ]
          }
        }
      ]
    },
    {
      "name": "cmd",
      "kind": "table",
      "since": 1,
      "description": "The commands. Each queues an effect that the game applies at the end of a frame's update, before the frame is drawn. Each needs its name in mod.json permissions. A call returns the command's id. When it is refused at once, it returns nil, a message and a code (command_codes). In The City every command but set_hat, set_shirt and react is refused at once. On a visit send_letter, give_item, take_item, take_bells, save and set_weather are refused at once. show_line, ask and play_sound still run on a visit. A command refused at once counts against no daily limit. A command queued at home and applied after the player left comes back as a failed command_finished, and its count is given back.",
      "members": [
        {
          "name": "send_letter",
          "kind": "function",
          "since": 1,
          "description": "Queues a letter in the player's own mailbox. The post office keeps it when the mailbox is full. The save holds an ordinary letter, so it loads without the mod.",
          "params": [
            {
              "name": "t",
              "type": "table",
              "description": "{ text, item?, from?, paper? } or { template }. text is 1 to 192 characters fitting 6 lines. item is a number or \"0x\" and four hex digits. from is 1 to 8 characters on one line (\"A friend\" when left out). paper is 0 to 63. template is one of this mod's own letters.json letters, by its id or \"<this mod's id>:<id>\". The header, body, sign-off, present and paper then all come from the template."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "give_item",
          "kind": "function",
          "since": 1,
          "description": "Queues an item into the first empty pocket. With full pockets it comes by letter. Also takes this mod's own new item by its full id (author.mod:thing). A mod item is given with its identity, as a shop sells it, and full pockets refuse it.",
          "params": [
            {
              "name": "item",
              "type": "integer|string|table",
              "description": "An item number, \"0x\" and four hex digits, this mod's \"author.mod:thing\", or { item, from? }."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "show_line",
          "kind": "function",
          "since": 1,
          "description": "Queues a line shown in a message box with no one speaking, like the game's own \"My pockets are full!\", once the player is free. One line or question at a time.",
          "params": [
            {
              "name": "text",
              "type": "string",
              "description": "1 to 400 bytes."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "ask",
          "kind": "function",
          "since": 1,
          "description": "Queues a question with 2 to 4 answers in that same speakerless message box. The pick comes back as a question_answered event.",
          "params": [
            {
              "name": "t",
              "type": "table",
              "description": "{ text, choices }. text is 1 to 120 characters. choices is 2 to 4 answers of 1 to 16 characters."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "take_item",
          "kind": "function",
          "since": 1,
          "description": "Asks the player to hand over items from their pockets. The game shows its own question, which names the item, the count and this mod. The mod's name stands between quotes, and a mod item is named as the pockets show it. A script cannot change that text. On yes the items leave the pockets and command_finished says via taken. On no, or when the window closes with no pick, nothing is taken and command_finished carries command-declined. It is refused with command-not-held when the pockets do not hold that many. Only plain pocket slots count. A wrapped present or an item held for a villager's errand is never taken. Items a command cannot give cannot be taken either (money bags, turnips, tickets, grab bags, fossils). It is refused on a visit and in The City, so a lent mod can never take anything.",
          "params": [
            {
              "name": "t",
              "type": "table",
              "description": "{ item, count? }. item is an item number, \"0x\" and four hex digits, or this mod's own \"author.mod:thing\". count is 1 to 15 and is 1 when left out. An item number matches plain pieces only, never a mod item standing on that piece."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "take_bells",
          "kind": "function",
          "since": 1,
          "description": "Asks the player to pay Bells from their wallet. The game shows its own question, which names the amount and this mod. The mod's name stands between quotes. A script cannot change that text. On yes the Bells leave the wallet and command_finished says via taken. On no, or when the window closes with no pick, nothing is taken and command_finished carries command-declined. It is refused with command-not-held when the wallet holds less than the amount, so the wallet never goes below zero. The bank account and money bags in the pockets are never touched. It is refused on a visit and in The City, so a lent mod can never take anything.",
          "params": [
            {
              "name": "t",
              "type": "table",
              "description": "{ amount }. amount is a whole number of Bells, 1 to 99999."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "save",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Asks the game to save the town, as the Autosave setting does, for a mod such as a save-anywhere button. The game writes the home save only where the player could save at Gyroid: outdoors in their own town, in free control, with no menu, talk or scene change. It writes a settled copy of the town and never changes the town being played, so nothing is lost or doubled however often it runs. command_finished says via saved, or via unchanged when nothing changed since the last save (nothing is written). It is refused with command-indoors inside a house, a shop or any place that is not the town outdoors, command-busy when the player is not in free control, command-dream in a dream, command-not-ready before a save is loaded or while the page is replacing the save, command-too-soon within commands.save_spacing_seconds of any mod's last save, and command-save-failed when the write itself fails. It is refused on a visit and in The City, because a visitor's game does not hold the town it stands in. It does not run what Gyroid's save does on top: a villager's mood and clothes reach the save at the next change of scene or Gyroid save.",
          "params": [],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "set_weather",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Sets the town's weather for the rest of the game day: kind \"clear\", \"rain\" or \"snow\", and for rain or snow an intensity, \"light\" (when left out) or \"heavy\". Heavy rain is a storm, with lightning in June to August, and heavy snow is a blizzard. The game changes it as its own weather changes: the last drops or flakes fall, then the new weather fades in with its light and sound. Villagers, fish, bugs and the rain sound follow it as they follow any rainy or snowy day. The next game day the game rolls its own weather again, and a day after rain or snow can bring a rainbow and a gyroid, as after a real rainy day. A reload the same day keeps it. Only weather the game itself could roll on that date is allowed. Clear is always allowed. Rain is allowed from February 25 to November 15, and snow from November 1 to February 24, but neither on the days the game keeps clear: January 1 to 7, April 1 to 8 (the cherry blossoms), April 20, October 31 and December 31. On an event day the event's weather holds, and the player's first day of work for Nook stays dry. Those are refused with command-weather. command_finished says via set, or via unchanged when the town already has that weather as game.weather() reads it: cherry blossom petals and falling leaves count as clear, so on those days \"clear\" is unchanged and the petals or leaves stay, and putting back the weather a mod read changes nothing. While a change of weather is under way the command waits for it to end. It is refused on a visit and in The City, because the host's game decides the weather and a visitor sees the host's. Needs scope world.",
          "params": [
            {
              "name": "kind",
              "type": "string",
              "description": "\"clear\", \"rain\" or \"snow\"."
            },
            {
              "name": "intensity",
              "type": "string|nil",
              "description": "For rain or snow, \"light\" or \"heavy\". nil is light. For clear, nil or \"none\"."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "play_sound",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Plays one of the game's own sound effects, by its name in sounds.json: a jingle, a menu tick, a page turn. Only this player hears it: in a visit the friend does not, and nothing reaches the town or the save. Every sound in the list is one the game plays once and stops on its own, never a sound that loops. A sound changes nothing, so it does not wait for the player to be free: it plays at the end of the next frame's update, in a talk or a menu too. command_finished says via played. At most commands.sounds_per_event in one event and commands.sounds_per_minute in any minute for each mod (command-event-cap, command-sound-cap). A name not in sounds.json is refused with command-args. While an NES game is being played the game's sound is the NES game's, and a sound is refused with command-no-sound. It is refused in The City.",
          "params": [
            {
              "name": "name",
              "type": "string",
              "description": "A sound's name from sounds.json, like \"item_get\"."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The command's id. When it is refused at once: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "set_shop_goods",
          "kind": "function",
          "since": 1,
          "description": "Sets a shop's goods for the rest of the game day, as one more block after the mod's shops.json blocks for that shop. It is set at the call, with no queue, no daily cap and no command_finished, and applies from the next frame, also when the shop is shut, and is gone when the day changes or the game restarts, so set it again in day_started. nil clears it. Only for a shop with goods in the shop table, and refused when a mod later in the load order changes that shop. Needs scope world.",
          "params": [
            {
              "name": "shop",
              "type": "string",
              "description": "A shop id from the shop table, like \"nook\" or \"redd\"."
            },
            {
              "name": "goods",
              "type": "table|nil",
              "description": "A list of { item, price? } (item: an item number, \"0x\" and four hex digits, or this mod's \"author.mod:thing\"), as many as the shop takes in a block. Or { goods = <that list>, own_goods = false } to make them the whole stock. nil clears."
            }
          ],
          "returns": {
            "type": "boolean|nil",
            "name": "ok",
            "description": "true when it is set. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "set_shop_open",
          "kind": "function",
          "since": 1,
          "description": "Opens or shuts a shop for the rest of the game day, as one more block after the mod's shops.json blocks for that shop. true opens it, false shuts it, nil clears it. It is set at the call, with no queue, no daily cap and no command_finished, and applies from the next frame and is gone when the day changes or the game restarts. Only for a shop with open in the shop table, and refused when a mod later in the load order changes that shop. Needs scope world.",
          "params": [
            {
              "name": "shop",
              "type": "string",
              "description": "A shop id from the shop table, like \"flower\" or \"barber\"."
            },
            {
              "name": "open",
              "type": "boolean|nil",
              "description": "true opens it, false shuts it, nil clears."
            }
          ],
          "returns": {
            "type": "boolean|nil",
            "name": "ok",
            "description": "true when it is set. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "set_hat",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Puts a picture from the mod's own files on the hat of the player playing this game, in place of the design or the shirt the hat wears. nil takes it off. It is set at the call, with no queue, no daily cap and no command_finished, and shows from the next frame. The picture is the path of a PNG inside the mod, like \"hats/stripes.png\": exactly 32 x 32 pixels, every pixel opaque, at most 16 colours, as an Able Sisters design. Keep it outside the mod's textures folder. A mod's hat beats a design on the hat. When two mods set one, the mod later in the load order wins. The hat is this player's own, by who they are and their home town, so a hat set at home stays on when they visit a friend or go to The City. Only this player's own screen draws it: friends on a visit and players in The City see the hat as the game would draw it. Nothing is saved: the hat is gone when the game restarts. A reload of the mod's script in developer mode keeps it. Keep the player's pick in store.player and set it again from scene_entered. Away from home store.player starts empty, so set the hat only when the store holds a pick: a nil there is no reason to take it off. It changes only how the player looks, so it works in a Just you mod, on a visit and in The City.",
          "params": [
            {
              "name": "picture",
              "type": "string|nil",
              "description": "The path of a 32 x 32 PNG in this mod, like \"hats/stripes.png\", or nil to take the hat off."
            }
          ],
          "returns": {
            "type": "boolean|nil",
            "name": "ok",
            "description": "true when it is set. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "set_shirt",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Puts a picture from the mod's own files on the shirt of the player playing this game, in place of the clothes they wear. nil takes it off. It is set at the call, with no queue, no daily cap and no command_finished, and shows from the next frame. The picture is the path of a PNG inside the mod, like \"shirts/stripes.png\": exactly 32 x 32 pixels, every pixel opaque, at most 16 colours, as an Able Sisters design, and it wraps the body and the sleeves the way a design does. Keep it outside the mod's textures folder. It beats the clothes the player wears: putting on other clothes changes what is underneath, and the picture stays on top until the mod takes it off. The hat matches the shirt, as in the game, so with no design or mod hat on the hat it wears the picture too. When two mods set one, the mod later in the load order wins. The shirt is this player's own, by who they are and their home town, so a shirt set at home stays on when they visit a friend or go to The City. Only this player's own screen draws it: friends on a visit and players in The City see the clothes the player wears. Nothing is saved: the shirt is gone when the game restarts, and the save keeps the clothes the player wears. A reload of the mod's script in developer mode keeps it. Keep the player's pick in store.player and set it again from scene_entered. Away from home store.player starts empty, so set the shirt only when the store holds a pick: a nil there is no reason to take it off. It changes only how the player looks, so it works in a Just you mod, on a visit and in The City.",
          "params": [
            {
              "name": "picture",
              "type": "string|nil",
              "description": "The path of a 32 x 32 PNG in this mod, like \"shirts/stripes.png\", or nil to take the shirt off."
            }
          ],
          "returns": {
            "type": "boolean|nil",
            "name": "ok",
            "description": "true when it is set. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        },
        {
          "name": "react",
          "kind": "function",
          "since": 1,
          "since_minor": 1,
          "description": "Plays one of the reactions from the reactions bar on the player's own character: \"hooray\", \"dance\", \"hug\", \"thanks\", \"ouch\", \"trip\", \"spin\", \"hide\" or \"pose\". It is the same reaction the bar plays, so friends on a visit and players in The City see it as they see one from the bar. It is set at the call, with no queue, no daily cap and no command_finished: the game is asked there and then, and the reaction plays from the next frame for at most 1.5 seconds; any move from 0.3 seconds on walks out of it. Only from standing, walking or running, and only while the player is free: refused (command-busy) during a menu, a talk, a message, a door, a cutscene or a scene change, and refused (command-cannot-react) when the game says no, such as while sitting, swinging a tool or holding furniture. One reaction at a time: once one is taken the player is in it, so another call in the same moment, or in a player_acted handler (the player is in the action that just started), is refused with command-busy. React from a later moment, such as a timer. At most commands.reacts_per_minute a minute for each mod (command-minute-cap). It moves only the player's own body and changes nothing saved, so it works in a Just you mod, on a visit and in The City. When it plays, player_acted fires with reacted.",
          "params": [
            {
              "name": "name",
              "type": "string",
              "description": "Which reaction: hooray, dance, hug, thanks, ouch, trip, spin, hide or pose.",
              "values": [
                "hooray",
                "dance",
                "hug",
                "thanks",
                "ouch",
                "trip",
                "spin",
                "hide",
                "pose"
              ]
            }
          ],
          "returns": {
            "type": "boolean|nil",
            "name": "ok",
            "description": "true when the game took it. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "CommandCode|nil",
                "description": "The refusal's stable code (command_codes)."
              }
            ]
          }
        }
      ]
    },
    {
      "name": "rng",
      "kind": "function",
      "since": 1,
      "description": "Seeded random numbers. rng() gives a number in [0,1), rng(n) a whole number 1..n and rng(m, n) a whole number m..n. The seed is the mod, the town, the game day and how many numbers this mod has drawn in this town on this game day. Each call in a day therefore gives another number, and a reload cannot reroll. The count is saved with the town store at the end of a run that drew numbers, and a reload carries on from it. If the tab closes before that write, the same numbers come again, never new ones. A new game day starts the count at 0, and changing the game's clock gives other numbers. The count is kept in memory only away from home, for a lent mod and before a town loads. Inside a remote.call, the called mod draws from its own counter. math.random and math.randomseed are not available. Use rng().",
      "params": [
        {
          "name": "m",
          "type": "integer|nil"
        },
        {
          "name": "n",
          "type": "integer|nil"
        }
      ],
      "returns": {
        "type": "number|integer"
      }
    },
    {
      "name": "timer",
      "kind": "table",
      "since": 1,
      "description": "Timers. A script asks to be called later, and the game sends it a timer_fired event. Time is counted on the game's clock in whole game minutes, so a timer keeps counting while the game is closed and fires at the first chance after it is due. A timer never fires at the title screen or at player select. It fires once play has started (the rule own_game_only). Timers belong to the town. They are kept in this mod's town store, count toward its store.bytes and survive a save and a reload. On a visit, in The City and for a lent mod they live in memory only and are gone when the town changes. Scene changes do not touch them. A mod may have timers.per_mod waiting in one town.",
      "members": [
        {
          "name": "after",
          "kind": "function",
          "since": 1,
          "description": "Sets a timer that fires once, at least that many game minutes from now. It returns the timer's id. When it is refused it returns nil, a message and a code (timer_codes). Setting a timer rewrites the town store, so it is charged to the event's budget like store.set.",
          "params": [
            {
              "name": "minutes",
              "type": "integer",
              "description": "Game minutes to wait, 1 to 10080 (7 days)."
            },
            {
              "name": "name",
              "type": "string",
              "description": "What the timer is for, 1 to 40 bytes of letters, digits, _, - and . only. It comes back in timer_fired."
            },
            {
              "name": "data",
              "type": "string|number|boolean|nil",
              "description": "A value handed back in timer_fired. Text is up to 240 bytes with no zero byte. Empty text comes back as nil, like every empty event text."
            }
          ],
          "returns": {
            "type": "integer|nil",
            "description": "The timer's id, a whole number that is never reused in this town. When it is refused: nil, then a message and a code.",
            "more": [
              {
                "name": "message",
                "type": "string|nil",
                "description": "Why it was refused, in words."
              },
              {
                "name": "code",
                "type": "TimerCode|nil",
                "description": "The refusal's stable code (timer_codes)."
              }
            ]
          }
        },
        {
          "name": "cancel",
          "kind": "function",
          "since": 1,
          "description": "Cancels a waiting timer of this mod in this town. It answers true when there was one. A timer that already fired, or an id from another town, answers false.",
          "params": [
            {
              "name": "id",
              "type": "integer",
              "description": "The id timer.after returned."
            }
          ],
          "returns": {
            "type": "boolean"
          }
        }
      ]
    }
  ],
  "sandbox": {
    "since": 1,
    "description": "Each mod runs in its own Lua 5.4 state with only these standard libraries. It takes source text only, no bytecode. The libraries are read-only. Assigning to string.<name>, rawset on a library or setmetatable on a library raises \"string.<name> is read-only\". getmetatable of a library or a string is the string \"locked\". The built-in globals (the base functions, the libraries, on, log, message, game, store) cannot be assigned, set to nil or rawset. A local may shadow one, and a mod's own globals are writable as usual. pairs(_G) lists only the mod's own globals. Work the instruction count cannot see is charged to the budget. That covers patterns (per step, and per 16 bytes of a [...] set or of a gsub replacement), comparing long strings and allocations. The run's clock is read every 100 instructions, and a run past its deadline stops. A weak-keyed table (__mode \"k\" without \"v\") keeps its keys, because weak-keyed tables made one garbage collection cost the square of their size. Weak values work as usual.",
    "libraries": [
      {
        "name": "base",
        "since": 1,
        "description": "Lua's base functions, without the removed ones below. pcall, xpcall and setmetatable are wrapped."
      },
      {
        "name": "string",
        "since": 1,
        "description": "Without string.dump. Pattern matching is charged against the budget, and string.pack, packsize and unpack per 4 bytes of their format. Read-only."
      },
      {
        "name": "table",
        "since": 1,
        "description": "insert, remove, sort, concat, move and unpack are charged per element. insert, remove, sort and concat refuse a table with a __len metamethod. Read-only."
      },
      {
        "name": "math",
        "since": 1,
        "description": "The math library without random and randomseed (see removed). Use rng(). Read-only."
      },
      {
        "name": "utf8",
        "since": 1,
        "description": "codepoint, len and offset are charged per byte. Read-only."
      },
      {
        "name": "coroutine",
        "since": 1,
        "description": "resume and close are wrapped like pcall. Read-only."
      }
    ],
    "removed": [
      {
        "name": "dofile",
        "since": 1,
        "description": "Reaches files."
      },
      {
        "name": "loadfile",
        "since": 1,
        "description": "Reaches files."
      },
      {
        "name": "load",
        "since": 1,
        "description": "Loads code past the text-only loader."
      },
      {
        "name": "collectgarbage",
        "since": 1,
        "description": "Controls memory the sandbox manages."
      },
      {
        "name": "print",
        "since": 1,
        "description": "Use log()."
      },
      {
        "name": "string.dump",
        "since": 1,
        "description": "Hands out bytecode."
      },
      {
        "name": "math.random",
        "since": 1,
        "description": "Still a function, but calling it raises an error: use rng(), which is seeded so a reload cannot reroll.",
        "raises": "math.random is not available: use rng() (seeded, so a reload cannot reroll)"
      },
      {
        "name": "math.randomseed",
        "since": 1,
        "description": "Still a function, but calling it raises an error: use rng(), which is seeded so a reload cannot reroll.",
        "raises": "math.randomseed is not available: use rng() (seeded, so a reload cannot reroll)"
      }
    ],
    "absent_libraries": [
      "io",
      "os",
      "package",
      "debug"
    ],
    "wrapped": [
      {
        "name": "pcall",
        "since": 1,
        "description": "Cannot catch a budget stop. Once the budget is gone it raises again."
      },
      {
        "name": "xpcall",
        "since": 1,
        "description": "As pcall. The message handler is skipped after a budget stop."
      },
      {
        "name": "coroutine.resume",
        "since": 1,
        "description": "As pcall."
      },
      {
        "name": "coroutine.close",
        "since": 1,
        "description": "As pcall."
      },
      {
        "name": "setmetatable",
        "since": 1,
        "description": "Refuses a __gc field, because finalizers could never be stopped."
      },
      {
        "name": "table.insert",
        "since": 1,
        "description": "Charged per element."
      },
      {
        "name": "table.remove",
        "since": 1,
        "description": "Charged per element."
      },
      {
        "name": "table.sort",
        "since": 1,
        "description": "Charged n log n."
      },
      {
        "name": "table.concat",
        "since": 1,
        "description": "Charged per element."
      },
      {
        "name": "table.move",
        "since": 1,
        "description": "Charged per element."
      },
      {
        "name": "table.unpack",
        "since": 1,
        "description": "Charged per result."
      },
      {
        "name": "string.byte",
        "since": 1,
        "description": "Charged per result."
      },
      {
        "name": "utf8.codepoint",
        "since": 1,
        "description": "Charged per result."
      },
      {
        "name": "utf8.len",
        "since": 1,
        "description": "Charged per 64 bytes."
      },
      {
        "name": "utf8.offset",
        "since": 1,
        "description": "Charged per 64 bytes."
      },
      {
        "name": "string.pack",
        "since": 1,
        "description": "Charged per 4 bytes of the format."
      },
      {
        "name": "string.packsize",
        "since": 1,
        "description": "Charged per 4 bytes of the format."
      },
      {
        "name": "string.unpack",
        "since": 1,
        "description": "Charged per 4 bytes of the format."
      },
      {
        "name": "string.format",
        "since": 1,
        "description": "Charged per 64 bytes of its string arguments."
      },
      {
        "name": "tonumber",
        "since": 1,
        "description": "Charged per 64 bytes of a string argument. A string over 200 bytes is never a number, here or in arithmetic."
      }
    ]
  },
  "events": [
    {
      "name": "villager_talked",
      "since": 1,
      "description": "The player starts an ordinary talk with a villager. Return where your words go in it: nil to stay quiet, a talk table { place, line, topics, ask }, or a list of talk tables, one a place. Every line names its place: a plain string is refused and logged, with nothing said. place is \"before\" (ahead of the hello), \"hello\" (instead of an everyday hello; a hello with news is kept), \"topic\" (instead of the topic the game picks when the player chats, if it is one of topics, small_talk when you name none, \"any\" for all), \"after\" (after the topic, before a chat ends) or \"conversation\" (the whole talk: no hello, no menu, no topic). line is a page of 1 to 400 bytes or a list of 1 to 8 pages. ask = { text, choices } (2 to 4 answers) goes only with \"conversation\": its last page asks the question, and the player's pick goes to villager_answered. Every mod's handler is called, in load order. The first line returned for a place takes it; a later one for that place is logged and not said. A conversation needs every place free and ends the event. Lines are said only when that part of the talk comes: topic and after only when the player chats. A table that is not right is logged and nothing of it is said. Special talks never reach mods. These are a first meeting, a villager moving out, one with an errand, delivery or contest going with you, a complaint, a pitfall or a bee chase, an islander, Kamakura and summer camp. No handler is called for a special talk. The villager's next ordinary talk calls it as usual, so a line a script is keeping for \"the next talk\" waits for that one.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "villager",
              "type": "table",
              "description": "The villager. It is a copy, so changing it changes nothing.",
              "fields": [
                {
                  "name": "id",
                  "type": "integer",
                  "description": "The villager's id (villagers.json)."
                },
                {
                  "name": "name",
                  "type": "string",
                  "description": "The villager's name."
                },
                {
                  "name": "species",
                  "type": "string|nil",
                  "description": "cat, dog and so on (villagers.json). nil when the game cannot tell."
                },
                {
                  "name": "personality",
                  "type": "string|nil",
                  "description": "normal, peppy, lazy, jock, cranky or snooty. nil when the game cannot tell."
                }
              ]
            }
          ]
        }
      ],
      "returns": {
        "type": "table|nil",
        "description": "nil, a talk table { place, line, topics, ask }, or a list of talk tables."
      }
    },
    {
      "name": "day_started",
      "since": 1,
      "description": "A new day begins in the game. It fires once per day, also when the game starts on a new day. It does not fire again when the game restarts later on a day the town already saw, because the save holds the day it last began. If the game was not saved since that day began, the save still holds the day before, so the next start fires it again. Count days by storing the last date you saw, not by counting calls. Its handler sees the whole day, the first day of a session included: game.calendar_today() lists today's calendar days, game.town() has the date, and game.player() and store.player have the player. A command queued here is applied once the player is free in the town.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "year",
              "type": "integer"
            },
            {
              "name": "month",
              "type": "integer",
              "description": "1 to 12."
            },
            {
              "name": "day",
              "type": "integer",
              "description": "1 to 31."
            },
            {
              "name": "weekday",
              "type": "integer",
              "description": "0 (Sunday) to 6, as game.time()."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "item_picked_up",
      "since": 1,
      "description": "The player got an item. They picked it up, outdoors or off a room's floor, caught it with the net or the rod, or dug it up with the shovel. It fires once the item is in their pockets, or in the wallet for Bells. It does not fire for anything bought. A fish or a bug that goes into the pockets fires this event and then fish_caught or bug_caught, so a script that counts both counts that catch twice. It does not fire when the pockets were full. Outdoors the game then offers to swap the item for one in the pockets, and no event is sent whatever the player chooses. Indoors a full pocket refuses the pickup.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "item",
              "type": "integer",
              "description": "The item number (items.json). For a mod item, it is the base piece the item stands on."
            },
            {
              "name": "mod_item",
              "type": "string|nil",
              "description": "The full id (\"author.mod:thing\") when the pocket slot it landed in holds a mod item. That is a mod item picked up in the player's own house, the one place a mod item stands. nil for a plain item, on a visit and in The City."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "scene_entered",
      "since": 1,
      "description": "A scene starts, such as the town, a house or a shop. Not in the title demo, at player select or in the intro (the rule own_game_only).",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "scene",
              "type": "integer",
              "description": "The scene number (scenes.json)."
            },
            {
              "name": "name",
              "type": "string|nil",
              "description": "The scene's name from scenes.json, like \"town\". nil for a scene with no published name."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "data_migrated",
      "since": 1,
      "description": "Fires once per town, when mod.json \"data_version\" differs from the version the town's data was written at. It runs as the town loads, before any other event's handlers run in that town. from is 0 for data from before data_version. If the handler errors, the script stops and the version stays, so the next start tries again. Migrations run in load order. A remote.call from a data_migrated handler into a mod whose own data_migrated has not run in that town yet is refused. Needs data_version.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "from",
              "type": "integer",
              "description": "The version the town's data was written at. 0 for data from before data_version."
            },
            {
              "name": "to",
              "type": "integer",
              "description": "mod.json data_version now."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "hour_changed",
      "since": 1,
      "description": "The game's clock reached a new hour. This is the game's own hourly update, midnight included.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "year",
              "type": "integer"
            },
            {
              "name": "month",
              "type": "integer"
            },
            {
              "name": "day",
              "type": "integer"
            },
            {
              "name": "hour",
              "type": "integer",
              "description": "0 to 23."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "item_bought",
      "since": 1,
      "description": "The player bought a good for Bells at any counter in the game. It fires as the seller takes the price. shop says which counter: \"nook\" (Nook's in every size, The City's Nookington's too), \"flower\" (the flower shop), \"redd\" (Crazy Redd), \"saharah\" (her carpet, swapped for one of yours and Bells), \"joan\" (turnips), \"fireworks\" (the fireworks show's stall), \"shrine\" (the New Year fortune slip), \"gyroid\" (what another player put up at their gyroid) or \"villager\" (a villager selling you something). Test e.shop == \"nook\" to keep to Nook's. price is the Bells paid. ordered is true for a Nook's catalog order, which is paid now and mailed tomorrow, so it is not in the pockets yet. Only Nook's and the flower shop sell mod items. A visitor buying in a friend's town gets a plain piece, so mod_item is nil there. Paid services that hand over no good are not purchases and do not fire it. These are the barber, Katrina, the Dream Suite and an Able Sisters design.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "item",
              "type": "integer",
              "description": "The item number (items.json). For a mod item, it is the base piece the item stands on."
            },
            {
              "name": "mod_item",
              "type": "string|nil",
              "description": "The full id (\"author.mod:thing\") when the piece is a mod item, else nil."
            },
            {
              "name": "price",
              "type": "integer",
              "description": "The Bells paid."
            },
            {
              "name": "shop",
              "type": "string",
              "description": "Which counter."
            },
            {
              "name": "ordered",
              "type": "boolean",
              "description": "true for a catalog order, mailed tomorrow."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "item_sold",
      "since": 1,
      "description": "The player sold for Bells. It fires once the wallet is credited. shop says to whom: \"nook\" (Nook's in every size, The City's Nookington's too) or \"villager\" (a villager buying something from your pockets). Nobody else in the game buys. item is the first good, count is how many went and bells is what they fetched. mod_item is the first good's full id when it is a mod item. What another player buys at your gyroid does not fire it. The gyroid hands you the takings later as one sum, with no record of what sold.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "item",
              "type": "integer",
              "description": "The item number (items.json). For a mod item, it is the base piece the item stands on."
            },
            {
              "name": "mod_item",
              "type": "string|nil",
              "description": "The full id (\"author.mod:thing\") when the piece is a mod item, else nil."
            },
            {
              "name": "count",
              "type": "integer",
              "description": "How many goods went."
            },
            {
              "name": "bells",
              "type": "integer",
              "description": "What they fetched."
            },
            {
              "name": "shop",
              "type": "string",
              "description": "Who bought."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "fish_caught",
      "since": 1,
      "description": "A fish was landed. pocketed says whether it went into the pockets. There is no size or length, because the game keeps none for a caught fish. Each kind has one fixed shadow size. Only the fishing tourney makes up a length, when the fish is shown to its host. When pocketed is true, item_picked_up fired for the same catch just before this event.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "item",
              "type": "integer",
              "description": "The fish's item number (items.json). A fish is never a mod item, so this event has no mod_item."
            },
            {
              "name": "pocketed",
              "type": "boolean"
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "bug_caught",
      "since": 1,
      "description": "A bug was netted. pocketed says whether it went into the pockets. When pocketed is true, item_picked_up fired for the same catch just before this event.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "item",
              "type": "integer",
              "description": "The bug's item number (items.json). A bug is never a mod item, so this event has no mod_item."
            },
            {
              "name": "pocketed",
              "type": "boolean"
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "letter_read",
      "since": 1,
      "description": "The player chose Read on a letter. item is the present, nil when the letter carries none. letter names the letters file letter it is, when a mod sent it.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "sender",
              "type": "string|nil",
              "description": "The name the letter is from, as game.player().name spells a name. nil when the letter carries no sender name."
            },
            {
              "name": "item",
              "type": "integer|nil",
              "description": "The present's item number. nil when the letter carries none."
            },
            {
              "name": "mod_item",
              "type": "string|nil",
              "description": "The present's full id (\"author.mod:thing\") when it is a mod item, else nil. A letter keeps its mod item present while it moves between the pockets, the mailbox and the post office. nil on a visit and in The City."
            },
            {
              "name": "first_time",
              "type": "boolean",
              "description": "true the first time this letter is read."
            },
            {
              "name": "letter",
              "type": "string|nil",
              "description": "The letter's full id (\"<mod id>:<letter id>\") when it is a letter from an enabled mod's letters file, sent by cmd.send_letter{ template } or a calendar day. Nothing is written into the save for it. The game finds it by what the saved letter holds: its words (body and footer), the sender name in the mailbox list and the paper, and only among letters the game itself mailed. So it still answers after a save and a reload, and a letter a player wrote by hand with the same words is never named. nil for the game's letters, a player's letters and a cmd.send_letter{ text } letter. Two mod letters with the same words, sender and paper are told apart by nothing, and the first in load order is named. A letter mailed before its mod changed its words, sender or paper is no longer named."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "villager_moved_in",
      "since": 1,
      "description": "A villager with no house was given one. It fires at the game start after a move-in. A brand-new town fires it for its first villagers.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "villager",
              "type": "table",
              "description": "The villager who moved in.",
              "fields": [
                {
                  "name": "id",
                  "type": "integer",
                  "description": "The villager's id (villagers.json)."
                },
                {
                  "name": "name",
                  "type": "string",
                  "description": "The villager's name."
                },
                {
                  "name": "species",
                  "type": "string|nil",
                  "description": "cat, dog and so on (villagers.json). nil when the game cannot tell."
                },
                {
                  "name": "personality",
                  "type": "string|nil",
                  "description": "normal, peppy, lazy, jock, cranky or snooty. nil when the game cannot tell."
                }
              ]
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "visitor_arrived",
      "since": 1,
      "description": "A friend is riding into this player's own town. This is a friend visit, on the host's side. kind is \"friend\".",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "kind",
              "type": "string",
              "description": "\"friend\"."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "command_finished",
      "since": 1,
      "description": "A command this mod queued was applied or refused. When applied, ok is true and via says how (mailbox, post_office, pockets, mail, shown, taken, saved, set, unchanged or played). When refused, ok is false, with a code (command_codes) and a message. Sent only to that mod.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "id",
              "type": "integer",
              "description": "The id the cmd.* call returned."
            },
            {
              "name": "command",
              "type": "string",
              "description": "send_letter, give_item, show_line, ask, take_item, take_bells, save, set_weather or play_sound."
            },
            {
              "name": "ok",
              "type": "boolean"
            },
            {
              "name": "via",
              "type": "string|nil",
              "description": "How it was applied: mailbox, post_office, pockets, mail, shown, taken, saved, set, unchanged or played. nil when refused."
            },
            {
              "name": "code",
              "type": "CommandCode|nil",
              "description": "The refusal's stable code (command_codes). nil when applied."
            },
            {
              "name": "message",
              "type": "string|nil",
              "description": "Why it was refused, in words. nil when applied."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "question_answered",
      "since": 1,
      "description": "The player answered this mod's ask, or closed it. choice counts from 1 and text is the answer picked. Both are nil when the window closed with no pick. Sent only to that mod.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "id",
              "type": "integer",
              "description": "The id cmd.ask returned."
            },
            {
              "name": "choice",
              "type": "integer|nil",
              "description": "Which answer, counting from 1. nil with no pick."
            },
            {
              "name": "text",
              "type": "string|nil",
              "description": "The answer's text. nil with no pick."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "timer_fired",
      "since": 1,
      "description": "A timer this mod set with timer.after is due. It fires once, at the end of a frame's update, in whatever scene the player is in, and the timer is gone before the handler runs. It is an event like any other. Its handlers share one instruction budget, it waits for a later frame when the frame's time is spent, and the commands it queues count against the per-event and per-day caps. At most one timer per mod fires in a frame. A timer that came due while the game was closed fires soon after the town loads. Sent only to that mod.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "id",
              "type": "integer",
              "description": "The id timer.after returned."
            },
            {
              "name": "name",
              "type": "string",
              "description": "The name given to timer.after."
            },
            {
              "name": "data",
              "type": "string|number|boolean|nil",
              "description": "The data given to timer.after. nil when none was given."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "villager_answered",
      "since": 1,
      "description": "The player answered the question this mod's conversation asked (villager_talked returned place = \"conversation\" with an ask). Sent only to that mod, while the window waits. Return what the villager says next, in the same conversation: a line, or { line, ask } to ask again. Return nil and the talk ends. A reply that is not right is logged and the talk ends.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "villager",
              "type": "table",
              "description": "The villager. It is a copy, so changing it changes nothing.",
              "fields": [
                {
                  "name": "id",
                  "type": "integer",
                  "description": "The villager's id (villagers.json)."
                },
                {
                  "name": "name",
                  "type": "string",
                  "description": "The villager's name."
                },
                {
                  "name": "species",
                  "type": "string|nil",
                  "description": "cat, dog and so on (villagers.json). nil when the game cannot tell."
                },
                {
                  "name": "personality",
                  "type": "string|nil",
                  "description": "normal, peppy, lazy, jock, cranky or snooty. nil when the game cannot tell."
                }
              ]
            },
            {
              "name": "choice",
              "type": "integer",
              "description": "Which answer, counting from 1."
            },
            {
              "name": "text",
              "type": "string",
              "description": "The answer's text."
            }
          ]
        }
      ],
      "returns": {
        "type": "string|table|nil",
        "description": "nil, a line, or a reply table { line, ask }."
      }
    },
    {
      "name": "button_pressed",
      "since": 1,
      "since_minor": 1,
      "description": "A button on the player's controller was pressed. The player's game inputs are the controller the game itself reads, so a keyboard key, a controller button and the on-screen touch pad are all the same button here, with the player's own key and button settings applied. A mod never sees which key was typed: the keyboard reaches it only through the buttons it plays, and nothing reaches it while the game's text editor is open (writing a letter or a name, by keyboard or by controller). Events come once a frame, only while the player's own game is running: releases first, then presses, each in button order. A button already held when play starts, or held through a change of scene or the text editor, is not a press. The C stick is the four c_ buttons. To read the stick, or several buttons held at once, call game.input(). A handler runs at the frame it was sent in unless the frame is already busy, when it can run a frame or two later: game.input() then reads the controller as it is when the handler runs, so a combination is safest tracked from the events themselves.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "button",
              "type": "string",
              "description": "One of a, b, x, y, z, l, r, start, dpad_up, dpad_down, dpad_left, dpad_right, c_up, c_down, c_left and c_right."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "button_released",
      "since": 1,
      "since_minor": 1,
      "description": "A button on the player's controller was let go. The player's game inputs are the controller the game itself reads, so a keyboard key, a controller button and the on-screen touch pad are all the same button here, with the player's own key and button settings applied. A mod never sees which key was typed: the keyboard reaches it only through the buttons it plays, and nothing reaches it while the game's text editor is open (writing a letter or a name, by keyboard or by controller). Events come once a frame, only while the player's own game is running: releases first, then presses, each in button order. A button already held when play starts, or held through a change of scene or the text editor, is not a press. The C stick is the four c_ buttons. To read the stick, or several buttons held at once, call game.input(). A handler runs at the frame it was sent in unless the frame is already busy, when it can run a frame or two later: game.input() then reads the controller as it is when the handler runs, so a combination is safest tracked from the events themselves.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "button",
              "type": "string",
              "description": "One of a, b, x, y, z, l, r, start, dpad_up, dpad_down, dpad_left, dpad_right, c_up, c_down, c_left and c_right."
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    },
    {
      "name": "player_acted",
      "since": 1,
      "since_minor": 1,
      "description": "The player started one of the actions below. Only these, never standing, walking or running: poll game.player().state for those. Only the player playing this game: a friend on a visit or another player in The City does not send it. It is the action starting, not its result: axe_swung fires for every swing, and the tree falls or not afterwards. It fires on a visit too, where the player acts in the host's town, and in The City. It changes nothing, so it needs no permission.",
      "params": [
        {
          "name": "e",
          "type": "table",
          "fields": [
            {
              "name": "action",
              "type": "string",
              "description": "One of: axe_swung (at a tree or at nothing), axe_hit_rock (the axe bounced off a rock or something hard), axe_broke, net_swung, rod_cast, shovel_dug (a hole), hole_filled, tree_shaken, sat_down, stood_up (from a seat or out of bed), lay_down (on a bed), stung (by a bee or a mosquito), fell_in_pitfall, tripped, shocked (the game startles the player, such as at a cockroach), door_entered, reacted (a reaction: from the reactions bar or cmd.react). The list may grow: ignore a word you do not know.",
              "values": [
                "axe_swung",
                "axe_hit_rock",
                "axe_broke",
                "net_swung",
                "rod_cast",
                "shovel_dug",
                "hole_filled",
                "tree_shaken",
                "sat_down",
                "stood_up",
                "lay_down",
                "stung",
                "fell_in_pitfall",
                "tripped",
                "shocked",
                "door_entered",
                "reacted"
              ]
            },
            {
              "name": "item",
              "type": "integer|nil",
              "description": "The tool's item number (items.json) for an axe, net, rod or shovel action, as the game holds it at that moment: an axe's number changes as it wears. nil for every other action."
            },
            {
              "name": "reaction",
              "type": "string|nil",
              "description": "For reacted, which reaction: one of cmd.react's names. nil for every other action.",
              "values": [
                "hooray",
                "dance",
                "hug",
                "thanks",
                "ouch",
                "trip",
                "spin",
                "hide",
                "pose"
              ]
            }
          ]
        }
      ],
      "returns": {
        "type": "nil"
      }
    }
  ],
  "commands": [
    {
      "name": "send_letter",
      "kind": "function",
      "since": 1,
      "description": "Queues a letter in the player's own mailbox. The post office keeps it when the mailbox is full. The save holds an ordinary letter, so it loads without the mod.",
      "params": [
        {
          "name": "t",
          "type": "table",
          "description": "{ text, item?, from?, paper? } or { template }. text is 1 to 192 characters fitting 6 lines. item is a number or \"0x\" and four hex digits. from is 1 to 8 characters on one line (\"A friend\" when left out). paper is 0 to 63. template is one of this mod's own letters.json letters, by its id or \"<this mod's id>:<id>\". The header, body, sign-off, present and paper then all come from the template."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "send_letter"
    },
    {
      "name": "give_item",
      "kind": "function",
      "since": 1,
      "description": "Queues an item into the first empty pocket. With full pockets it comes by letter. Also takes this mod's own new item by its full id (author.mod:thing). A mod item is given with its identity, as a shop sells it, and full pockets refuse it.",
      "params": [
        {
          "name": "item",
          "type": "integer|string|table",
          "description": "An item number, \"0x\" and four hex digits, this mod's \"author.mod:thing\", or { item, from? }."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "give_item"
    },
    {
      "name": "show_line",
      "kind": "function",
      "since": 1,
      "description": "Queues a line shown in a message box with no one speaking, like the game's own \"My pockets are full!\", once the player is free. One line or question at a time.",
      "params": [
        {
          "name": "text",
          "type": "string",
          "description": "1 to 400 bytes."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "show_line"
    },
    {
      "name": "ask",
      "kind": "function",
      "since": 1,
      "description": "Queues a question with 2 to 4 answers in that same speakerless message box. The pick comes back as a question_answered event.",
      "params": [
        {
          "name": "t",
          "type": "table",
          "description": "{ text, choices }. text is 1 to 120 characters. choices is 2 to 4 answers of 1 to 16 characters."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "ask"
    },
    {
      "name": "take_item",
      "kind": "function",
      "since": 1,
      "description": "Asks the player to hand over items from their pockets. The game shows its own question, which names the item, the count and this mod. The mod's name stands between quotes, and a mod item is named as the pockets show it. A script cannot change that text. On yes the items leave the pockets and command_finished says via taken. On no, or when the window closes with no pick, nothing is taken and command_finished carries command-declined. It is refused with command-not-held when the pockets do not hold that many. Only plain pocket slots count. A wrapped present or an item held for a villager's errand is never taken. Items a command cannot give cannot be taken either (money bags, turnips, tickets, grab bags, fossils). It is refused on a visit and in The City, so a lent mod can never take anything.",
      "params": [
        {
          "name": "t",
          "type": "table",
          "description": "{ item, count? }. item is an item number, \"0x\" and four hex digits, or this mod's own \"author.mod:thing\". count is 1 to 15 and is 1 when left out. An item number matches plain pieces only, never a mod item standing on that piece."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "take_item"
    },
    {
      "name": "take_bells",
      "kind": "function",
      "since": 1,
      "description": "Asks the player to pay Bells from their wallet. The game shows its own question, which names the amount and this mod. The mod's name stands between quotes. A script cannot change that text. On yes the Bells leave the wallet and command_finished says via taken. On no, or when the window closes with no pick, nothing is taken and command_finished carries command-declined. It is refused with command-not-held when the wallet holds less than the amount, so the wallet never goes below zero. The bank account and money bags in the pockets are never touched. It is refused on a visit and in The City, so a lent mod can never take anything.",
      "params": [
        {
          "name": "t",
          "type": "table",
          "description": "{ amount }. amount is a whole number of Bells, 1 to 99999."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "take_bells"
    },
    {
      "name": "save",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Asks the game to save the town, as the Autosave setting does, for a mod such as a save-anywhere button. The game writes the home save only where the player could save at Gyroid: outdoors in their own town, in free control, with no menu, talk or scene change. It writes a settled copy of the town and never changes the town being played, so nothing is lost or doubled however often it runs. command_finished says via saved, or via unchanged when nothing changed since the last save (nothing is written). It is refused with command-indoors inside a house, a shop or any place that is not the town outdoors, command-busy when the player is not in free control, command-dream in a dream, command-not-ready before a save is loaded or while the page is replacing the save, command-too-soon within commands.save_spacing_seconds of any mod's last save, and command-save-failed when the write itself fails. It is refused on a visit and in The City, because a visitor's game does not hold the town it stands in. It does not run what Gyroid's save does on top: a villager's mood and clothes reach the save at the next change of scene or Gyroid save.",
      "params": [],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "save"
    },
    {
      "name": "set_weather",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Sets the town's weather for the rest of the game day: kind \"clear\", \"rain\" or \"snow\", and for rain or snow an intensity, \"light\" (when left out) or \"heavy\". Heavy rain is a storm, with lightning in June to August, and heavy snow is a blizzard. The game changes it as its own weather changes: the last drops or flakes fall, then the new weather fades in with its light and sound. Villagers, fish, bugs and the rain sound follow it as they follow any rainy or snowy day. The next game day the game rolls its own weather again, and a day after rain or snow can bring a rainbow and a gyroid, as after a real rainy day. A reload the same day keeps it. Only weather the game itself could roll on that date is allowed. Clear is always allowed. Rain is allowed from February 25 to November 15, and snow from November 1 to February 24, but neither on the days the game keeps clear: January 1 to 7, April 1 to 8 (the cherry blossoms), April 20, October 31 and December 31. On an event day the event's weather holds, and the player's first day of work for Nook stays dry. Those are refused with command-weather. command_finished says via set, or via unchanged when the town already has that weather as game.weather() reads it: cherry blossom petals and falling leaves count as clear, so on those days \"clear\" is unchanged and the petals or leaves stay, and putting back the weather a mod read changes nothing. While a change of weather is under way the command waits for it to end. It is refused on a visit and in The City, because the host's game decides the weather and a visitor sees the host's. Needs scope world.",
      "params": [
        {
          "name": "kind",
          "type": "string",
          "description": "\"clear\", \"rain\" or \"snow\"."
        },
        {
          "name": "intensity",
          "type": "string|nil",
          "description": "For rain or snow, \"light\" or \"heavy\". nil is light. For clear, nil or \"none\"."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "set_weather"
    },
    {
      "name": "play_sound",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Plays one of the game's own sound effects, by its name in sounds.json: a jingle, a menu tick, a page turn. Only this player hears it: in a visit the friend does not, and nothing reaches the town or the save. Every sound in the list is one the game plays once and stops on its own, never a sound that loops. A sound changes nothing, so it does not wait for the player to be free: it plays at the end of the next frame's update, in a talk or a menu too. command_finished says via played. At most commands.sounds_per_event in one event and commands.sounds_per_minute in any minute for each mod (command-event-cap, command-sound-cap). A name not in sounds.json is refused with command-args. While an NES game is being played the game's sound is the NES game's, and a sound is refused with command-no-sound. It is refused in The City.",
      "params": [
        {
          "name": "name",
          "type": "string",
          "description": "A sound's name from sounds.json, like \"item_get\"."
        }
      ],
      "returns": {
        "type": "integer|nil",
        "description": "The command's id. When it is refused at once: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "play_sound"
    },
    {
      "name": "set_shop_goods",
      "kind": "function",
      "since": 1,
      "description": "Sets a shop's goods for the rest of the game day, as one more block after the mod's shops.json blocks for that shop. It is set at the call, with no queue, no daily cap and no command_finished, and applies from the next frame, also when the shop is shut, and is gone when the day changes or the game restarts, so set it again in day_started. nil clears it. Only for a shop with goods in the shop table, and refused when a mod later in the load order changes that shop. Needs scope world.",
      "params": [
        {
          "name": "shop",
          "type": "string",
          "description": "A shop id from the shop table, like \"nook\" or \"redd\"."
        },
        {
          "name": "goods",
          "type": "table|nil",
          "description": "A list of { item, price? } (item: an item number, \"0x\" and four hex digits, or this mod's \"author.mod:thing\"), as many as the shop takes in a block. Or { goods = <that list>, own_goods = false } to make them the whole stock. nil clears."
        }
      ],
      "returns": {
        "type": "boolean|nil",
        "name": "ok",
        "description": "true when it is set. When it is refused: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "set_shop_goods"
    },
    {
      "name": "set_shop_open",
      "kind": "function",
      "since": 1,
      "description": "Opens or shuts a shop for the rest of the game day, as one more block after the mod's shops.json blocks for that shop. true opens it, false shuts it, nil clears it. It is set at the call, with no queue, no daily cap and no command_finished, and applies from the next frame and is gone when the day changes or the game restarts. Only for a shop with open in the shop table, and refused when a mod later in the load order changes that shop. Needs scope world.",
      "params": [
        {
          "name": "shop",
          "type": "string",
          "description": "A shop id from the shop table, like \"flower\" or \"barber\"."
        },
        {
          "name": "open",
          "type": "boolean|nil",
          "description": "true opens it, false shuts it, nil clears."
        }
      ],
      "returns": {
        "type": "boolean|nil",
        "name": "ok",
        "description": "true when it is set. When it is refused: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "set_shop_open"
    },
    {
      "name": "set_hat",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Puts a picture from the mod's own files on the hat of the player playing this game, in place of the design or the shirt the hat wears. nil takes it off. It is set at the call, with no queue, no daily cap and no command_finished, and shows from the next frame. The picture is the path of a PNG inside the mod, like \"hats/stripes.png\": exactly 32 x 32 pixels, every pixel opaque, at most 16 colours, as an Able Sisters design. Keep it outside the mod's textures folder. A mod's hat beats a design on the hat. When two mods set one, the mod later in the load order wins. The hat is this player's own, by who they are and their home town, so a hat set at home stays on when they visit a friend or go to The City. Only this player's own screen draws it: friends on a visit and players in The City see the hat as the game would draw it. Nothing is saved: the hat is gone when the game restarts. A reload of the mod's script in developer mode keeps it. Keep the player's pick in store.player and set it again from scene_entered. Away from home store.player starts empty, so set the hat only when the store holds a pick: a nil there is no reason to take it off. It changes only how the player looks, so it works in a Just you mod, on a visit and in The City.",
      "params": [
        {
          "name": "picture",
          "type": "string|nil",
          "description": "The path of a 32 x 32 PNG in this mod, like \"hats/stripes.png\", or nil to take the hat off."
        }
      ],
      "returns": {
        "type": "boolean|nil",
        "name": "ok",
        "description": "true when it is set. When it is refused: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "set_hat"
    },
    {
      "name": "set_shirt",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Puts a picture from the mod's own files on the shirt of the player playing this game, in place of the clothes they wear. nil takes it off. It is set at the call, with no queue, no daily cap and no command_finished, and shows from the next frame. The picture is the path of a PNG inside the mod, like \"shirts/stripes.png\": exactly 32 x 32 pixels, every pixel opaque, at most 16 colours, as an Able Sisters design, and it wraps the body and the sleeves the way a design does. Keep it outside the mod's textures folder. It beats the clothes the player wears: putting on other clothes changes what is underneath, and the picture stays on top until the mod takes it off. The hat matches the shirt, as in the game, so with no design or mod hat on the hat it wears the picture too. When two mods set one, the mod later in the load order wins. The shirt is this player's own, by who they are and their home town, so a shirt set at home stays on when they visit a friend or go to The City. Only this player's own screen draws it: friends on a visit and players in The City see the clothes the player wears. Nothing is saved: the shirt is gone when the game restarts, and the save keeps the clothes the player wears. A reload of the mod's script in developer mode keeps it. Keep the player's pick in store.player and set it again from scene_entered. Away from home store.player starts empty, so set the shirt only when the store holds a pick: a nil there is no reason to take it off. It changes only how the player looks, so it works in a Just you mod, on a visit and in The City.",
      "params": [
        {
          "name": "picture",
          "type": "string|nil",
          "description": "The path of a 32 x 32 PNG in this mod, like \"shirts/stripes.png\", or nil to take the shirt off."
        }
      ],
      "returns": {
        "type": "boolean|nil",
        "name": "ok",
        "description": "true when it is set. When it is refused: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "set_shirt"
    },
    {
      "name": "react",
      "kind": "function",
      "since": 1,
      "since_minor": 1,
      "description": "Plays one of the reactions from the reactions bar on the player's own character: \"hooray\", \"dance\", \"hug\", \"thanks\", \"ouch\", \"trip\", \"spin\", \"hide\" or \"pose\". It is the same reaction the bar plays, so friends on a visit and players in The City see it as they see one from the bar. It is set at the call, with no queue, no daily cap and no command_finished: the game is asked there and then, and the reaction plays from the next frame for at most 1.5 seconds; any move from 0.3 seconds on walks out of it. Only from standing, walking or running, and only while the player is free: refused (command-busy) during a menu, a talk, a message, a door, a cutscene or a scene change, and refused (command-cannot-react) when the game says no, such as while sitting, swinging a tool or holding furniture. One reaction at a time: once one is taken the player is in it, so another call in the same moment, or in a player_acted handler (the player is in the action that just started), is refused with command-busy. React from a later moment, such as a timer. At most commands.reacts_per_minute a minute for each mod (command-minute-cap). It moves only the player's own body and changes nothing saved, so it works in a Just you mod, on a visit and in The City. When it plays, player_acted fires with reacted.",
      "params": [
        {
          "name": "name",
          "type": "string",
          "description": "Which reaction: hooray, dance, hug, thanks, ouch, trip, spin, hide or pose.",
          "values": [
            "hooray",
            "dance",
            "hug",
            "thanks",
            "ouch",
            "trip",
            "spin",
            "hide",
            "pose"
          ]
        }
      ],
      "returns": {
        "type": "boolean|nil",
        "name": "ok",
        "description": "true when the game took it. When it is refused: nil, then a message and a code.",
        "more": [
          {
            "name": "message",
            "type": "string|nil",
            "description": "Why it was refused, in words."
          },
          {
            "name": "code",
            "type": "CommandCode|nil",
            "description": "The refusal's stable code (command_codes)."
          }
        ]
      },
      "permission": "react"
    }
  ],
  "command_codes": [
    {
      "code": "command-shop",
      "retry": "never",
      "description": "A shop command the shop cannot take: the shop is not in the shop table, it has no goods or no open, or a mod later in the load order changes that shop."
    },
    {
      "code": "command-permission",
      "retry": "never",
      "description": "The command is not in mod.json permissions."
    },
    {
      "code": "command-args",
      "retry": "never",
      "description": "Wrong arguments, such as their shape, a length, the paper or the choices."
    },
    {
      "code": "command-item",
      "retry": "never",
      "description": "An item the command cannot hand out, or an unknown item or letter id of the mod's own. Also sent in command_finished when the mod's item or letter was gone by the time the game applied the command."
    },
    {
      "code": "command-event-cap",
      "retry": "next-event",
      "description": "More than commands.per_event commands in one event."
    },
    {
      "code": "command-queue-full",
      "retry": "later",
      "description": "The mod's queue, or the game's, is full."
    },
    {
      "code": "command-day-cap",
      "retry": "tomorrow",
      "description": "The per-day limit for this command in this town is used up."
    },
    {
      "code": "command-city",
      "retry": "later",
      "description": "Commands are off in The City."
    },
    {
      "code": "command-visiting",
      "retry": "later",
      "description": "On a visit, only the town owner's game changes the town."
    },
    {
      "code": "command-lent-home",
      "retry": "never",
      "description": "A lent mod acting outside the host's town. It arrives in command_finished, never as the return of a cmd call."
    },
    {
      "code": "command-no-room",
      "retry": "later",
      "description": "No room now. The mailbox and the post office are full, or the pockets are full for a mod item. The command still counts against the day's cap, so do not try again in a loop."
    },
    {
      "code": "command-not-shown",
      "retry": "never",
      "description": "The line or question cannot be drawn in the window, because the text has too many pages. The command still counts against the day's cap."
    },
    {
      "code": "command-not-held",
      "retry": "later",
      "description": "A take the player cannot meet. The pockets do not hold that many of the item in plain slots, or the wallet holds fewer Bells."
    },
    {
      "code": "command-declined",
      "retry": "later",
      "description": "The player said no to a take's question, or closed it with no pick. Nothing was taken."
    },
    {
      "code": "command-client-setting",
      "retry": "never",
      "description": "The event read a client setting, and a client setting cannot decide what the town gets or gives up. Make the setting world, or do not read it in an event that sends a letter, gives an item, or takes an item or Bells."
    },
    {
      "code": "command-not-ready",
      "retry": "later",
      "description": "A save before the player's save has loaded, or while the page is replacing or restoring the save."
    },
    {
      "code": "command-indoors",
      "retry": "later",
      "description": "A save anywhere but the town outdoors: a house, a shop, a museum, the train. Inside a house the furniture still holds the items kept in it, so the game would save the house with its storage empty."
    },
    {
      "code": "command-picture",
      "retry": "never",
      "description": "cmd.set_hat's or cmd.set_shirt's picture is not in the mod, or is not a 32 x 32 PNG with opaque pixels and at most 16 colours."
    },
    {
      "code": "command-busy",
      "retry": "later",
      "description": "The player is not free now: a menu, a talk, a message window, a door, a cutscene, a tool swing or a scene change has them. For cmd.save, also right after the game itself settled this scene for a save that did not finish, until the next change of scene. For cmd.react, also an action they just started (as in a player_acted handler) or a reaction already playing. Try again from a later moment."
    },
    {
      "code": "command-dream",
      "retry": "later",
      "description": "A save in a dream town. A dream is never written to the player's save."
    },
    {
      "code": "command-too-soon",
      "retry": "later",
      "description": "A save within commands.save_spacing_seconds of the last save by any mod, or a second save while this mod's last one is still waiting."
    },
    {
      "code": "command-save-failed",
      "retry": "later",
      "description": "The game could not write the save file. The town in play is unchanged."
    },
    {
      "code": "command-weather",
      "retry": "later",
      "description": "A weather the game would not have today: snow outside the months it snows, rain outside the months it rains, any weather but the event's on an event day, or rain on the player's first day of work for Nook. The date decides, so the next day may allow it."
    },
    {
      "code": "command-sound-cap",
      "retry": "later",
      "description": "A sound when this mod already played commands.sounds_per_minute sounds in the last minute, counting the ones still waiting. Wait and play it later."
    },
    {
      "code": "command-no-sound",
      "retry": "later",
      "description": "A sound while an NES game is being played: the game's sound belongs to the NES game until it ends."
    },
    {
      "code": "command-cannot-react",
      "retry": "later",
      "description": "cmd.react: the game did not take the reaction. It plays only while the player stands, walks or runs, so not while sitting, lying, swinging a tool or holding furniture, and something more important (a talk, a door, a bee) outranks it."
    },
    {
      "code": "command-minute-cap",
      "retry": "later",
      "description": "cmd.react: the mod already played commands.reacts_per_minute reactions this minute of the game clock. Try again next minute."
    }
  ],
  "reference_lists": [
    {
      "name": "scenes",
      "file": "scenes.json",
      "url": "https://playaconline.com/schemas/scenes.json",
      "description": "Every scene a player can be in, from the game's own scene table. Each has the number scene_entered hands a script (e.scene), its stable name (e.name) and a title in plain words.",
      "fields": [
        {
          "name": "scene",
          "type": "integer",
          "description": "The scene number."
        },
        {
          "name": "name",
          "type": "string",
          "description": "A stable lower_snake name, like \"town\"."
        },
        {
          "name": "title",
          "type": "string",
          "description": "The scene in plain words."
        }
      ]
    },
    {
      "name": "villagers",
      "file": "villagers.json",
      "url": "https://playaconline.com/schemas/villagers.json",
      "description": "Every villager the game has. Each has the id a script sees (villager.id), the name, the species and the personality they start with. Species and personality are from the game's own villager tables. A name is the villager's name in the game, read from the running game's own name table, with its space or punctuation (\"Wart Jr\", \"Sue E\", \"T-Bone\", \"O'Hare\"). In a talk pool's \"villager\", write the name as the game shows it.",
      "fields": [
        {
          "name": "id",
          "type": "integer",
          "description": "The villager's id."
        },
        {
          "name": "name",
          "type": "string",
          "description": "The villager's name, as the game shows it."
        },
        {
          "name": "species",
          "type": "string",
          "description": "cat, dog and so on."
        },
        {
          "name": "personality",
          "type": "string",
          "description": "normal, peppy, lazy, jock, cranky or snooty. It is the one the villager starts with."
        }
      ]
    },
    {
      "name": "sounds",
      "file": "sounds.json",
      "url": "https://playaconline.com/schemas/sounds.json",
      "description": "Every sound cmd.play_sound can play, from the game's own sound effects. Each is a sound the game plays once and stops on its own. None loops, and none is one a scene starts and stops itself. A name, once listed, never changes.",
      "fields": [
        {
          "name": "name",
          "type": "string",
          "description": "The stable lower_snake name cmd.play_sound takes, like \"item_get\"."
        },
        {
          "name": "title",
          "type": "string",
          "description": "The sound in plain words."
        }
      ]
    }
  ],
  "shims": [],
  "timer_codes": [
    {
      "code": "timer-args",
      "retry": "never",
      "description": "Wrong arguments, such as the minutes, the name or the data. Also when the script has no timer_fired handler."
    },
    {
      "code": "timer-limit",
      "retry": "later",
      "description": "The mod already has timers.per_mod timers waiting in this town."
    },
    {
      "code": "timer-no-town",
      "retry": "later",
      "description": "No town is loaded yet. The script's main chunk runs before the save loads."
    },
    {
      "code": "timer-no-clock",
      "retry": "later",
      "description": "The game clock is not set. It reads a date before the year 2000, so there is no minute to count from."
    },
    {
      "code": "timer-store-full",
      "retry": "later",
      "description": "The timer does not fit in this mod's town store (store.bytes), or the store could not be written."
    }
  ],
  "dependency_codes": [
    {
      "code": "dependency-absent",
      "description": "The mod is not installed, is switched off, did not load, or has no running script."
    },
    {
      "code": "dependency-version",
      "description": "The mod loaded, but its version is outside the range this mod names."
    },
    {
      "code": "dependency-undeclared",
      "description": "The mod is not in this mod's depends or optional_depends."
    }
  ]
}
