benilla-re systems structs docs

Script::GetTrainerSelectionIndex

function · ui · primitive

Address
0x4d8f10 · 42 bytes, up to 0x4d8f39
Signature
int __fastcall (lua_State *L)
Meaning
Returns the 1-based array position of the selected service, 0 for none
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/trainer#selection

Finding: Selection in ui: the trainer window

The selection is the spell id of the chosen record. SelectTrainerService(index) truncates the index, subtracts 1 and stores that record's id; an index below 1 or at the total length or above clears the selection. A hidden record can be selected. GetTrainerSelectionIndex() searches the whole array for the stored id and returns its 1-based position, or 0 when the id is 0, the array is empty or the id is absent. A trained row leaves the visible list but stays in the array, so the index it returns is then above GetNumTrainerServices(). A group header holds -1, so selecting one reads back the first header.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.