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.
npm install -g https://github.com/Play-AC-Online/playac-mods/releases/download/cli-v1.1.0/playac-mod-1.1.0.tgzThis installs release 1.1.0 of the tool from its GitHub release in playac-mods. The SHA-256 of that file is:
ffb77f79497d4afe999fbaa3a3b9912c165c728a40008108b0339549ed1a5560To check it yourself, download the file, compare its SHA-256 and install the file you checked:
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.tgzCheck that it worked:
playac-mod --version
playac-mod helpIf the install fails #
| What you see | What 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-mod | Something asked the npm registry for the tool by its name. Use the install line above. |
playac-mod needs Node.js 18.17 or newer | Your 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.
| Command | What it does |
|---|---|
check | List every problem the game would find. |
pack | Write the mod's ZIP. |
dev | Serve the folder to the game and reload on edits. |
check #
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 option | What it does |
|---|---|
[folder | file.zip] | A mod's folder or a mod ZIP. Default: the current folder. |
--verbose | Also list the files pack leaves out. |
--json | Print the result as JSON. |
--no-lua | Skip the Lua syntax check. |
playac-mod check
playac-mod check ../yourname.my-mod-1.0.0.zippack #
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 option | What it does |
|---|---|
[folder] | The mod's folder. Default: the current folder. |
--out <file.zip> | Write the ZIP here instead. |
--json | Print the result as JSON. |
--no-lua | Skip the Lua syntax check. |
playac-mod packdev #
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 option | What 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-lua | Skip the Lua syntax check. |
playac-mod devOptions every command takes #
--help | Show the command's options. Short: -h. |
--version | Print the version. Short: -v. |
An option a command does not have is refused by name. Nothing runs.
Exit codes #
| Code | Meaning |
|---|---|
0 | It worked. |
1 | The mod has problems. |
2 | The 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 #
checkreads 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 --versionnames it:API level 1.1.- When
checkmeets 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. checkknows the permissionset_hat, forcmd.set_hat: a mod puts a 32 x 32 picture from its own files on the player's hat.checkknows the permissionset_shirt, forcmd.set_shirt: the same, on the player's shirt.- With
set_hatorset_shirtin its permissions, a mod's 32 x 32 PNG files are not called unused: the script names them, notmod.json. A PNG of any other size still is, andchecksays those two commands take only 32 x 32. checkknows the permissionreact, forcmd.react: a mod plays one of the reactions bar's reactions on the player's own character. It knows the eventplayer_actedtoo.- A script may list
button_pressedandbutton_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
permissionsmay listsave, and a script may callcmd.save(): it asks the game to save the town where the player could save at Gyroid.checkknows 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()andgame.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
permissionsmay listplay_sound, and a script may callcmd.play_sound(name): it plays one of the game's own sound effects, by its name insounds.json, for the mod's own player.checkknows the command, its permission and its refusal codes (command-sound-cap,command-no-sound), and warns about a sound namesounds.jsondoes not have. - A mod's
permissionsmay listset_weather, and a script may callcmd.set_weather(kind, intensity): it sets the town's weather for the rest of the game day.checkknows the command, its permission, that it needs"scope": "world"and its refusal codecommand-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
checkaccepts and refuses is unchanged. - The API notes for
show_lineandasknow 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,devandpack.playac-mod helplists them, andplayac-mod <command> --helpshows a command's options, one per line. An option a command does not have is refused by name. checkreads 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 theirscope,renames, calendar dates, an items file'stexturesfolder (up to 16.pngor.ddsfiles named after the base's textures, outsidecontent.textures), and the events and permissions a script names.checkreads a talk file's pools by the game's rules,season(spring, summer, fall, winter),time(morning, day, evening, night) andweather(clear, rain, snow) included, and refuses any other value (talk-when). It reads each pool'splace(talk-place),topics(talk-topics) andday, 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 listvillager_answered.checkreads a texture name with or without a label in front, as inbookshelf-top_tex1_32x32_626709d910129694_$_8.png: 1 to 40 lowercase letters, digits and dashes, then one underscore. The game matches on thetex1_part only.checkrefuses a label that breaks that rule, and a labelled file that is the same texture as another file in the same folder.checkreadsshops.jsonby shop id: each shop in the shop table takes one block or a list of blocks, withwhen,open,own_goods,goods,price_percent,buy_back_percent,services,nameandlines. 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 permissionsset_shop_goodsandset_shop_open.checkrefuses what the game and the site refuse: a JSON file that is not UTF-8, a.luaor.jsonfile 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, arenamesentry whose old id is not this mod's own,content.translations, and acontent.messagesthat names a folder.checkreads a script the way Lua does: line ends, string escapes,onwith spaces around the dot, and a script that defines its ownon. It warns when a script callstimer.afterwithouttimer_firedinscripts.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 unknowncmd.name stops the script for the session.devserves 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 andhttp://localhost:5173.--originadds another. A page it refuses reads why, and the terminal prints the--originto add.devprints 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:).packleaves out a mod repository's own files, the same list the game ignores in any ZIP: hidden files and folders, and at the topREADME.md,CHANGELOG.md,LICENSEand themedia/folder.checkdoes not warn about them.packprints one hash, the content hash. The ZIP's own SHA-256 is inpack --json.--versionprints 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.luain 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.