No description
- Lua 99.3%
- Python 0.7%
Unvanquished Map Scripts
Files to be loaded for all layouts should be placed in the root of this repo, with a subfolder created for that map if you need layout specific scripts.
For example:
condemned-pve.lua
condemned-pve/humanpve1.lua
Local Lua Scripting
To execute lua code locally (e. g. from the client console), one has to use the /luarocket "[code]" command. Unlike server-side lua it is currently unable to access files directly, so instead you need to use ProcessLua.py to generate cvars from lua code.
ProcessLua.py Usage
Input: luaCfgs.cfg
Input format:
Entry: `[name] [path]`
[name]: This will be usable for script execution after running the script. Must not contain spaces or characters not allowed in cvar names.
[path]: Path to the lua file. Must not contain spaces.
The input file may contain multiple entries, in this case each entry must be on a new line.
`//` is treated as a comment, and everything from that point and to the end of the line will be ignored
Output: luaCfgsProcessed.cfg, luaProcessed/*.cfg files corresponding to input entries
Output format:
Entry: `exec -q [path]`
[path]: The path to the processed cfg file containing the code from a single lua file.
Each entry corresponds to an entry in the input file.
[empty line]
Last line: `echo Loaded lua cfgs: [name] | ... | [name]`
Processed files:
Processed files are created with paths in the form of `luaProcessed/[filename].cfg`.
[filename]: The filename, including extension, of the input entry.
Each processed file contains a single line: `set [name] "luarocket \"[code]\""'
[name]: Same as the name of the corresponding input entry.
[code]: The entirety of the lua file.
Newlines, single-line comments (`--`), and block comments (`--[[]]`) are removed.
`"` is replaced with `'`.
All extraneous whitespaces are removed to keep the total character count down (console has a limitation to command size of ~1200 characters, the rest just gets cut off)
Execution:
- Run `ProcessLua.py`
- Use `exec -q luaCfgsProcessed.cfg`
- Each entry can be executed as `vstr [name]`
Note: The paths are assumed to be local because that's what exec uses, so the script is assumed to be in homepath/config/
Full example:
- Place `ProcessLua.py` in the `config` directory
- Create a file `luaCfgs.cfg` in the same directory with the following contents:
luaTest test.lua
- Create a file `test.lua` in the same directory with the following contents:
Cmd.exec( 'echo test' )
- In `autoexec.cfg` add the following:
set luaUpdateFromCfgs "exec -q luaCfgsProcessed.cfg"
vstr luaUpdateFromCfgs
- Run `ProcessLua.py`
- In-game, use `/vstr luaTest` after loading a map. `test` should be printed into the console.