Frontend

The frontend object is automatically provided by the frontend game environment to script, and provides functionality specific to the frontend. The functions it provides may be called directly on the object in the following form.

Example:

frontend.<function_name>(<args>)
Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Key Stealing

frontend.steal_escape_key()

Steals the ESC key. While the ESC key is stolen, and provided no other game element steals the ESC key later, the lua function Esc_Key_Pressed will be called when the ESC key is pressed.

Returns:

  1. nil

frontend.release_escape_key()

Releases the ESC key after it's been stolen by frontend.steal_escape_key.

Returns:

  1. nil

frontend.steal_input_focus()

Steals input focus, preventing any user input at all.

Returns:

  1. nil

frontend.release_input_focus()

Release input focus after it's been stolen with frontend.release_input_focus.

Returns:

  1. nil

frontend.disable_shortcut(string shortcut name, boolean should disable)

Enables or disables a particular keyboard shortcut. Keyboard shortcut names can be found in default_keys.xml.

Parameters:

1

string

shortcut name

2

boolean

should disable

Returns:

  1. nil
Back to top

Other Functionality

frontend.start_named_battle(string key)

Starts a named battle specified by key from the battles table.

Parameters:

1

string

key

Returns:

  1. nil

frontend.start_xml_battle(string xml_path, [table start_campaign_params])

Starts a battle from xml

Parameters:

1

string

xml_path

2

table

optional, default value=nil

If present, new campaign will be started after the battle, with the supplied parameters. The format of the table is: {campaign = "camapgin_key", faction = "faction_key", campaign_difficulty = 1, battle_difficulty = 1}, where difficulty is: 1 easy, 0 normal, -1 hard, -2 very hard, -3 legendary

Returns:

  1. nil

frontend.start_campaign(string campaign key, string faction key, string political party key)

Starts the specified campaign, by string key from the campaigns table. A faction key from the factions table and a political party key from political_parties table.

Parameters:

1

string

campaign key

2

string

faction key

3

string

political party key

Returns:

  1. nil

frontend.load_campaign(string file path, [boolean from cloud])

Loads a campaign save file by name.

Parameters:

1

string

file path

2

boolean

optional, default value=false

from cloud

Returns:

  1. nil

frontend.continue_campaign([boolean from cloud])

Loads the most recently saved campaign game.

Parameters:

1

boolean

optional, default value=false

from cloud

Returns:

  1. nil

frontend.campaign_saves_exist()

Returns whether any singleplayer campaign save files exists.

Returns:

  1. boolean saves exist

frontend.campaign_saves_exist_mp()

Returns whether any multiplayer campaign save files exists.

Returns:

  1. boolean saves exist
Last updated 8/23/2024 4:55:16 PM