Function; SobGroup_FilterInclude - HWRM/KarosGraveyard GitHub Wiki

SobGroup_FilterInclude(<sOutputSobGroupName>, <sFilterSobGroupName>, <sFilterType>, <sFilterParam>)

Description

Extremely useful catch-all function for finding most things out about a given group. Used heavily in kasutil.lua. Note: string arguments passed for sFilterType and sFilterParam are case insensitive.

Example

-- fills "ships-with-repair-ability" with any ships in "my-group" who have `AB_Repair` set to active
SobGroup_FilterInclude("ships-with-repair-ability", "my-group", "ability", "command_repair")
-- fills "ships-currently-repairing" with any ships in "my-group" who currently have commands to repair something
SobGroup_FilterInclude("ships-currently-repairing", "my-group", "currentcommand", "command_repair")

Arguments

Arg Type Description
sOutputSobGroupName string The name of the group to fill with the filtered ships from sFilterSobGroupName
sFilterSobGroupName string The target group to filter into sOutputSobGroupName via the preceding arguments.
sFilterType string* The attribute to filter, such as "Ability"
sSpecificFilter string* The specific ability/command/etc to filter for, such as "CloakCommand"

Only specific strings are accepted for sFilterType and sSpecificFilter.

Filter Type Stock Filter Params Notes
"Ability" "SalCapCommand", "RepairCommand", "CustomCommand", "MoveCommand", "CloakAbility", "CanDock", "HyperspaceCommand", "ParadeCommand", "CanBuildShips" Ability names as used in .ship files as arguments for addAbility
"CurrentCommand" "COMMAND_Attack", "COMMAND_SalCap", "COMMAND_Dock", "COMMAND_Hyperspace", "COMMAND_Launch" Seemingly the same list with a different syntax; these lists are unlikely to actually align as one deals with capabilities, and the other with currently active abilities.
"CurrentCommandState" "SALCAPSTATE_ReturningToBaseWithTech", "LAUNCHSTATE_Queue" Unknown.
"NoFilter" Unknown.
"attackfamily" Presumably any valid attack family. See the FamilyList variable reference.
"displayfamily" Presumably any valid display family. See the FamilyList variable reference.

sFilterType may also potentially be one of these:

ShipClass
AutoformationFamily
UnitCapsFamily
ScriptFlagsSetAll
ScriptFlagsSetAny
Health
Awake
ScriptFlagsUnset
NearPoint
SquadronList

Credit to this post on the GBX forums.

Related Pages

Comments

Pretty esoteric; no proper reference exists for the potential values of args 3 and 4.

Page Status

  • Updated Formatting? N/A
  • Updated for HWRM? N/A