query

Searches every resource of a type across the install by its fields: every creature template with Appearance_Type 80, every item of a base type. GFF3 templates (.utc, .uti, .utp, .utt, .are) and GFF4 files (.plo, .dlg, …) are read: of each resource the copy the game takes, or every copy with copies all. Answers the matches with the fields asked and the copy each is in, a count of all, and with group_by the counts by a field’s value. Copies in enciphered add-in archives are counted, not searched. resource on a match shows its every field.

Read-only: it writes nothing.

Arguments

Name Type Required What
type string yes The files’ extension: utc (creatures), uti (items), utp, plo, dlg, …
where object   Fields and the values they must have: {“Appearance_Type”: 80}. A bare name is found at the top or in the nearest structs below that have it, a list’s elements among them; a dotted path names one (“Appearance Data.Appearance_Type”), and through a list (“StageCameraList.StageCameraLookingAtType”) each element. A field matches where any of its values does, and a match says which elements in matched. A localised name matches its string id; an array matches any of its values. Default: every file.
fields array   Fields to answer each match with; one through a list answers every element’s value.
group_by string   A field: count the matches by its value; through a list, each element’s value.
source string   Only copies in this source.
copies "game" | "all"   game (default): of each resource the copy the game takes; all: every copy, the ones it shadows and does not have too.
depth integer (≥ 1)   How deep nested fields are read. Default 6.
items integer (≥ 1)   The most elements of a list read. Default 100.
limit integer (≥ 1, ≤ 5000)   The most to return. Default 50.
offset integer (≥ 0)   How many to skip first, to page through a long answer. Default 0.

Call it as query over MCP, or from a shell as ghilana.exe --call query '<arguments as JSON>'.