Modding Development Tools: Lua Console!

If you liked this item, please rate it up on Steam Workshop page.

Author: Groove Wizard

Last revision: 7 Sep, 2022 at 23:57 UTC (1)

File size: 371.71 KB

On Steam Workshop

Description:

Happy Warhammer III! This one is a relatively simple mod, used for running Lua code within the game. Built heavily off of existing Creative Assembly scripts and UI files, which have been changed pretty majorly for further functionality.

How To Use

In-game, press "Shift+F3". This will open up the Lua Console window. From there, you can move the window around, type in your code into it, and execute it using the "Run" button. You can also use the "Clear" button to empty out the console completely.

You can run `console_print()` to print things out to the console (either from within the console, or within your external Lua files), or you can `return` things to get them printed out to the console. The console will also print out an error if any is found in your code.

Right now, there is support for only 8 lines of code, but each line can go as long as you would like. Next patch will include a vertical scroll so there can be a much higher limit of lines.

Any Lua variable that exists within the global scope (ie. it isn’t defined as "local") can be accessed within the Lua Console – it can trigger listeners, print out info, call "cm" if it’s available, and so on.

If you aren’t planning on using Lua, this mod probably isn’t necessary for you.

If you’d like easier-to-use commands, a la older Age of Empires games, use
https://steamcommunity.com/sharedfiles/filedetails/?id=2791241084.

API

The following global functions are added by this mod:

console_print(text) — prints out the text provided to the Console itself. console_printf(text, …) — prints out the text provided to the Console itself, after using string.format() on the text provided. You can use, for instance, `console_printf("My name is %s", "Charles")` to print "My name is Charles". More info at http://www.cplusplus.com/reference/cstdio/printf/ t_get(table, index) — returns the value found in the table at index. Long-hand workaround for `value = table[index]`. t_set(table, index, value) — sets the value to the table at index. Long-hand workaround for `table[index] = value`
Roadmap

Future updates will include Quality of Life improvements, as well as introductions of other forms of modding development tools – more ways to access game information, quick-use buttons to interact with the world similar to RimWorld’s development tools, etc.

Check out the planned updates, the progress, and download the updated packs at https://github.com/chadvandy/devtools

[discord.gg]

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.