The playac-mod tool

playac-mod is a command line tool. It checks a mod with the game's own rules, packs the ZIP, and reloads your mod in the game as you save.

You do not need it to make a mod. Installing a ZIP in the Mods tab runs the same checks. It saves time once you write scripts or make more than one mod. Start a mod from an example or a starter kit. Share it from the site, see Publishing.

Install it #

You need Node.js 18.17 or newer. Run node --version to see which you have. If you have none, see Set up your computer.

terminal
npm install -g https://github.com/Play-AC-Online/playac-mods/releases/download/cli-v1.1.0/playac-mod-1.1.0.tgz

This installs release 1.1.0 of the tool from its GitHub release in playac-mods. The SHA-256 of that file is:

SHA-256
ffb77f79497d4afe999fbaa3a3b9912c165c728a40008108b0339549ed1a5560

To check it yourself, download the file, compare its SHA-256 and install the file you checked:

terminal
curl -fLO https://github.com/Play-AC-Online/playac-mods/releases/download/cli-v1.1.0/playac-mod-1.1.0.tgz
shasum -a 256 playac-mod-1.1.0.tgz                  # macOS, Linux
certutil -hashfile playac-mod-1.1.0.tgz SHA256      # Windows
npm install -g ./playac-mod-1.1.0.tgz

Check that it worked:

terminal
playac-mod --version
playac-mod help

If the install fails #

What you seeWhat to do
EACCES: permission denied (macOS, Linux)Node.js was installed for the whole computer. Install Node.js with nvm, then run the install line again (how). Putting sudo in front also works, but every later update needs it too.
playac-mod: command not found, or "not recognized"Open a new terminal window. If it is still missing, run the install line again.
"running scripts is disabled on this system" (Windows PowerShell)Use Command Prompt, or run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
npm error 404 naming registry.npmjs.org/playac-modSomething asked the npm registry for the tool by its name. Use the install line above.
playac-mod needs Node.js 18.17 or newerYour Node.js is too old. Install the current LTS and open a new terminal.

Two setup guides cover more causes, step by step for macOS, Windows and Linux. They are Node.js and the playac-mod tool and Troubleshooting.

Commands #

Every command works on the current folder unless you name another. playac-mod help prints this list, and playac-mod <command> --help prints one command's options.

CommandWhat it does
checkList every problem the game would find.
packWrite the mod's ZIP.
devServe the folder to the game and reload on edits.

check #

terminal
playac-mod check [folder | file.zip] [options]

Applies the game's rules and lists problems per file. Lua syntax is checked by the game's own parser.

Argument or optionWhat it does
[folder | file.zip]A mod's folder or a mod ZIP. Default: the current folder.
--verboseAlso list the files pack leaves out.
--jsonPrint the result as JSON.
--no-luaSkip the Lua syntax check.
terminal
playac-mod check
playac-mod check ../yourname.my-mod-1.0.0.zip

pack #

terminal
playac-mod pack [folder] [options]

Checks the mod, then writes <id>-<version>.zip beside the folder. The same files always give the same ZIP.

Argument or optionWhat it does
[folder]The mod's folder. Default: the current folder.
--out <file.zip>Write the ZIP here instead.
--jsonPrint the result as JSON.
--no-luaSkip the Lua syntax check.
terminal
playac-mod pack

dev #

terminal
playac-mod dev [folder] [options]

Open the game with ?moddev=1, go to Settings, Mods, Developer, Load a mod you are making, press Connect, then Restart now once.

It prints a line when the game connects, loads the mod, reloads a file, and disconnects.

Listens on this computer only. Ctrl+C stops it.

Argument or optionWhat it does
[folder]The mod's folder. Default: the current folder.
--port <number>Port to listen on. Default: 2604, or the next free one.
--origin <url>...Also allow a game page at this address.
--no-luaSkip the Lua syntax check.
terminal
playac-mod dev

Options every command takes #

--helpShow the command's options. Short: -h.
--versionPrint the version. Short: -v.

An option a command does not have is refused by name. Nothing runs.

Exit codes #

CodeMeaning
0It worked.
1The mod has problems.
2The command line was wrong.

check --json and pack --json print JSON for other tools. check prints each problem with its file and a link to its page in Errors.

Versions and updates #

playac-mod --version prints the version and the build, like playac-mod 1.1.0, build 1a2b3c4d5e6f. A version is three numbers. The middle one goes up when the rules, the API level or a command changes. The last one goes up for fixes. A release never changes after it is listed. The release list gives every release with its SHA-256. Each release is a file of a GitHub release of the public playac-mods repository.

To update, run the install line of the newest release. The tool does not check for one itself.

Editor types for scripts are one file, api/playac.lua in the public repository. See Set up your computer.

Changelog #

This is the tool's own changelog. The API changelog lists what each API level holds.

