Trigger API Reference\DCEI Functions\Game

void SetUpdateFrequency(float value)

void SetUpdateFrequency(float value)

Description


Changes how frequently a simulation update is called. The default of 1 means 16 FPS. Regardless what frequency is used, each simulation update will advance game time by 0.0625 unless SetSpeedFactor is also used.

Parameters

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

local function SetUpdateFrequencyButton()
    local update_freq = DCEI.GetUpdateFrequency()
    if update_freq == 1 then
        DCEI.SetUpdateFrequency(0.5)
    else
        DCEI.ClearUpdateFrequency()
    end
end

DCEI.SetOnClickCallback(button_layout.Button, SetUpdateFrequencyButton)

void ClearUpdateFrequency()

void ClearUpdateFrequency()

Description


Resets update frequency to the default frequency of 1, meaning 16 FPS.

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

local function SetUpdateFrequencyButton()
    local update_freq = DCEI.GetUpdateFrequency()
    if update_freq == 1 then
        DCEI.SetUpdateFrequency(0.5)
    else
        DCEI.ClearUpdateFrequency()
    end
end

DCEI.SetOnClickCallback(button_layout.Button, SetUpdateFrequencyButton)

float GetUpdateFrequency()

float GetUpdateFrequency()

Description


Returns the update frequency.

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

local function SetUpdateFrequencyButton()
    local update_freq = DCEI.GetUpdateFrequency()
    if update_freq == 1 then
        DCEI.SetUpdateFrequency(0.5)
    else
        DCEI.ClearUpdateFrequency()
    end
end

DCEI.SetOnClickCallback(button_layout.Button, SetUpdateFrequencyButton)

void SetSpeedFactor(float value)

void SetSpeedFactor(float value)

Description


Sets the speed factor for the simulation. The speed factor applies a multiplier to delta time in simulation updates, affecting how much time is processed in each simulation update. This will affect simulation results so it's recommended to only use it for slow motion effects with values like 1/64, 1/128, etc. Simulation update rate is now defaulted to 16 FPS with exactly 0.0625 delta time between updates.

Parameters

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

local function SetSpeedFactorButton()
    local speed_factor = DCEI.GetSpeedFactor()
    if speed_factor == 1 then
        DCEI.SetSpeedFactor(0.5)
    else
        DCEI.SetSpeedFactor(1)
    end
end

DCEI.SetOnClickCallback(button_layout.Button, SetSpeedFactorButton)

float GetSpeedFactor()

float GetSpeedFactor()

Description


Returns the speed factor.

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

local function SetSpeedFactorButton()
    local speed_factor = DCEI.GetSpeedFactor()
    if speed_factor == 1 then
        DCEI.SetSpeedFactor(0.5)
    else
        DCEI.SetSpeedFactor(1)
    end
end

DCEI.SetOnClickCallback(button_layout.Button, SetSpeedFactorButton)

void SetVictory()

void SetVictory()

Description


Ends the game in a victory.

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

DCEI.SetOnClickCallback(button_layout.Button, function()
    DCEI.SetVictory()
end)

void SetDefeat()

void SetDefeat()

Description


Ends the game in a defeat.

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

DCEI.SetOnClickCallback(button_layout.Button, function()
    DCEI.SetDefeat()
end)

void SetVictoryForPlayer(int player, string result = null)

void SetVictoryForPlayer(int player, string result = null)

Description


End the game in a victory for given player, with the given result.

Parameters

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

DCEI.SetOnClickCallback(button_layout.Button, function()
    DCEI.SetVictoryForPlayer(1, "Win")
end)

void SetDefeatForPlayer(int player, string result = null)

void SetDefeatForPlayer(int player, string result = null)

Description


End the game in a defeat for given player, with the given result.

Parameters

Example Usage

local button_layout = GMUI.Layout.New({
    parent = DCEI.GetUiRootFrame(),
    name = "Standard/Button/Button",
})

DCEI.SetOnClickCallback(button_layout.Button, function()
    DCEI.SetVictoryForPlayer(1, "Lose")
end)

int GetConsumableItemCount(string key)

int GetConsumableItemCount(string key)

Description


Get Wild Sky consumable item quantity from the players meta inventory.

Parameters

Example Usage

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

void AddConsumableItem(string key, int amount)

void AddConsumableItem(string key, int amount)

Description


Add Wild Sky consumable item quantity from the players meta inventory.

Parameters

Example Usage

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

DCEI.AddConsumableItem("consumable_barrage", 5)

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

void ReduceConsumableItem(string key, int amount)

void ReduceConsumableItem(string key, int amount)

Description


Reduce Wild Sky consumable item quantity from the players meta inventory.

Parameters

Example Usage

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

DCEI.AddConsumableItem("consumable_barrage", 5)

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

DCEI.ReduceConsumableItem("consumable_barrage", 2)

local barrage_count = DCEI.GetConsumableItemCount("consumable_barrage")
DCEI.LogMessage("barrage: " .. barrage_count)

void DisableGameEndDetection(object victoryCallback = null, object defeatCallback = null)

void DisableGameEndDetection(object victoryCallback = null, object defeatCallback = null)

Description


Disables automatic defeat on Ship death in Wild Sky, with callbacks to handle what should occur on Victory and Defeat.

Parameters

Example Usage

  DCEI.DisableGameEndDetection(function()
      DCEI.RecordShipHp()
      DCEI.SetVictory()
  end, function()
      DCEI.SetDefeat()
  end)

void EnableGameEndDetection()

void EnableGameEndDetection()

Description


Re-enable automatic end-game detection for Wild Sky, if previously disabled with DCEI.DisableGameEndDetection

Example Usage

  DCEI.DisableGameEndDetection(function()
      DCEI.RecordShipHp()
      DCEI.SetVictory()
  end, function()
      DCEI.SetDefeat()
  end)
  DCEI.EnableGameEndDetection()

void SetEndgamePause(bool toPause)

void SetEndgamePause(bool toPause)

Description


Toggles on and off pausing on victory/defeat.

Parameters

Example Usage

DCEI.SetEndgamePause(false)
DCEI.SetVictory()