Is it possible to not restart the game completely when making changes to a file?

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


  • Hello modellers.
    During my tests of scripts, I sometimes have to modify them often and to visualize the result in the game.
    Is there a solution that will not restart the game each time, just for a modified file?


    For example, if I edit a .con file is it possible to reload only this modified file while playing?


    Thanks.


    [Fr]
    Bonjour les modélisateurs.
    Lors de mes tests de scripts, il m'arrive de devoir les modifier souvent et de visualiser le résultat dans le jeu.
    Existe-t-il une solution qui permet de ne pas relancer le jeu à chaque fois, juste pour un fichier modifié?


    Par exemple, si je modifie un fichier .con est-il possible de recharger uniquement ce fichier modifié pendant que l'on joue?


    Merci.


    [De]
    Hallo Modellbauer.
    Während meiner Tests muss ich Skripte manchmal häufig ändern und das Ergebnis im Spiel visualisieren.
    Gibt es eine Lösung, die das Spiel nicht jedes Mal neu startet, nur für eine geänderte Datei?


    Wenn ich zum Beispiel eine .con-Datei bearbeite, ist es dann möglich, nur diese geänderte Datei während des Abspielens neu zu laden?


    Danke.

    Michel Lacoste
    Belgium

  • Sure,
    TPF in Debug Mode reloads the con file if you change the ui settings. (Simply add a print in your file and you can see the reloading happen)


    UI Change in Construction Settings -> (If debug mode)reload con(/if) -> updateFn()
    The updateFn result is then used as blueprint for building the construction (or you change the construction options via ui again)


    External Scripts can be reloaded if package.loaded is manipulated and the relevant file set to nil.
    However be sure, any other part of TPF may hold references to the old version.


    [Advertising]
    CommonAPI even let you interact with TPF via it's console.
    So it's possible to change settings when you use a global variable while development. (or run game.interface functions )


    You should not have global variables in a released mod or it's a unique variable name. Something like: myname_modname_config = { } 


    If you want to use the console, be sure that your con won't overwrite changes made when TPF reloads your con and so the global variable gets overwritten.
    if (myname_modname_config == nil) then myname_modname_config = { .... } end


    commonapi.dmp ( myname_modname_config ) will output the variable contents in the console.

  • Thank you for your reply Eis_os.
    But as I am a beginner in modeling in Transport Fever, I do not understand well.


    Where do I add the print command? At the beginning of the .con file or at the end or in function data ()?


    Where will I see this message on the screen?


    Thank you and sorry for my misunderstanding.

    Michel Lacoste
    Belgium

BlueBrixx