Trigger API Reference\DCEI Functions\Log
void LogMessage(string message)
void LogMessage(string message)
Description
Prints the given message to the Play Settings Log. Useful for debugging.
Parameters
- string
message
The string to output.
Example Usage
-- This will show a normal white message in the play log
DCEI.LogMessage("Hello" .. "World")
-- Multiline
DCEI.LogMessage(
"test"
.. " and test"
.. " and test"
)
Related
void LogWarning(string message)
void LogWarning(string message)
Description
Similar to LogMessage(), but the output text color is orange.
Parameters
- string
message
The string to output.
Example Usage
-- This will show yellow in the play log window
DCEI.LogWarning("Hello" .. "World")
Related
void LogError(string message)
void LogError(string message)
Description
Similar to LogMessage(), but the output text color is red.
Parameters
- string
message
The string to output.
Example Usage
-- This will show up red in the play log with a stack trace
DCEI.LogError("Hello" .. "World")
Related
void OverwriteShipHp(int hp)
void OverwriteShipHp(int hp)
Description
A Wild Sky specific API for overwriting the Ship HP reported to the meta-game victory/defeat screen.
Parameters
- int
hp
The amount of health
Example Usage
function game.OverwriteShipHp(hp)
local maxHealth = DCEI.GetMaxHealth(ship)
local newHealth = maxHealth * (hp / 100)
local percentage = newHealth / maxHealth * 100
DCEI.LogMessage("Overwrite Ship HP to (" .. newHealth .. ") - " .. percentage .. "%")
DCEI.SetHealthValueAsync(ship, newHealth)
DCEI.LogEndGameStringValue("Overwrite Ship Icon", DCEI.Texture("btn_icon_wildsky_heart"))
end
void LogEvent(string name, string json)
void LogEvent(string name, string json)
Description
Log an event for Wild Sky. May be used for Amplitude statistics, or be used by the meta-game layer.
Parameters
- string
name
The id for the log event - string
json
A string of json data to report with the event.
Example Usage
function LogOverchargeEvent(spell_name)
local data = string.format('{"Stage": "%s", "Wave": %d}', DCEI.GetLevel(), DCEI.GetCurrentWaveId())
DCEI.LogEvent("Use TowerOvercharge", data)
end
void LogEndGameStringValue(string name, string value)
void LogEndGameStringValue(string name, string value)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference.
Parameters
- string
name
The log name. - string
value
The string data to log.
Example Usage
function game.OverwriteShipHp(hp)
local maxHealth = DCEI.GetMaxHealth(ship)
local newHealth = maxHealth * (hp / 100)
local percentage = newHealth / maxHealth * 100
DCEI.LogMessage("Overwrite Ship HP to (" .. newHealth .. ") - " .. percentage .. "%")
DCEI.SetHealthValueAsync(ship, newHealth)
DCEI.LogEndGameStringValue("Overwrite Ship Icon", DCEI.Texture("btn_icon_wildsky_heart"))
end
void LogEndGameNumberValue(string name, double value)
void LogEndGameNumberValue(string name, double value)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference, such as mine health or co-op damage values.
Parameters
- string
name
The log name. - double
value
The number value to log.
Example Usage
DCEI.LogEndGameNumberValue("BossUndamagedHP", boss_undamaged_HP)
DCEI.LogEndGameNumberValue("PlayerDamageThisGame", DCEI.GetProtectedValue("player_dmg_this_game"))
DCEI.LogEndGameNumberValue("DisplayBossHP", DCEI.GetHealth(boss_unit))
DCEI.LogEndGameNumberValue("BossHP", DCEI.GetHealth(boss_unit))
DCEI.LogEndGameNumberValue("PercentDamageDealt", percent_damage_dealt)
DCEI.LogEndGameNumberValue("PercentHPRemaining", percent_hp_remaining)
void LogEndGameBooleanValue(string name, bool value)
void LogEndGameBooleanValue(string name, bool value)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference.
Parameters
- string
name
The log name. - bool
value
The bool value to log.
Example Usage
function game.DefaultQuest(text)
DCEI.LogEndGameBooleanValue("UseSideQuest", true)
DCEI.LogEndGameStringValue("SideQuest01Display", text or "Quest")
DCEI.LogEndGameBooleanValue("SideQuest01Status", false)
end
void LogEndGameUnitsTotalHp(string name, IEnumerable<string> unitNames)
void LogEndGameUnitsTotalHp(string name, IEnumerable<string> unitNames)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference, such as mine health or co-op damage values.
Parameters
- string
name
The log name. - IEnumerable<string>
unitNames
A list of unit names
Example Usage
-- e.g. Logging the combined health of all mine units
DCEI.LogEndGameUnitsTotalHp("mine_health", {"Mine Big", "Mine Medium", "Mine Small"})
void LogEndGameUnitHps(string name, IEnumerable<string> unitNames)
void LogEndGameUnitHps(string name, IEnumerable<string> unitNames)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference.
Parameters
- string
name
The log name. - IEnumerable<string>
unitNames
A list of unit names
Example Usage
-- e.g. Logging the combined health of all mine units
DCEI.LogEndGameUnitHps("mine_health", {"Mine Big", "Mine Medium", "Mine Small"})
void LogEndGameUnitHpPercentage(string name, unit u)
void LogEndGameUnitHpPercentage(string name, unit u)
Description
Wild Sky only. Used for logging certain game-values for the meta-game to reference.
Parameters
- string
name
The log name. - unit
u
The unit name.
Example Usage
function OnUnitSpawn()
local u = DCEI.TriggeringUnit
local unit_name = DCEI.GetUnitType(u)
if unit_name == BOSS_NAME then
-- Log boss hp stats.
DCEI.LogEndGameUnitHpPercentage("Boss Hp", u)
end
end