Test your mod

You test a mod in the game. Installing it runs every check the site runs on an upload, and the Mods tab tells you what went wrong and where.

The test loop #

  1. ZIP your mod folder.
  2. In the game, open Settings, then Mods. Under Install from a file, choose Choose a file.
  3. If the ZIP breaks a rule, it is not installed. A message says which rule and which file. Fix it and choose the ZIP again.
  4. Save your game, then choose Restart now.
  5. Try the mod. To change it, edit the files, ZIP the folder, choose the ZIP again and restart. The new ZIP replaces the copy with the same id and keeps its place and its switch.

To test a calendar day, a letter or a notice without waiting for its date, see Test your day.

Where problems show #

WhereWhat you see
When you choose the ZIPA rule the ZIP or mod.json breaks, such as a missing field, a bad id, a file that is too big or a wrong extension. Nothing is installed.
Your mod's row: This mod did not loadThe game skipped it at start, and the row says why. The other mods still loaded.
Your mod's row, in redThe game refused part of it while loading, such as a shop item it cannot sell, or a line too long for one message.
Your mod's row: Script stoppedYour script raised an error or ran over its limits. The row gives the file and line. The script stays stopped until the next restart.
Your mod's row: made for an older game or needs a newer gameIts "api" is outside what this game runs. See the changelog.
The Mods tab's Mod logYour script's log() lines, errors with a traceback, stops, and anything the game refused. It updates while you play. It is at the bottom of the tab, under For mod authors. See The Mod log.
The browser consoleThe same log() lines and stop reasons, as [Mods] your-id: .... Open it with F12, or Cmd+Option+J on a Mac.

The errors catalogue lists each message with its meaning and fix. The FAQ covers the common cases.

If a mod stops the game starting #

  • In the Mods tab, choose Start without mods. The game restarts once with every mod off, so you can switch off or remove the one at fault.
  • If you cannot open the Mods tab, add ?nomods=1 to the play page's address: /play/?nomods=1.

Testing with a friend #

  • For a World mod, send your friend the same ZIP. Both of you install it in the same position in the list and restart. Then visit as usual.
  • If the visit is refused because your World mods don't match, compare your two Mods tab lists. Both need the same World mods that count for visits, in the same versions and order. The multiplayer guide says which count.
  • A Just you mod never affects a visit. Your friend does not see it.

See Multiplayer and The City for more.

Testing on a phone #

  • Switched-on mods together can unpack to only 24 MB on a phone, against 96 MB on a computer.
  • A new mod over the limit installs switched off and says why. An update that would take a switched-on mod over the limit is refused, and the old version stays.
  • BC7 textures need BPTC support, which many phones lack. Uncompressed RGBA, BC1 and BC3 are safer.

Checklist before you share #

  1. id is yourname.mod-name, and yourname is not example, official, admin or playaconline.
  2. version is a number this mod has not shared before. Normally it is the next higher one, because the highest approved version is the listed one.
  3. "api" is 1.
  4. scope is "client" unless the mod has a shop, a bulletin board notice, a script that sets the weather or a script that changes a shop.
  5. Every file is your own work. There is no picture, sound, text or name from Nintendo or any other franchise. You deleted every texture you did not repaint.
  6. name and description say plainly what the mod does.
  7. It installs from the ZIP with no message. After a restart, its row shows no red text.
  8. You saw every change in the game. Check each texture and each line, and read the last page of long lines. Visit the shop in and out of its hours.
  9. For a script, the Mod log shows no error or stop, and the mod still works after a restart on a new day.
  10. With the playac-mod tool, check shows no error, and you read every warning.
  11. If you can, try it on a phone. It should fit and draw.

Then publish it.

Developer mode #

Developer mode reads your mod straight from its folder, with no ZIP and no restart after each change. It plays a test town, never your real one.

  1. Open the game with ?moddev=1 at the end of the address: /play/?moddev=1.
  2. The first time, the game asks how to start your test town: A ready-made town, where you start standing in town at once, or A copy of my town.
  3. Open Settings, then Mods. At the bottom, find Load a mod you are making in the Developer section.
  4. Choose Choose folder and pick the folder with mod.json in it. Or run playac-mod dev in that folder and leave it running. Then press Connect beside playac-mod dev address. The box holds http://127.0.0.1:2604. If the tool printed another address, put that one in first.
  5. Choose Restart now once. From then on, save a file and the game picks it up while you play.

playac-mod dev prints one line for each thing that happens. A session looks like this:

