modding-guide

Console Textsource Commands

As already mentioned, many ts commands can be found in the bit outdated testsourcelist.json file of the game. There you can also see what arguments for a function are expected and what it will return. But still not everything listed there can be used in the console and the console also might have a few things not listed there. So I use debug.getmetatable(ts) and our custom modlog function to dump all the content that can be used within the console. Since I did this within lua and all functions are in fact C functions, we can not get information about the arguments this way unfortunately.You can find the same also with help of the autocomplete feature of the console ingame.

Other console commands

Besides the textsrouce commands, there are also a few others (visible when you hit Tab==autocomplete on an empty console. Here the most relevant ones.

session.

userdata: funktionen (debug.getmetatable(session.getSelectedFactory()) bei schiff, sieht bei gebäude genauso aus) table (

condition.

game.

system. (geht wohl nicht mit getmetatable, aber da kurz einfach aus konsole abgeschrieben) wird genutzt um threads zu starten, siehe ein paar meiner skripte bzw. https://github.com/anno-mods/modding-guide/blob/main/Scripting/ReadAfterWrite.md

PropertyIDs

Usage for example with lua command

session.getObjectGroupByProperty(PropertyID)

which returns a list of userdata-Objects from the executing human player from the session he is currently in. The PropertyIDs are the position of the Properties in the properties-toolone.xml file, starting at 0.