Skip to content

TAS Movie Script Tutorial

Eddio0141 edited this page Mar 1, 2023 · 16 revisions

Prelude

The movie scripts accepted for UniTAS are lua 5.2 scripts, and this tutorial won't cover how lua works, but it should be simple to understand how it works with other tutorials on lua

A simple TAS

To start off, we'll make a simple TAS that just presses the space bar every frame for 3 seconds

MOVIE_CONFIG = {
    fps = 60
}

for i = 1, 30 * 3 do
    key.hold("Space")
    adv()
    key.release("Space")
    adv()
end

Let's break this down

MOVIE_CONFIG = {
    fps = 60
}

This is the configuration for the movie, and it's required to be defined before the first adv call

You can check out what's possible to configure in the TAS Movie API page


key.hold("Space")
adv()
key.release("Space")
adv()

This is the main part of the script, and in this case, key.hold and key.release are the methods that are used to hold and release a keyboard key

and adv is the method that is used to advance the frame in the movie


If you script looks like this

-- first frame
adv()
-- second frame

The first frame is ran BEFORE the adv() call, and the second frame is ran AFTER the adv() call, in total, the script will run for 2 frames

If you want to check out what other methods are available, you can check out the TAS Movie API page

Advanced stuff

// TODO write about the scope of the program and how to disable it

Clone this wiki locally