​CommonAPI2 quickstart guide

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the Transport-Fever Community

  • CommonAPI2 quick start guide

    1 CommonAPI2 quickstart guide

    Deutsche Version: CommonAPI2 Schnelleinstieg


    CommonAPI2 is build in two parts:

    • A normal script - mod
    • Binary “native” part (dll for windows, so library for linux)

    With binary native part it’s possible to modify the game memory and change the game at low level to add new stuff to the game. This part has to match the game version.


    2 Is CommonAP2 loaded?

    The binary native part will be loaded as soon as the mod is installed.

    At the top left corner there will be a CommonAPI2 menu as soon as the main menu is shown.


    It's not possible to use the steam dummy mod version together with a regular release version, you have to unsubscribe the dummy mod!

    https://steamcommunity.com/sha…iledetails/?id=1947572332

    Loading a savegame: First remove the steam version, load game, options -> click on name for sorting the table, so you can see the entry with a red triangle exclamation mark.

    Disable the steam version, then enable the local installed version. Load the game, and save with a new name...


    Additional api functionality for other mods and in-game addons are only fully active if commonapi2 is loaded in the savegame mod list.

    It’s only possible to install one version of CommonAPI.

    If you don’t subscribe to the steam version, you have to install CommonAPI2 into the mods folder of the game.

    The folder has to be named eis_os_commonapi2_1, otherwise commonapi2 will not work correctly. The zip provides always the right folder name!

    Subscribing to the steam version and local installation won’t work!


    For testing if you think the native part (dll or so) creates a crash, it’s possible to temporary disable commonapi2 native part via commonapi2 settings.

    Disabling the native part can create several problems and loading times increase. If you think you can’t use the native part, it is strongly recommend to uninstall or unsubscribe!

    If you you have problems, please leave a bug report, otherwise errors can’t be fixed.


    3 Requirements

    Windows:

    The mod download and upgrade function needs curl. (curl will be provided by Windows 10 1803 or later)

    7-zip is required for mod extracting and upgrade: https://www.7-zip.org/

    Linux

    Requires curl and p7zip-full, see you package manager.


    4 Functions

    • Line (train) destination display
    • API for mod authors
    • Lua console on all LUA states
    • Changing mod settings (settings.lua)
    • Mod list export and importt
    • Check for new mod versions on transportfever.net
    • Upgrade mods from transportfever.net


    4.1 Line Destination display


    Currently there is only a German description for LINE_DESTINATION:

    CommonAPI2 Endhaltestellen Anzeige (LINE_DESTINATION)


    4.2 CommonAPI menu

    The commonapi menu can be toggled via right Alt + C ein.
    Several functions can be reached here:


    4.2.1 Folders

    Directly open the installation and local user folder of the game .


    4.2.2 Lua Console


    The lua console shows the last stdout.txt messages and predates UGs lua console.

    Directly send lua statements to all lua states of the game (commonapi2 has to be in the game mod list)

    Drop down list to switch between lua states / threads of the game

    If you want to dump some information, you can use commonapi.dmp(<variable>)


    4.2.3 Mod settings


    Mods may have setting via settings.lua, this system predates UGs mod settings system. Actually it was introduced by TPFMM and used already in Transport Fever 1

    As soon as there are list of mods provided via advanced game settings, it's possible to change mod settings and to load and save a mod list.


    Changes while in game a usually not possible, there are only a few mods that reload their settings.lua in game.

    Mod upgrades are not possible in game or in savegame loading mode, you have to go back to the main menu so TPF2 reloads the mods on disk!


    Mods can support dependencies and commonapi2 will show warnings if the mod is missing or not loaded.

    4.3 Modlist export & import

    As soon as there are list of mods provided via advanced game settings, it's possible to export list of all active mods and or import a list.


    Example: Select an old savagame, go to advanced game setting without starting the savegame, then it's possible to export the modlist.

    In main menu -> Free map -> next -> clicking settings in the create new game window (top right) -> Advanced game settings window opens
    Now open commonapi mods menu, import mod list...



    5 Different versions

    Currently the steam version has no functionality because the game crashes badly when using TPF2 ui toolkit.

    Technical the download section on transportfever.net has always a stable version. On the forum there may be development versions.


    There is no difference between Steam and GOG Versions, however only Windows and Linux is supported.

    Technical it's not possible to provide a mac version. I don't own the epic games store version, so it may work via build overwrite.


    6 buildoverwrite

    6.1 TPF2 Build not supported, error message on the main menu, using build overwrite


    Sometimes Transport Fever 2 get new updates (builds)

    In the forum I will post information about compatibly to the new TPF2 build and how to enable commonap2 to work with a certain game build via build overwrite. (Steam, GOG, Windows and Linux)

    Please follow this link and look at the last message CommonAPI2 - Neue Versionen und wichtige Informationen



    6.2 buildoverwrite step by step guide

    1. Click on the red error message in main menu
    2. The commonap2 emergency settings window appears.
    3. Scroll down until you can change Build overwrite
    4. Insert the right build overwrite string as mentioned on the forum (to get a cursor, simple click in the small text window)
      I will provide the necessary string for tested versions
    5. Click on save, close the window then close the game.* On Linux the emergency windows build with the TPF2 toolkit may hang the game, please kill the TransportFever2 task, the reason there is no steam release currently!
    6. After a game restart you should see the commonapi2 menu again. If you get an error about the native part is disabled, please check your settings, you have enabled/checked disable native library extension!


    7 Additional informationen

    CommonAPI2 Dev and bug report thread


    8 Downloads

    CommonAPI2 Download (Webdisk)

    CommonAPI2 - Modulare Bahnhofsadapter

    CommonAPI2 - Train Depot Adapter

Share

Comments 4

  • Please add a version for Mac!😭

    • A MacOS version won't be possible, supporting 2 platforms is already enough...

  • Thank you for this wonderful mod. I have used it to export the modlist from my projects so that I can check which mods I use against a masterlist of everything I subscribe to. So easy to use.

  • Quote

    Changes while in game a usually not possible

    ;)