serving my.mod 1.0.0 at http://127.0.0.1:2604
In the game: open it with ?moddev=1, go to Settings, Mods, Developer, Load a mod you are making,
press Connect, then Restart now once. Ctrl+C stops.
connected: https://playaconline.com
sent to the game: my.mod 1.0.0. Press Restart now to run it
loaded in the game: my.mod 1.0.0
changed main.lua
reloaded main.lua
disconnected: https://playaconline.com
  • connected names the game page. It shows again only after that page was disconnected.
  • loaded in the game and reloaded come from the game page, so they say what the game did. changed is the save the tool saw.
  • Restart now to load names a change that waits for a restart, such as mod.json. in the game is a reload the game refused, with its reason. The Mod log has the details.
  • not in the mod is a file the game asked for that the folder does not have. disconnected comes a few seconds after the page closes or reloads.
  • Developer mode is on only while the address ends in ?moddev=1. A plain /play/ always plays your real town. A reload keeps the address, so it stays in developer mode.
  • Opening the game with ?moddev=1 loads nothing by itself. The page reads your folder, or reaches playac-mod dev, only after you choose the folder or press Connect.
  • After you reload the page, the game still runs the last copy it loaded. To get live edits again, choose the folder or press Connect again.
  • playac-mod dev answers only game pages at playaconline.com, its dev site and http://localhost:5173, so another website cannot read your folder. For a game page at any other address, start it with --origin and that page's address, for example playac-mod dev --origin http://localhost:5190. Without it, Connect says the dev server refused this site, and the terminal prints the exact --origin to add.
  • A change you save while the title screen plays is applied when the game leaves it. The Developer section says applies when you are back in town until then.
  • The mod is not installed. Only this browser has it.
  • Developer mode runs code from your own computer. That is the folder you chose, or the files playac-mod dev serves there. The game takes a dev address only at localhost or 127.0.0.1.
  • Nobody has reviewed that code or its pictures. It runs in the same sandbox and under the same limits as any mod. Load only a folder you made or one you trust.
  • It loads last, so its textures and shops win over your installed mods'. One exception is an installed mod that needs it, which loads after it. See one folder at a time.
  • For a script's talk line, the first mod in load order takes each place. So an installed mod's line for the same place can still come before this mod's.
You changeWhat happens
A messages fileThe new line is used the next time the line is said.
shops.jsonThe name, sign, when, open and lines change at once. The goods change the next time you go in.
A .lua fileYour script starts again with the new code and keeps its store. A script stopped by an error or its limits runs again once fixed.
A textureThe game draws it again from the new file. A texture you deleted draws as the game's own until the next restart.
A talk, letters or calendar fileThe game reads it again at once. See the notes below.
The items fileThe game reads it again at once. See the notes below.
mod.json, or anything it adds (a first script, a textures folder)Restart the game. The Developer section says so and offers Restart now.

After you save a talk, letters or calendar file:

  • A new talk line comes in the next talk that reaches its place. For a topic line, choose to chat a few times: the villager picks small talk only on some chats.
  • A letter is the new one the next time it is sent.
  • A board notice is the new one the next time the board is read.

After you save the items file:

  • A new name or price shows the next time the item is shown or offered. A new item can be stocked and given.
  • A new base applies to new pieces only. Pieces already in your town keep the base they were made of, because a save holds the base. A restart does not change them either.
  • A removed item's pieces show as their base. They are the item again when you put it back.
  • To give those pieces a new id instead, add a renames entry to mod.json. That needs a restart.
  • The Mod log says which of these applies.

Other things to know about developer mode:

  • Every save is checked by the same rules as installing a ZIP. A file that breaks one is not loaded. The game keeps the last good copy, and the reason is in the Mod log.
  • A repository's own files (hidden files and folders (a name starting with a dot, such as .git, .github, .gitignore, .vscode, .playac and .DS_Store), __MACOSX, Thumbs.db and node_modules anywhere, and at the top of the mod README.md, CHANGELOG.md, LICENSE or LICENCE with any extension and the media/ folder) and files a mod cannot hold are left out, and the Developer section lists them. A .psd beside its .dds is one example.
  • Chrome and Edge watch the folder. Other browsers read it once. Choose it again to reload, or use playac-mod dev.
  • Safari does not let the site connect to http://127.0.0.1. Use the folder there.
  • While a mod is loaded this way, sharing is off, because what is reviewed must be the ZIP players get. Choose Unload and restart to get it back.

The test town #

In developer mode the game plays a separate town of its own. A bar above the game says Test town. Your real town is not opened, saved or uploaded until you leave developer mode.

  • The first time you open /play/?moddev=1, choose A ready-made town or A copy of my town.
  • A ready-made town is a finished town: one resident with her own house, villagers, Nook's and the other shops, today's date. The game skips the title screen and you start standing in town at once. There is no train ride, no house to choose and no first job for Tom Nook. It is the same town every time, so a test can be repeated.
  • A copy of my town holds your town, its mod data and the mods you have installed, as they are at that moment. It starts at the title screen, like your real town.
  • Everything in the test town stays there: its saves, what scripts keep in store, items a command gives and mods you install while it runs.
  • The test town is kept between visits. Open /play/?moddev=1 again and it is where you left it.
  • Reset test town deletes it and the mods installed in it. A ready-made town starts again as new, in town at once. A copy asks again how to start. Your real town is not touched.
  • Leave dev mode loads the same address without ?moddev=1, and your real town starts as you left it. The test town is kept for next time. Opening /play/ without it does the same.
  • Cloud saves are off in the test town. It is never uploaded, and your cloud save is not changed or downloaded into it.
  • Your mods do not sync with your account. Mods you install in the test town are not added to your other devices.
  • Friend visits, hosting and The City are off. A visit would carry the test town, not your town. Moving a town to another device is off too.

Time tools #

Choose Time on the test town bar to move the game's clock. You can test a shop that opens at 1 AM, a calendar day or a day_started script without waiting.

  • The bar shows the date and time the game has now.
  • +1 hour and +1 day move the clock on from there. The minutes stay as they are.
  • Set the clock takes a date from 2001 to 2099 and a time.
  • A move into the next day starts a new day in the game, so day_started fires, as it does when a day begins in play.
  • The clock moves only while you stand in a scene, not on the title screen or during a scene change. The bar says so if it cannot.
  • The time tools work only in the test town, so they can never change your real town's clock.

One folder at a time #

  • Developer mode loads one folder. Its depends are checked like an installed mod's.
  • The folder counts as installed for the mods that need it. A library loaded here loads before your installed mods that depend on it.
  • To work on a library and a mod that needs it together, install one of them from its ZIP (playac-mod pack) and load the other here. Either way round works.
  • When you change the installed one, install its new ZIP and restart.

The Mod log #

Mod log is at the bottom of the Mods tab, under For mod authors. The section shows in any of these cases:

  • a mod you installed from a file has a script
  • the game was opened with ?moddev=1
  • a script logged an error, a stop or a refusal, or a script is stopped

A player who installed a mod from the mod list does not see it until something goes wrong.

The log updates while you play. For each mod it shows:

  • your script's log() lines
  • a script error with its traceback, which is each file and line the error came through
  • a script stopped for running too long or using too much memory, with the line it was on
  • anything the game refused, such as a good it cannot sell, a texture it cannot read, a command or a file developer mode would not load

You can filter the log by mod, copy it or clear it.

Mod log
script stopped: me.tea/main.lua:2: attempt to index a nil value (field 'missing')
stack traceback:
	me.tea/main.lua:2: in upvalue 'helper'
	me.tea/main.lua:5: in function <me.tea/main.lua:4>

The log keeps the last 400 lines and starts again when the game restarts. log() writes at most 20 lines per event and 500 per session.

The playac-mod tool #

playac-mod is a command line tool. It needs Node.js 18.17 or newer. It runs the game's own rules, so a mod that passes check installs.

The playac-mod tool covers installing it, every option of every command, exit codes and its changelog.

terminal
npm install -g https://github.com/Play-AC-Online/playac-mods/releases/download/cli-v1.1.0/playac-mod-1.1.0.tgz
CommandWhat it does
checkRuns every rule the game checks at install and reports every problem at once, each with its file. See what check finds.
packMakes <id>-<version>.zip next to the mod folder and prints its content hash. See what pack writes.
devServes the folder to the game's developer mode. Its usual port is 2604. When that port is taken, it uses the next free one and prints the address to put in the game's playac-mod dev address box.

What check finds #

  • A JSON error comes with its line and column.
  • check fails when the Mods tab would refuse the ZIP.
  • It also fails when the game would install the mod but stop its script at load. That is a Lua syntax error, or an on("x") for an event that is not in scripts.events.
  • The game's own Lua parser is built into the tool, so you do not need to install Lua.
  • Give it a .zip instead of a folder and it checks that ZIP exactly as the Mods tab reads it. That works for a ZIP you made by hand too.
  • --json prints the result for other tools.

check also warns about things the game accepts but you probably did not mean:

  • a texture the mod list would refuse when you share it, because it has mipmaps or a format the game cannot draw
  • a picture that is smaller than the texture it replaces, or not its shape
  • a .png and a .dds of the same texture
  • a cmd. call that is not in permissions
  • a shop good the game leaves out, or sells above your price
  • a file in the folder that a hand-made ZIP would carry and the game would refuse, such as an old ZIP. A repository file is never warned about: the game ignores it.
  • a packed file that nothing in mod.json points at, so the game never reads it

What pack writes #

  • The ZIP goes beside the mod folder, never inside it. Inside, a later hand-made ZIP would pick it up.
  • The ZIP has the same bytes every time. --out writes it somewhere else.
  • The repository files never go in, and the game ignores them in any ZIP. They are hidden files and folders (a name starting with a dot, such as .git, .github, .gitignore, .vscode, .playac and .DS_Store), __MACOSX, Thumbs.db and node_modules anywhere, and at the top of the mod README.md, CHANGELOG.md, LICENSE or LICENCE with any extension and the media/ folder.