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
- float
value
the frequency with which simulation updates are called. Supported values are [1/4, 1/2, 1, 2].
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)
Related
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
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
- float
value
the multiplier for how much time is processed on each game update.
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)
Related
float GetSpeedFactor()
float GetSpeedFactor()
Description
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
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
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
- int
player
integer corresponding to the player. - string
result
the result.
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
- int
player
integer corresponding to the player. - string
result
the result.
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)