1.1.0 #

  • check reads mod API 1.1. A minor version adds names and changes nothing else, so a mod that uses the names below still says "api": 1. playac-mod --version names it: API level 1.1.
  • When check meets a command or event it does not know, it also says which API version the tool knows and that a newer name needs a newer playac-mod.
  • check knows the permission set_hat, for cmd.set_hat: a mod puts a 32 x 32 picture from its own files on the player's hat.
  • check knows the permission set_shirt, for cmd.set_shirt: the same, on the player's shirt.
  • With set_hat or set_shirt in its permissions, a mod's 32 x 32 PNG files are not called unused: the script names them, not mod.json. A PNG of any other size still is, and check says those two commands take only 32 x 32.
  • check knows the permission react, for cmd.react: a mod plays one of the reactions bar's reactions on the player's own character. It knows the event player_acted too.
  • A script may list button_pressed and button_released: the player pressed or let go of a button. A keyboard key, a controller button and the touch pad are the same button, so one handler covers them all.
  • game.input() is known to the Lua types, at every level: the buttons held now and the main stick, each from -1 to 1.
  • A mod's permissions may list save, and a script may call cmd.save(): it asks the game to save the town where the player could save at Gyroid. check knows the command, its permission and its refusal codes (command-indoors, command-busy, command-dream, command-not-ready, command-too-soon, command-save-failed).
  • game.weather() and game.place() are known to the Lua types, at every level. The weather where the player is (clear, rain or snow, and how hard), and where they are: the scene and, outdoors, the acre as the town map names it and the square inside it.
  • A mod's permissions may list play_sound, and a script may call cmd.play_sound(name): it plays one of the game's own sound effects, by its name in sounds.json, for the mod's own player. check knows the command, its permission and its refusal codes (command-sound-cap, command-no-sound), and warns about a sound name sounds.json does not have.
  • A mod's permissions may list set_weather, and a script may call cmd.set_weather(kind, intensity): it sets the town's weather for the rest of the game day. check knows the command, its permission, that it needs "scope": "world" and its refusal code command-weather, and warns when a script that reads a client setting also sets the weather.

1.0.1 #

  • Carries the game's newer rules file, which talks to the page through its bridge. What check accepts and refuses is unchanged.
  • The API notes for show_line and ask now say what the player sees: a message box with no one speaking, like the game's own "My pockets are full!".

1.0.0 #

  • Three commands: check, dev and pack. playac-mod help lists them, and playac-mod <command> --help shows a command's options, one per line. An option a command does not have is refused by name.
  • check reads a mod folder by the game's own rules, from the tool's own folder only: mod.json, every data file, optional_depends, settings and their scope, renames, calendar dates, an items file's textures folder (up to 16 .png or .dds files named after the base's textures, outside content.textures), and the events and permissions a script names.
  • check reads a talk file's pools by the game's rules, season (spring, summer, fall, winter), time (morning, day, evening, night) and weather (clear, rain, snow) included, and refuses any other value (talk-when). It reads each pool's place (talk-place), topics (talk-topics) and day, which must be a day of the mod's calendar file (talk-day), and a line that is a list of up to 8 pages. A script may list villager_answered.
  • check reads a texture name with or without a label in front, as in bookshelf-top_tex1_32x32_626709d910129694_$_8.png: 1 to 40 lowercase letters, digits and dashes, then one underscore. The game matches on the tex1_ part only. check refuses a label that breaks that rule, and a labelled file that is the same texture as another file in the same folder.
  • check reads shops.json by shop id: each shop in the shop table takes one block or a list of blocks, with when, open, own_goods, goods, price_percent, buy_back_percent, services, name and lines. It warns about a good a shop's spots cannot hold and a price the game raises to its floor, refuses furniture the game has no model for (shop-item-no-model), and knows the permissions set_shop_goods and set_shop_open.
  • check refuses what the game and the site refuse: a JSON file that is not UTF-8, a .lua or .json file with a carriage return no line feed follows (file-lone-cr), an unknown key in a calendar date, a setting label or description with a character a reader cannot see, a renames entry whose old id is not this mod's own, content.translations, and a content.messages that names a folder.
  • check reads a script the way Lua does: line ends, string escapes, on with spaces around the dot, and a script that defines its own on. It warns when a script calls timer.after without timer_fired in scripts.events, when a script that reads a client setting also sends a letter, gives an item or takes an item or Bells, and says an unknown cmd. name stops the script for the session.
  • dev serves a folder to the game and prints the steps that load it: open the game with ?moddev=1, go to Settings, Mods, press Connect, then Restart now once. It answers game pages at playaconline.com, its dev site and http://localhost:5173. --origin adds another. A page it refuses reads why, and the terminal prints the --origin to add.
  • dev prints a line when a game page connects (connected:), when a boot runs the mod (loaded in the game:), when the game takes a saved file live (reloaded <file>), and when the page goes away (disconnected:).
  • pack leaves out a mod repository's own files, the same list the game ignores in any ZIP: hidden files and folders, and at the top README.md, CHANGELOG.md, LICENSE and the media/ folder. check does not warn about them.
  • pack prints one hash, the content hash. The ZIP's own SHA-256 is in pack --json. --version prints the build as well as the version.
  • Start a mod from an example repository or a starter kit, and share it from the website, by upload or "Import from GitHub". The editor types are api/playac.lua in the public mods repository.
  • The tool's releases are files of GitHub releases of the playac-mods repository. The package carries its licence and this changelog.

Source #

The tool's source is in the cli folder of the public repository, under the MIT licence. Report a bug in it there.