Pages

AI profile names

How [ai_profiles] names, or hides, the mod's TA AI profile files in the lobby's AI PROFILE drop-down.

[ai_profiles] gives the mod's TA AI profile files the names the lobby shows, and can hide one from the list. You need it when the files' stems (urban, template) are not what players should read.

The worked example

[ai_profiles]
acid     = "Acid"
missions = "Missions"
template = { name = "Template", hidden = true }
"air battle" = "Air Battle"   # a stem with a space is quoted

How the lobby names a profile

The lobby's AI PROFILE drop-down lists every TA AI profile file the mounted data has (ai/*.txt, or the mod's renamed AI folder such as Escalation's aE/). A file the mod serves shows as <short_name or name>: <profile>; a file stock TA serves shows as TA: <file stem>. [ai_profiles] gives <profile>: each key is a file stem (urban for Urban.txt; letter case is ignored), each value either the name or a table:

Key Type Description
name string The name the lobby shows. Absent: the file stem.
hidden boolean true: not listed in the drop-down. A map whose schema names the file still suggests it, and a seat playing it lists it (docs/aex-features/skirmish-opponent.md). Absent: false.

A file the table does not name shows its stem exactly as it is on disk.

  • A value that is neither a string nor a table, an empty name, a name that is not a string or a hidden that is not a boolean skips that entry with a warning; the file shows its stem.
  • A table key other than name or hidden is ignored with a warning.
  • Two keys that differ only in letter case name one file: the first (in byte order) is kept and the other warns.
  • Inline tables ({ ... }) stay on one line; [ai_profiles.template] sections work too.

What goes wrong

The profile shows by its stem, and aex.log has the reason:

[mods] <mod folder>: field 'ai_profiles.acid' is empty; the file shows by its stem
[mods] <mod folder>: field 'ai_profiles.acid' must be a string or a table with 'name'; ignored
[mods] <mod folder>: field 'ai_profiles.template.hidden' must be a boolean; the entry is ignored
[mods] <mod folder>: unknown field 'ai_profiles.template.label'; ignored
[mods] <mod folder>: 'ai_profiles.ACID' names the same file as another entry (stems ignore letter case); ignored

ai_profiles written as anything but a table logs field 'ai_profiles' must be a table; ignored.

Next