A Controllable is the X4 engine abstract class for entities that have a pilot, crew, and order queue — ships and (via Defensible ) stations and modules with control. The class adds command hierarchy (commander/subordinates/fleet), order queue semantics, and scanner/software integration on top of Object .
Inheritance: object → controllable. Direct subclass: Defensible (which in turn is parent of Ship/Station).
Identifies the NPCs piloting/operating the controllable:
Property Type Description .pilotentity Pilot entity currently active .assignedpilotentity Assigned pilot (may not currently be piloting) .aipilotentity AI pilot entity .assignedaipilotentity Assigned AI pilot .defencenpcentity Defence control entity .tradenpcentity Trade control entity .tradecomputerentity Trade computer (player-controlled ship) .engineerentity Engineer entity .shiptraderentity Shiptrader entity .shadyguyentity Shady guy (Pirate-DLC criminal NPC) .controlentity.defaultentity Main control entity .controlentity.{$controlpost}entity Control entity at a specific control post .controlposts.alllist All control posts for this object .controlposts.freelist All unoccupied control posts .controlposts.{$entity}list Control posts the entity can take .controlroomroom The control room (or null) .controlpostslot.{$controlpost}componentslot Slot for the entity at that control post .slotactor.{$componentslot}entity Actor reserved for the specified NPC slot
The order queue is the central controllable behavior. See Order for full details.
Property Type Description .orderorder Current order (queue head or default) .nextorderorder Next order in queue .defaultorderorder Default order if present .orderslist All orders in queue (current first) .buildorderslist Build/repair-related orders only .tradeorderslist Trade-related orders only .hasorderloopboolean Are orders looping? (UI-only — read from MD, not settable) .hasblacklist.{type}.{group}boolean Blacklist of given type+group exists
For fleet management:
Property Type Description .commandercontrollable Commander (if subordinate) .toplevelcommandercontrollable Top-level commander (root of hierarchy) .commanderentityentity Commander entity .assignmentassignment This subordinate’s assignment under commander .canuseassignment.{$assignment}.{$controllable}boolean Can use that assignment under specified commander .canhavecommander.{$component}boolean Can $component be a commander for this .subordinateslist Direct subordinates .subordinates.{$assignment}list Subordinates with specific assignment .allsubordinateslist All subordinates (recursive) .allcommanderslist All commanders in chain .activesubordinategroupidslist Subordinate groups with assigned ships .subordinategroupidinteger This object’s subordinate group ID .subordinategroupassignment.{$id}assignment Assignment of subordinate group .subordinategroupprotectedsectorsector Sector being protected by detached group (positiondefence only) .subordinategroupprotectedpositionposition Position being protected .subordinategroupdockoverrideboolean Always dock at commander? .subordinategroupreinforcefleetboolean Reinforce other groups when engaged? .subordinategrouprespondtodistresscallsboolean Respond to faction distress? .subordinategroupresupplyatfleetboolean Repair/resupply at fleet? .subordinategroupattackonsightboolean Attack hostiles on sight?
Property Type Description .fleet.namestring Fleet name (empty if not a fleet commander) .fleet.iscommanderboolean Is this a fleet commander? .fleet.commandercontrollable Top-level fleet commander .fleetunitfleetunit Fleet unit if this is a rebuild replacement .fleetunitslist Fleet units for this fleet
Tracks crew/personnel as NPC templates (lower memory than actual NPCs):
Property Type Description .people.{$npctemplate}npctemplateentry NPC template entry for specific template .people.countinteger Number of people on board .people.freeinteger Free space for more people .people.capacityinteger Max capacity .people.listlist All people on board .people.{$entityrole}.listlist People with specific role .people.{$entityrole}.countinteger Count per role .people.{$entityrole}.combinedskillinteger Combined skill across role (0-100)
Property Type Description .roleentity.{$seed}entity Entity representing seed-based person .roleentity.{$npctemplate}entity Entity representing template-based person .roleentitieslist All instanced role entities .isnpcassignmentrestrictedboolean Is this object restricted from NPC assignment? .canhavecontrolentity.{$controlpost}boolean Can have control entity at that post? .waypointactors.{$componentslot}list Actors moving toward that waypoint
Property Type Description .hasscannerboolean Has scanner software .longrangeboolean Has long-range scanner .maxscanlevelinteger Maximum scan level .software.compatiblewarelist Compatible software wares .software.defaultwarelist Default-installed software .software.installedwarelist Currently installed software .software.dockware Dock assist software installed .software.longrangeware Long range scanner installed .software.policeware Police scanner installed
Property Type Description .haswalkableroomboolean Has rooms accessible to player/NPCs .canhavedynamicinteriorboolean Can contain a dynamic interior
< set_value name = " $pilot " exact = " $ship.aipilot " />
< do_if value = " $ship.order.id == 'Patrol' " >
<!-- ship is on a patrol order -->
< do_for_each name = " $sub " in = " $commander.subordinates " >
< do_if value = " $sub.iscapitalship " >
<!-- this is a capital sub -->
< do_if value = " $potentialcommander.canhavecommander.{$candidate} " >
<!-- candidate can command this ship -->
⚠ .hasorderloop is UI-only — readable but NOT settable from MD/aiscript. Engine-side flag; see Repeat Orders UI gotcha in Wiki
⚠ .commander returns the DIRECT commander, NOT the top-level fleet commander. Use .toplevelcommander for the fleet root.
⚠ .order returns null if no orders are running — null-check before accessing .order.id.
⚠ .subordinates is direct only. Use .allsubordinates to walk the full hierarchy (recursive).
⚠ Slots and roles can be filled by actors that don’t actually appear — use .slotactor carefully.
⚠ .controlentity.{$controlpost} returns null if no entity is currently at that post. Check .controlposts.free first.
└── controllable ← this class
└── defensible (defensive abilities — shields/surfaces)
├── ship (mobile entities with full pilot crew)
└── station/module (some — those with control posts)
Action Purpose <create_order>Add an order to the order queue <cancel_order>Cancel a specific order <cancel_all_orders>Clear the entire order queue <set_default_order>Set the default order <set_assignment>Set this controllable’s assignment under commander <assign_control_entity>Assign an entity to a control post <release_control_entity>Release an entity from a control post <add_to_group>Add this controllable to a subordinate group
Controllable is one of the most-used engine classes — modders interact with it constantly via ships and station-control-posts. The order queue and fleet hierarchy are the central modeling concepts.