CampaignUI
The CampaignUI script object is created automatically when the campaign UI loads, and offers a suite a functions that allow scripts to query and customise bits of the UI. It does not need to be created by script, and the functions it provides may be called directly on the object in the following form.
Example:
					CampaignUI.<function_name>(<args>)
				| Loaded in Campaign | 
										 | 
								
| Loaded in Battle | 
										 | 
								
| Loaded in Frontend | 
										 | 
								
- 
							
CampaignUI.EnableCinematicMode(enableboolean) - 
							Enables or disables cinematic mode, if it is not already enabled/disabled respectively. When enabled, cinematic mode shows cinematic borders, hides the UI, and steals/prevents most user input.
							
Parameters:
1
enable
Returns:
nil
 
- 
							
CampaignUI.IsCinematicModeEnabled() - 
							Returns whether cinematic mode is currently enabled.
							
Returns:
cinematic mode is enabledboolean
 
- 
							
CampaignUI.ToggleScreenCover(enable coverboolean) - 
							Creates or destroys a black screen cover (when not eyefinity).
							
Parameters:
1
enable cover
Returns:
nil
 
- 
							
CampaignUI.ClearSelection() - 
							Clears the current ui selection, ensuring that no settlements or characters are selected by the player.
							
Returns:
nil
 
- 
							
CampaignUI.SelectObject(- the CQI of the object
number,- the TYPE of the object ("character"
string,- zoom or not to object location
boolean
) - 
							Selects an object by CQI and TYPE, and optionally zooms to his location
							
Parameters:
1
- the CQI of the object
2
"region", "settlement")
3
- zoom or not to object location
Returns:
nil
 
- 
							
CampaignUI.SelectSettlement(settlement cqinumber,show ERS panelboolean) - 
							Selects a settlement within the UI. The settlement is specified by cqi.
							
Parameters:
1
settlement cqi
2
show ERS panel
Returns:
nil
 
- 
							
CampaignUI.SetOverlayVisible(activate overlayboolean) - 
							Sets the campaign overlay to be visible or not. The campaign overlay colourises regions on the campaign map display for various purposes (it is used by the tactical map, for example). The overlay mode to display, and what regions to display it on, should be set with 
CampaignUI.SetOverlayModebefore activating the overlay with this function.Parameters:
1
activate overlay
Returns:
nil
 
- 
							
CampaignUI.SetOverlayMode(overlay modenumber, ...region(s)) - 
							Sets the overlay mode to display by numeric id, and one or more regions to display it across by region key. Multiple region keys may be specified with separate arguments. Calling this function has no effect until the overlay is subsequently enabled with 
CampaignUI.SetOverlayVisible.
Valid overlay mode ids:
overlay mode id description 
0DIPLOMACY_STATUS1DIPLOMACY_ATTITUDE_FACTION2DIPLOMACY_ATTITUDE_OWNER3RADAR4HISTORICAL_OWNERSHIP5REGION_WEALTH6REGION_GROWTH7REGION_HAPPINESS8REGION_SLAVES9REGION_FERTILITY10REGION_SANITATION11REGION_FOOD12REGION_GOVERNORSHIP13WINDS_OF_MAGIC14CLIMATE_SUITABILITY15GEOMATIC_WEB16TUTORIAL_REGION_HIGHLIGHT17REGION_INFLUENCE18REGION_CITIZENS19REGION_SARPEDON_RARE_RESOURCE20GODS_APHRODITE21GODS_APOLLO22GODS_ARES23GODS_ATHENA24GODS_HERA25GODS_POSEIDON26GODS_ZEUS27SACRED_EGYPTIAN_LANDS28SACRED_HATTI_LANDS29REALMSParameters:
1
Overlay mode (see lookup table above).
2
...One or more
stringregion keysReturns:
nil
Example:
CampaignUI.SetOverlayMode(20, lothern_region_str, glittering_tower_region_str, tower_of_lysean_region_str)
CampaignUI.SetOverlayVisible(true)
 
- 
							
CampaignUI.SuppressAllEventTypesInUI(enable suppressionboolean) - 
							Enables or disables a suppression lock that prevents any event messages being shown on the UI. Once the lock is enabled, individual event types may be whitelisted for display with 
CampaignUI.WhiteListEventTypeInUI, at which point they will bypass the suppression.Parameters:
1
enable suppression
Returns:
nil
 
- 
							
CampaignUI.WhiteListEventTypeInUI(event typestring) - 
							Whitelists an event type to bypass suppression activated by 
CampaignUI.SuppressAllEventTypesInUI. Event types to be whitelisted are specified by a compound key from theevent_feed_targeted_eventstable - the key must be specified by concatenating theeventandtarget>field values for a given record from that table. Currently valid examples might include"faction_event_mission_issuedevent_feed_target_mission_faction"or"scripted_persistent_located_eventevent_feed_target_faction". Whitelisting an event type has no effect if suppression has not been enabled.Parameters:
1
event type
Returns:
nil
 
- 
							
CampaignUI.DoesEventTypeExist(event typestring) - 
							Returns whether or not an event of the specified type exists in the display queue (i.e. is being displayed or is pending to be displayed). Event types are specified by a compound key from the 
event_feed_targeted_eventstable - the key must be specified by concatenating theeventandtarget>field values for a given record from that table.Parameters:
1
event type
Returns:
event type existsboolean
 
- 
							
CampaignUI.DoesEventTypeRequireResponse(event typestring) - 
							Returns whether or not an event of the specified type exists in the display queue (i.e. is being displayed or is pending to be displayed) and requires a response. Event types are specified by a compound key from the 
