Skip to content

Getting Started

In order to start using autoplay2c, you'll need two programs. They always come together, in the same folder:

Program What it is
autoplay2c (autoplay2c.exe) The desktop application. You set up a project in it and build it with one click.
a2c (a2c.exe) The command line compiler. The application uses it for every build, and you can use it in your own build scripts.

Installation

On Windows, run autoplay2c-<version>-windows-x64-setup.exe. It needs 64-bit Windows 10 or later, and it asks whether to install for you alone (no administrator rights needed) or for everyone on the computer. The installer puts both programs and tcc in one folder and associates .autoplay2c project files with the application, so double-clicking one opens it. If the previous version of autoplay2c is installed, the installer tells you and removes it first. Your projects aren't touched. See Coming From the Previous Version.

If you'd like to run a2c from any command prompt or build script, tick Add a2c to the PATH while installing. It adds the install folder to your PATH, or the system's when you install for everyone, and uninstalling takes it out again.

Linux and macOS

autoplay2c runs on Linux and macOS too, but there are no packages for them yet. For now, the Windows installer is the only download.

Note

Keep autoplay2c and a2c in the same folder. The application doesn't compile anything itself: it runs the a2c next to it, and it refuses to build when that a2c is of another version.

That's all you need. autoplay2c writes Windows DLLs itself, on every platform, without a C compiler. There's an optional C backend that uses tcc, but you'll only need it in rare cases. Read more in Backends.

Your First AutoPlay Project

  1. Start autoplay2c.
  2. On the Project page, choose your .autoplay file as the Input, or drop it on the window. The target follows from the version of AutoPlay Media Studio that saved the project.
  3. Click Build, or press Ctrl+B.

The log shows you what happens during the build. When the build finishes, you'll find two new files next to your project:

File What it is
CD_Root\AutoPlay\Scripts\<module>.dll The module, with all your scripts compiled into it.
<project>.a2c.autoplay The rewritten project, which calls the module.

Open <project>.a2c.autoplay in AutoPlay Media Studio, preview it, and publish it as usual. Your original project is never changed.

To build the same way next time, save your settings with Ctrl+S. This writes an .autoplay2c project file next to your project. Read more in Project Files.

From the command line, the same build looks like this:

a2c build MyProject.autoplay

Your First Lua Module

A plain Lua file becomes a module DLL. Since a Lua file doesn't say which host it's for, you'll have to pick a target:

a2c build tools.lua --target suf9-x86

This writes tools.dll next to tools.lua. Put it where your host's require finds it, and load it like you would any other module:

local tools = require "tools";
tools.DoSomething();

In the application it works the same way: choose the Lua file as the input, choose a Target, and build. Read more in Lua Modules.

That's It!

It's as simple as that. From here on, these topics are worth a read: