These classes and methods are only available for scripted scenarios.
◆ add_message()
| string gui::add_message |
( |
player_x | text, |
|
|
string | ) |
|
static |
Adds message to the players mailboxes. Will be shown in ticker or as pop-up window depending on players preferences.
- Parameters
-
| text | Text to be shown. Has to be a translated string or a translatable string. |
- Note
- Only available in scenario mode.
◆ add_message_at()
| string gui::add_message_at |
( |
string | text, |
|
|
coord | position ) |
|
static |
Adds message to the players mailboxes. Will be shown in ticker or as pop-up window depending on players preferences. Message window has small view of world.
- Parameters
-
| text | Text to be shown. Has to be a translated string or a translatable string. |
| position | Position of the view on the map. Clicking on the message will center viewport at this position. |
- Note
- Only available in scenario mode.
◆ book_cash()
| void player_x::book_cash |
( |
integer | delta | ) |
|
Change bank account of player by given amount delta.
- Parameters
-
◆ create_player()
| bool world::create_player |
( |
integer | player_nr, |
|
|
integer | player_type ) |
|
static |
Creates a player company in an unused player slot.
Player numbers 0 and 1 are reserved for the default human and public players. Valid new player numbers are 2 through 14.
Player types are 1 = human, 2 = goods AI, 3 = passenger AI, and 4 = scripted AI.
In network games, there will be a delay between the call to this function and creation of the player.
- Parameters
-
| player_nr | unused player number |
| player_type | player type to create |
- Returns
- whether the creation request was accepted
◆ generate_goods()
Generates goods packet and sends it on its way.
- Parameters
-
| from | origin position |
| to | destination position |
| desc | type of goods |
| count | number of goods |
- Return values
-
| 0 | No route found |
| 1 | Passengers/mail/freight successfully generated |
| 2 | Destination is within station catchment area |
| 8 | Route is overcrowded (if no_routing_over_overcrowded is enabled) |
◆ load_language_file()
| string load_language_file |
( |
string | file | ) |
|
Helper method to load scenario-related translation files. Tries to load files in the following order relative to pakxx/scenario:
- scenario-name/iso/filename
- scenario-name/en/filename
- scenario-name/filename
Here, iso refers to iso-abbreviation of currently active language.
The content of the files is cached. The cache is cleared upon reloading of savegame.
- Parameters
-
- Returns
- content of loaded file
- Note
- Only available in scenario mode.
◆ remove_player()
| bool world::remove_player |
( |
player_x | pl | ) |
|
|
static |
Removes player company: removes all assets. Use with care.
If pl is the first player (nr == 0) it is restarted immediately. Public player (nr == 1) cannot be removed.
In network games, there will be a delay between the call to this function and the removal of the player.
- Parameters
-
- Returns
- whether operation was successful