event_feed_targeted_eventstable - the key must be specified by concatenating theeventandtarget>field values for a given record from that table.
This is of most use for testing if a dilemma is currently active.Parameters:
1
event type
Returns:
event type requires responseboolean
Example:
if CampaignUI.DoesEventTypeRequireResponse("faction_event_dilemmaevent_feed_target_dilemma_faction") then
out("dilemma is open")
end
 
- 
							
CampaignUI.TriggerCampaignScriptEvent([faction cqinumber], [event idstring]) - 
							Allows the script running on one machine in a multiplayer game to cause a scripted event, 
UITriggerScriptEvent, to be triggered on all machines in that game. By listening for this event, scripts on all machines in a multiplayer game can therefore respond to a UI event occuring on just one of those machines.
An optional string event id and number faction cqi may be specified. If specified, these values are passed from the triggering script through to all listening scripts, using the context objects supplied with the events. The event id may be accessed by listening scripts by calling<context>:trigger()on the supplied context object, and can be used to identify the script event being triggered. The faction cqi may be accessed by calling<context>:faction_cqi()on the context object, and can be used to identify a faction associated with the event. Both must be specified, or neither.Parameters:
1
optional, default value=nil
faction cqi
2
optional, default value=nil
event id
Returns:
nil
Example:
core:add_listener(
"test",
"UITriggerScriptEvent",
true,
function(context)
out("* UITriggerScriptEvent received, id: " .. tostring(context:trigger()) .. ", faction cqi: " .. tostring(context:faction_cqi()))
end,
true
)
// later, perhaps on a different machine:
CampaignUI.TriggerCampaignScriptEvent(123, "test_event")
* UITriggerScriptEvent received, id: test_event, faction cqi: 123
 
- 
							
CampaignUI.TriggerCampaignFactionVO(sound event id keystring,faction keystring) - 
							Trigger some campaign voiceover related to a faction leader.
							
Parameters:
1
sound event id key
2
faction key
Returns:
nil
 
- 
							
CampaignUI.TriggerCampaignCharacterVO(sound event id keystring,target character cqinumber) - 
							Trigger some campaign voiceover related to a particular character.
							
Parameters:
1
sound event id key
2
target character cqi
Returns:
nil
 
- 
							
CampaignUI.TriggerCampaignCourtVO(sound event id key
string,faction key
string,court type
string,target character cqi
number
) - 
							Trigger some campaign voiceover related to the Court feature.
							
Parameters:
1
sound event id key
2
faction key
3
court type
4
target character cqi
Returns:
nil
 
- 
							
CampaignUI.TriggerIncident(incident keystring) - 
							Triggers an incident for the local player, specified by incident key. If called on one machine in a multiplayer game this will trigger the incident on all machines - as such, it can be called in script that is triggered from a UI event in a multiplayer game.
							
Parameters:
1
incident key
Returns:
nil
 
- 
							
CampaignUI.FillAgentCard(character CQInumber,panel namestring,component namestring) - 
							Fills an agent card in a panel by component_id.
							
Parameters:
1
Character CQI.
2
Name of the parent panel of the component that holds the agent card.
3
name of the component that holds the agent card.
Returns:
nil
 
- 
							
CampaignUI.ShowVictoryScreen([is victoryboolean], [can continueboolean], [mission keystring]) - 
							Shows the campaign victory screen, optionally corresponding to a specified mission. All three arguments must be specified, or none can be specified.
							
Parameters:
1
optional, default value=
nilis victory
2
optional, default value=
nilcan continue
3
optional, default value=
nilmission key
Returns:
nil
 
- 
							
CampaignUI.UpdateTechButton() - 
							Updates the available technologies counter inset into the technology button the campaign interface. This should be called after the script does anything that might modify the value shown on this counter (including turning the technology button on and off).
							
Returns:
nil
 
- 
							
CampaignUI.UpdateSettlementEffectIcons() - 
							Updates any settlement effect icons on the campaign interface. This should be called after the script does anything that might modify settlement effects.
							
Returns:
nil
 
- 
							
CampaignUI.QuitToWindows() - 
							Exits the game. This is used for autotesting.
							
Returns:
nil
 
- 
							
CampaignUI.OpenDetailsForCharacter(character cqi
number,mode
string,from family tree
boolean,select skill tab
boolean,show titles panel
boolean
) - 
							Opens the character details panel for a character. The character is specified by cqi.
							
Parameters:
1
CQI of character.
2
Mode in which to open the character details panel. Supported string values are currently either
"character"or"army".3
Open the panel as if we're switching from a family tree.
4
Select the skill tab on the Character Details panel.
5
Show titles on the Character Details panel.
Returns:
nil
 
- 
							
CampaignUI.TriggerPanelEvent(panel idstring,is_openingboolean) - 
							Sends a message to the UI to tell it that a panel has been opened or closed by script. Note that this doesn't actually open or close the panel, but is instead for use if the script manually creates a panel with 
core:get_or_create_component, or if the script manually closes a panel using a command on theuicomponentinterfaceParameters:
1
panel id
2
is_opening
Returns:
nil
 
- 
							
CampaignUI.OpenDiplomacyFactionList() - 
							Opens the diplomacy faction list panel.
							
Returns:
nil
 
- 
							
CampaignUI.SetDiplomacyFactionListFilter() - 
							Sets the filtering mode of the diplomacy faction list panel.
							
Returns:
nil