How to know map creation parameters in script?

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • How does one access the settings the user used to create the map (in my current case I'm interested in the starting year, but other parameters may also be interesting)? For example to alter mod behavior during map generation based on starting year (or other parameter).


    These parameters are dumped nicely at the top of stdout.txt, these are the kind of data I'm looking for:

  • That is the "settings", the first argument of runFn

    Code
    config dict:
      climate: temperate
      vehicles: europe
      nameList: europe
      environment: temperate
      difficulty: medium


    The Map gen parameters can probably only be accessed with a terrain generator.


    If you want to use the start year for new generated maps, look for "Init" in gamescript: Game Script

  • If you want to use the start year for new generated maps, look for "Init" in gamescript: Game Script

    I'm not sure how that helps me. Perhaps I'm not understanding.


    The current game year can be found from game.interface.getGameTime().date.year when the game is running, but from my testing during map generation game exists but game.interface does not.


    Could someone smarter than me show me a simple code sample that would detect a new map being generated (lack of game.interface may suffice for this) and output the year the game is starting in

    print("New game generating, starting year = " .. newMapStartYear)

  • Yes because when the map is generated there is no game and no year.

    But the Init function is called once when a map is created and game.interface is accessible there.


    More Info for gamescript is in the lexicon article (no english version yet)

    Otherwise my mods "No Town Development" and "FPS Monitor" are examples