Need of comments for example in WIKI construction_postRunFn.lua

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


  • So make sure, you are using unique keys.

    I have changed each key name in both mod and .script files, but the game is using the wrong script file.

    Please keep in mind, that both mods works when loading them separately.


    Here is my description on how I can repeat the problem:

    • I start the game with an empty stdout.txt
    • After the savegame has loaded I click on only the eraA construction, --> I get a construction error
    • Reading the stdout.txt on row 73-76, 99-106 there it says the wrong file and wrong mod folder.

    The first mod is now named with a big A at the end, the second mod has names with C at the end of each key name.

    What I can see is that the game should open the file creek_bridge_streetA.script but it opens creek_bridge_streetC.script in the other loaded mod folder.


    Is this a bug in the game and how can I do a work around?



    Here are the two mods in the file explorer:


    here is a snippet from the mod.lua in the eraA mod:

    a snippet from the mod.lua in the eraC directory

    Dateien

    • stdout.txt

      (3,85 kB, 185 Mal heruntergeladen, zuletzt: )
  • I have changed each key name in both mod and .script files

    Just to be sure, what I meant is the "key" of params: https://www.transportfever2.co…tructionbasics#parameters

    local variables are not a problem, because they are only local


    I would need more code to find the problem.

  • https://www.transportfever2.co…ding:modularconstructions


    About Templates:

    "type can either be “DYNAMIC” to return content in dependency of some parameters or “STATIC” to do not offer parameters." (These are the two types in the exe)


    The script binding will be saved in the construction entity, module slot configuration will be cached. Only when oldparameters != newparameters, the updateFn result will be used, Switching back to previous settings may use outdated cached results. You can remove or add an module to overwrite the cache and use the updateFn result...


    Since TPF there is a problem, that ui parameters you define aren't present or have values of old user settings and may be outside of your parameter range (That is how TPF knows you last build track type or other settings across constructions)


    The updateScript and module parameters are hold in params.constrParams.modules[slotId] and are replayed via game.config.ConstructWithModules in base_config.lua


    Only a construction upgradeFn function has write access to these. But there you won't have access to modulenames -> script files mapping data. You have to provide these data in the dynamic module metadata yourself. Then it's technical currently even possible to call into a dynamic module script functions with your own name.


    So I wrote a new build system with dynamic slotdata and connectors, so you can attach new modules to existing modules at connector points. (selectable by m/n). However my vector fu is somehow broken, I can't line up the tangents correctly and calculate the new module center and rotation correctly. Disabling collision checks when removing modules is a different problem I can't find a solution.


    Conclusion: A build dynamic module will still use the scriptFilename at build time, regardless of changes you do. Parameters at least in my tests with the code are constant too.

  • VacuumTube and eis_os

    Thank you for the update

    So I wrote a new build system with dynamic slotdata and connectors, so you can attach new modules to existing modules at connector points.

    Is it possible for you to send this example or can i download it somewhere?


    I would need more code to find the problem.

    I will first create the UI icons and do some new tests.

  • I am sorry, currently I can't share code. As soon as I have a functional version, I will release a new modular station called flexstation including a module creation guide.


    It's fundamental different to the current system. Instead of using different slot types, there is currently only one 1x1m connection point type and the new module get created at upgradeFn time.

    So the old modular data get reused for every run instead of creating a complete new station each time.


    It uses corner cases of UGs script system I have to check if they still work in the next game release or get in contact with UG about that.

    So still need to write a ton of new code, like connecting tracks with platforms as stations and platforms together.

  • I'm testing my mods in a game and now I have seen that yearFrom and yearTo doesn't work as I think they should. The mod is already enabled in year 1880.

    I can't see that my code differs from the example in the WIKI.

    Code: snippet from My mod
                local tempA = api.type.ConstructionTemplate.new()
                    tempA.availability = api.type.MetadataMap.Availability.new()
                        tempA.availability.yearFrom = 1890
                        tempA.availability.yearTo = 1929
                        tempA.desc.name = streetConA.description.name
                        tempA.desc.description = streetConA.description.description
                local streetDynA = api.type.DynamicConstructionTemplate.new()

    link to the example in WIKI: Reference (transportfever2.com)

BlueBrixx