Skip to content

journal

Source: base/tealdef/scripts/journal.d.tl

Notes

Type of the engine's finance journal entry (api.type.JournalEntry): one booking of money with its time, amount and category. Scripts create one with api.type.JournalEntry.new() and book it with api.cmd.makeJournalBookAssetCmd.

Example

-- from base/content/game_mechanics/game_mechanics/subventions/subvention_util.tl
local entry = api.type.JournalEntry.new()
entry.amount = positive and data.amount or -data.amount
entry.time = -1
entry.category.type = api.type.JournalEntry.Type.SUBSIDY
api.cmd.sendCommand(api.cmd.makeJournalBookAssetCmd(api.engine.util.getPlayer(), entry, api.type.Vec3f.new(0, 0, 0)))

JournalEntry

record global base/tealdef/scripts/journal.d.tl:3

global record JournalEntry

Access: api.type.JournalEntry

Notes

One finance journal booking (api.type.JournalEntry). Create it with api.type.JournalEntry.new(), set amount, time and category, and book it with api.cmd.makeJournalBookAssetCmd.

Fields

Name Type Description
time number Booking time; the base game sets -1 when booking a subsidy.
amount number Booked amount in game currency; positive for income, negative for costs.
category Category Classification of the entry.

Functions

new() : JournalEntry base/tealdef/scripts/journal.d.tl:4

Call as api.type.JournalEntry.new(…)

Notes

Creates a new, empty JournalEntry.

Returns JournalEntry

Used in the base game: 16 times in 14 files

base/content/game_mechanics/game_mechanics/finance/loan_util.tl:203

local entry = api.type.JournalEntry.new()
base/content/game_mechanics/game_mechanics/subventions/subvention_util.tl:128
local entry = api.type.JournalEntry.new()
base/content/gui/gui/construction/tools/marketing_campaign_tool.script.tl:98
local journalEntry : JournalEntry = api.type.JournalEntry.new()
base/content/gui/gui/game_bar/game_bar.tl:229
local entry = api.type.JournalEntry.new()
base/content/mission/mission/mission_sim.script.tl:728
local entry = api.type.JournalEntry.new()
mods/release/urbangames_campaign_mission_01/content/mission/mission/tasks/everything/everything.tl:42
local entry = api.type.JournalEntry.new()
… and 8 more files.

JournalEntry.Type

record base/tealdef/scripts/journal.d.tl:6

record Type

Access: api.type.JournalEntry.Type

Notes

Principal categories of a journal entry (api.type.JournalEntry.Type).

Used in the base game: 2 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:64

function finances_util.getKeyLabel(key : {JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : string

Fields

Name Type Description
LOAN Type Loan taken or repaid. used 1× in the base game
INTEREST Type Loan interest. used 1× in the base game
CONSTRUCTION Type Construction costs (subcategory in category.construction). used 1× in the base game
ACQUISITION Type Vehicle purchases (shown as "Vehicles" in the finance window). used 1× in the base game
MAINTENANCE Type Maintenance costs (subcategory in category.maintenance). used 1× in the base game
INCOME Type Revenue. used 3× in the base game
OTHER Type Other bookings (subcategory in category.other). used 12× in the base game
SUBSIDY Type Subsidy (subvention) payments. used 2× in the base game

JournalEntry.Construction

record base/tealdef/scripts/journal.d.tl:17

record Construction

Access: api.type.JournalEntry.Construction

Notes

Construction subcategories (api.type.JournalEntry.Construction).

Used in the base game: 4 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:31

local getMaintenanceInfraKeyLabel = function(construction : JournalEntry.Construction) : string

Fields

Name Type Description
STREET Construction Streets. used 2× in the base game
TRACK Construction Tracks. used 2× in the base game
SIGNAL Construction Signals. used 1× in the base game
STATION Construction Stations. used 2× in the base game
DEPOT Construction Depots. used 2× in the base game
BULLDOZER Construction Bulldozing. used 1× in the base game
WAREHOUSE Construction Warehouses. used 2× in the base game
OTHER Construction Other constructions. used 1× in the base game

JournalEntry.Maintenance

record base/tealdef/scripts/journal.d.tl:29

record Maintenance

Access: api.type.JournalEntry.Maintenance

Journal entry Maintenance Category

Used in the base game: 2 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:64

function finances_util.getKeyLabel(key : {JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : string

Fields

Name Type Description
VEHICLE Maintenance Vehicle running costs ("Running Costs Vehicles"). used 2× in the base game
INFRASTRUCTURE Maintenance Infrastructure maintenance. used 2× in the base game
OTHER Maintenance Other maintenance.
VEHICLE_MAINTENANCE Maintenance Vehicle maintenance ("Maintenance Vehicles"). used 3× in the base game

JournalEntry.Other

record base/tealdef/scripts/journal.d.tl:37

record Other

Access: api.type.JournalEntry.Other

Journal entry Other Category

Used in the base game: 2 times in 2 files

base/content/game_mechanics/game_mechanics/finance/finances_table.tl:427

tableState:old():foreach_other(function(key : JournalEntry.Other, values : {integer})
base/content/game_mechanics/game_mechanics/finance/finances_util.tl:23
function finances_util.getOtherLabel(other : JournalEntry.Other) : string

Fields

Name Type Description
OTHER Other Other bookings. used 1× in the base game

JournalEntry.Carrier

record base/tealdef/scripts/journal.d.tl:41

record Carrier

Access: api.type.JournalEntry.Carrier

Notes

Carrier subcategories (api.type.JournalEntry.Carrier); the finance window shows one column per carrier.

Used in the base game: 5 times in 2 files

base/content/game_mechanics/game_mechanics/finance/finances_table.tl:263

carrierStates : {{JournalEntry.Carrier, ReactStateT<integer>}},
base/content/game_mechanics/game_mechanics/finance/finances_util.tl:5
function finances_util.getCarrierLabel(carrier : JournalEntry.Carrier) : string

Fields

Name Type Description
ROAD Carrier Road vehicles. used 2× in the base game
RAIL Carrier Trains. used 2× in the base game
TRAM Carrier Trams. used 2× in the base game
OTHER Carrier Not carrier-specific (shown as "General"). used 2× in the base game
AIR Carrier Aircraft. used 2× in the base game
WATER Carrier Ships. used 2× in the base game

JournalEntry.Category

record base/tealdef/scripts/journal.d.tl:51

record Category

Access: api.type.JournalEntry.Category

Details about the classification of the journal entry

Fields

Name Type Description
type Type The principal category
construction Construction The construction subcategory, only if type == Construction
maintenance Maintenance The maintenance subcategory, only if type == Maintenance
other Other The other subcategory, only if type == Other
carrier Carrier The carrier subcategory, only if type == Carrier

Functions

new() : Category base/tealdef/scripts/journal.d.tl:52

Call as api.type.JournalEntry.Category.new(…)

Notes

Creates a new, empty Category.

Returns Category