settings.lua quick question

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


  • I enjoy scripting, I enjoy programming - So - I'm just doing this because I'm learning where everything is. lol.



    I don't like where settings.lua is - I'd rather reference all the options there in another file or folder. hell, I'd Return False and handle it all in the base_config file if any of my functions would work (they arent)


    Is there a quick function im not finding here?



    1. Where is the script dictating where settings.lua ends up? I can't even find the reference to it in the configuration or scripts folder...
    2. is there a quick way to Return False on the settings.lua file and handle all those options elsewhere....
    3. Is there a way to runFN and manipulate settings.lua from another file (*Cough IE runfn options.userSettings*)



    I've been playing around and been successful at disabling the mod check to settings.lua from the mod script in res/scripts (disabling mods all the time, no matter whats in that file) - but I can't seem to hit any other option!



    soooo anything like below for user settings? game settings, cause I dislike the locations of settings.lua



    thanks.

    Code
    runFn = function (settings)        game.config.sandboxButton = true    end
  • I certainly find some of the locations of game files and folders to be inconvenient.
    I just created a folder on my desktop called 'TF2 Stuff'
    I dragged shortcuts to all of the awkwardly located files and folders into said folder.


    Certainly, just about everything in settins.lua is settable programmatically, so your approach would work - set everything based on values saved in another file. Just seems like a lot of work.

  • thanks for the response doug.


    I guess where I'm stuck is how to override it.


    example. If I create a script mod with a copy and paste of all the settings.... how do I refer to the right function to overwrite settings.lua...


    because right now...


    runFn = function (settings)


    doesn't seem to work. and pasting the settings into the base config doesn't work either.



    there's some sort of reference issue

  • So I wrote a function:




    local function parseTable(name, ttable,file)
    for k,v in pairs(ttable) do
    local stringOut = string.format("\n%s; %s; %s; %s", name, k,v,type(v))
    if type(v) == "table" then parseTable( (name.."."..k),v,file) end
    file:write(stringOut)
    stringOut = ""
    file:flush()
    end
    end


    where 'name' is a convenient text label of your choice,
    'ttable' is the table you want to explore, and
    'file' is a file currently open for output.
    You will note that it is recursive, so will walk through an entire complex table of data.


    You could call it on the variable 'game' thusly:


    runFn = function(settings)
    local file = io.open("e:/interface.txt", "w") -- change the path to something that will work on your system.
    parseTable( "game", game, file)
    file:close()
    end


    That will give you everything in the game.config sub-table, which is where most of the stuff is located.

  • I don't think it's possible what you are trying to achieve.


    The parameter settings in runFn seems to contain only the map generation options in custom. They are also printed in the stdout:


    config dict:
    climate: temperate
    vehicles: europe
    nameList: europe
    environment: temperate


    I think it's meant for mods to react only in a specific configuration (i.e. only be active for american vehicles) and the parameters are read-only.


    Would be nice, to access more of the user settings with that. How doug mentioned, many configuration settings can be accessed and modified with game.config. ...


    However, some mods add a settings.lua file to handle settings for configuring the mod itself. (https://www.transportfever.net…ry/217-Settings-for-Mods/)
    Sadly, there is no parameter window in the game mod list yet.

BlueBrixx