Future development work for this script will be written in ts as possible. In long term, you can consider the lua files under <root>/bots/
folder are all generated by the ts scripts under <root>/typescript/bots/
.
Starting from here, please use typescript to write the bot logic in ts and build to generate the relative lua files.
- More about "Write Lua with TypeScript": https://typescripttolua.github.io/
- More about Typescript: https://www.typescriptlang.org/
- Do not use relative filepath when importing module files with functions like
require
ordofile
in a ts file. Make sure to use absolute filepath withbots/
as the root path. TLDR, this is because bot script lua files need to use absolute filepath for any non-in-same-folder path. - Always try to modify/update ts files first for any modification, because ts files can replace the lua files and override whatever you might have changed in lua files.
- When adding/moving files, create the files/folders in typescript in the same file structure as in the root bots folder.
- Install node.
- Install yarn.
npm install --global yarn
- Install dependencies.
yarn install
- Run a watcher process to keep re-compiling code for any newly saved changes in TS:
npm run dev
- Or, compile to generate lua files only once:
npm run build
- Or, compile to generate lua files only once:
- Before releasing a new version, run:
npm run release
, this is to auto update script version number, prettify typescript code, convert any possible changes in typescript to lua.