Jump to content

clarification on modoverrides.lua syntax and format


Recommended Posts

Like most folks new to hosting their own dedicated server, I've been spending WAY too much time trying to get my mods to work correctly ;) Hehe.  FYI, I'm using Citadel Servers for my host.

Things work swimmingly until I decide I want to configure a mod away from the default settings.  I've spent hours reading posts all over the forums and other places for what the syntax of the modoverrides.lua should look like.  I've seen tons of experienced forum members posting "corrections" of what the code should look like, and they vary--some use quotes, some don't, etc...  I've tried them all (using just one of the mods I want to use) and none seem to be working!  And I know just one character incorrect can cause it not to work.

Because I want to efficiently run my server, I don't just want someone to correct things for me. I really want to understand what I'm doing!  And I'm a perfectionist. lol. So I keep asking WHY? or HOW? until I get every last detail correct! ;)

One thing I have FOR SURE (I think? lol) figured out, is that the modoverrides.lua doesn't need all the description info at the beginning of the modinfo.lua file; ONLY the configuration options section is included in a condensed format. Is that correct? :) 

I'm going to include a lot of info here to hopefully help out the people who are having the same problems/questions I am!

From the original modinfo.lua file, here are the configuration options of two mods I want to use:

DST Path Lights

Spoiler

 

configuration_options =
{
    {
        name = "path_lightrecipe",
        label = "Recipe",
        hover = "Here's where you change the recipe",
        options =
    {
        {description = "Easy", data = "easy", hover = "1 Rock 3 Twigs 1 firefly and 1 Rope"},
        {description = "Normal", data = "normal", hover = "1 Moon Rock 3 Twigs 1 firefly and 1 Rope"},
        {description = "Hard", data = "hard", hover = "2 Moon Rocks 3 Twigs 1 firefly and 2 Rope"},
    },
        default = "easy",
    },

    {
        name = "",
        label = "",
        options =
    {
        {description = "", data = 0},
    },
        default = 0,
    },

    {
        name = "light_color",
        label = "Light Color",
        hover = "Here we change the light color",
        options =
    {
        {description = "Blue", data = "color1"},
        {description = "Red", data = "color2"},
        {description = "Green", data = "color3"},
        {description = "White", data = "color4"},
    },
        default = "color1",
    },

    {
        name = "",
        label = "",
        options =
    {
        {description = "", data = 0},
    },
        default = 0,
    },

    {
        name = "FueledLights",
        label = "Fueled ?",
        hover = "Choose to make the Path Lights use fuel or not",
        options =
    {
        {description = "No", data = "no", hover = "No fuel will be used"},
        {description = "Yes", data = "yes", hover = "Fuel will be used"},
    },
        default = "no",
    },

}

 

AND

DST Resurrection Shelter

Spoiler

 

configuration_options =
{
    {
        name = "Mode", 
        label = "Difficulty",
        hover = "Here you can choose the recipe for your Resurrection Shelter",
        options = 
    {
        {description = "Easy", data = "easy", hover = "5 Logs 4 Pig Skins and 4 Rope"},
        {description = "Normal", data = "normal", hover = "4 Beard Hair 2 Nightmaire Fuel and 10 logs"},
        {description = "Hard", data = "hard", hover = "1 Life Giving Amulet 5 Nightmare Fuel and 10 Boards"},
    },
        default = "normal",
    },    

    {
        name = "", 
        label = "",
        options = 
    {
        {description = "", data = 0},
    },
        default = 0,
    },    

    {
        name = "ShelterUses", 
        label = "How Many Uses ?",
        hover = "Here you can choose how many uses you will get from your Resurrection Shelter ",
        options = 
    {
        {description = "5", data = 5, hover = "5 uses and the Resurrection Shelter will be destroyed"},
        {description = "10", data = 10, hover = "10 uses and the Resurrection Shelter will be destroyed"},
        {description = "20", data = 20, hover = "20 uses and the Resurrection Shelter will be destroyed"},
        {description = "Endless Uses", data = 1000000, hover = "Unlimited uses of the Resurrection Shelter"},
    },
        default = 5,
    },

    {
        name = "", 
        label = "",
        options = 
    {
        {description = "", data = 0},
    },
        default = 0,
    },    

    {
        name = "ShelterLight", 
        label = "Enable Night Light ?",
        hover = "Here you can choose to enable or disable the night light",
        options = 
    {
        {description = "No", data = "no", hover = "You will have no light if resurrected in the dark"},
        {description = "Yes !", data = "yes", hover = "You will have light if resurrected in the dark"},
    },
        default = "yes",
    },
}

 

 

Here is one of the examples taken from PeterA of Klei on the actual condensed format for modoverrides.lua.  I plugged in the info of the mods I want to use using his format.  (Of course if anything is wrong, do tell! LOL...they don't seem to be working so something isn't right!)

Spoiler

 

return {
["workshop-352499675"] = { enabled = true,   --DST Resurrection Shelter
configuration_options =
{
    {
        Mode = Hard, 
        ShelterUses = 1000000
        ShelterLight = yes,
    }
},

["workshop-385006082"] = { enabled = true, --DST Path Lights

configuration_options =

    {
        path_lightrecipe = normal, 
        light_color = color4,
        FueledLights = no,    
    }
}
}

 

 

So on top of any corrections, some of my specific questions are:

  1. Do I use the "name" or "label"--e.g. "path_lightrecipe" or "Recipe"?
  2. Do I use the "description" or "data"--e.g. "blue" or "color1"?
  3. Are brackets [ ] used around the name/label?  Quotes? I saw "correct" examples using these and some without.  e.g. ["Mode"] = hard
  4. Should there be a comma after the last value in the series for each mod? E.g. after ShelterLight = yes, and FueledLights = no,

 

ALSO...do I need to include all of the other mods that I'm not configuring?  Or only the ones that I'm changing from the default?  If so, is this addition correct? (Aside from any corrections that need made otherwise.)

Spoiler

 

return {

["workshop-530985503"] = { enabled = true }, --Jamitrious the Explorer
["workshop-530985503"] = { enabled = true }, --Food Values = Item Tooltips
["workshop-530985503"] = { enabled = true }, --Pickle It

["workshop-352499675"] = { enabled = true,   --DST Resurrection Shelter
configuration_options =
{
    {
        Mode = Hard, 
        ShelterUses = 1000000
        ShelterLight = yes,
    }
},

["workshop-385006082"] = { enabled = true, --DST Path Lights

configuration_options =

    {
        path_lightrecipe = normal, 
        light_color = color4,
        FueledLights = no,    
    }
}
}

 

 

Last question...other than putting in ServerModSetup(" ") in the mods\dedicated_server_mods_setup.lua file and ForceEnableMod(" ") in the mods\modsettings.lua, are there any other places I need to be changing/adding info for mods to work correctly?

WHEW, I think that is it. Haha.  I know this is a bear to read through, and I know the admins here read this stuff constantly, and peeps like me spend hours sifting through it all.  My hope is that this thread turns into being something useful and helpful!!  

Thanks guys, for all your time and assistance!! :D

Link to comment
Share on other sites

Hello @sillygolucky welcome to the forums. I may not know the best way to go about configuring mods but I'll try my best to answer your questions.

...they don't seem to be working so something isn't right!

First of all, with your given modoverrides.lua, I have it rewritten below with the corrections in Bold and Red:

Spoiler

return {
["workshop-352499675"] = { enabled = true,   --DST Resurrection Shelter
configuration_options =
    {
        ["Mode"] = "Hard"
        ["ShelterUses"] = 1000000,
        ["ShelterLight"] = "yes",
    }
},

["workshop-385006082"] = { enabled = true, --DST Path Lights
configuration_options =
    {
        ["path_lightrecipe"] = "normal"
        ["light_color"] = "color4",
        ["FueledLights"] = "no",    
    }
}
}

Now be aware that I have NOT tested this and all my corrections are based on what I learned and know about modoverrides. There is another correction in there too that I can not display since it's the removal of one of the braces ({) after the first configuration_options=. Try the change I made above, and report back with your server_log.txt in your server's Master folder and I'll try to correct any further mistakes I may have made.

Do I use the "name" or "label"--e.g. "path_lightrecipe" or "Recipe"?

I believe the "name" is what the game interacts with when dealing with changing the mod's configurable options while "label" is what will be seen in-client when you are trying to configure the mods through the mods menu. In the example you gave (DST Path Lights' path_lightrecipe or Recipe, when you try to configure the mod through the mods menu in-client, you will see the word Recipe. 

Spoiler

20160408041836_1.jpg

Using modoverrides.lua to configure mods, you'd have to use the "name" of the configuration directly.

Do I use the "description" or "data"--e.g. "blue" or "color1"?

With this it's the same with the previous question, you use the "data" value when configuring the mod with modoverrides since it's the data that gets used when the mod does its thing. while "description" is what you will only see on the mods menu while configuring the mod in-client. As seen in the screenshot above, you see Blue in the configuration options of the mods in-client.

Are brackets [ ] used around the name/label?  Quotes? I saw "correct" examples using these and some without.  e.g. ["Mode"] = hard

Brackets along with double apostrophes are used to contain the specified name of the configuration option. Usually if the name is written as FueledLights (with no spaces) I believe the modoverrides will work is you just use the line, since the game sees the string of letters "FueledLights" as one variable:

FueledLights = "yes",

However, IF the configuration option that is listed in the modinfo.lua of the mod was written as Fueled Lights (with a space), then when you call upon this configuration option in your modoverrides.lua, you would need to use the following line:

["Fueled Lights"] = "yes",

The brackets are used to make sure that the game knows what option a certain data is trying to change, in this case so "yes" would be given to the option for Fueled Lights. Brackets allows the game to know that Fueled Lights is considered as one whole variable. 

So from the game's perspective FueledLights is the same as ["FueledLights"], since they are both considered as one variable. Adding the [""] for the names will make sure that the game knows it's the right variable that it has to change. Keeping the bracket apostrophe up consistently will reduce the risk of the modoverrides.lua not working when dealing with other mods. Since some mods have spaced names for their configuration options.

Should there be a comma after the last value in the series for each mod? E.g. after ShelterLight = yes, and FueledLights = no,

I think the modoverride.lua should work without commas after the last variable/configuration option, although it'll be easier to do it regardless so you won't mistakenly leave an option without a comma (like you did after the data 1000000 for the configuration option of ShelterUses in your example).

...do I need to include all of the other mods that I'm not configuring?  Or only the ones that I'm changing from the default?

You'd have to specify them too since they won't be enabled otherwise. Hence, the use of enabled=true. So you should definitely add them in with the rest of you custom configured mod options.

Last question...other than putting in ServerModSetup(" ") in the mods\dedicated_server_mods_setup.lua file and ForceEnableMod(" ") in the mods\modsettings.lua, are there any other places I need to be changing/adding info for mods to work correctly?

The modoverrides.lua for each server I believe, in case you only want to have specific mods running for specific servers instead of having all the servers you ever run to work off of all the available mods in your mods folder. ServerModSetup(" ") - will download and install the mod to your mod directory on boot. ForceEnableMod(" ") - will cause the game to load the mod every time no matter what. 

And that's about it I guess. I should also probably give extra advice since it may help someone down the line. I'd greatly recommend editing software like Notepad++ that can read lua and give color coded distinctions when a .lua file is opened. It can also help diagnose whether you missed or used too many braces({), since Notepad++ can collapse or expand the text in between braces. You can just google "Notepad++" and the first entry is the right place. Plus its free!

Lastly, there is another way to make modoverrides.lua that is probably much easier. You start up DST, go to Host Game, start a New Server in any slot (for our example lets use Slot 1). Then add anything necessary selecting playstyle, add password to keep randoms out. Now go to the Mods tab, then configure the mods you want to use from there. Now once the game has finished generating the world, make sure that the mods are activated on that server. If it is, the mod's name will appear at the bottom of the player list. In our example it will be shown as Mods: DST Path Lights. 

Now if the mod is active. Disconnect from the server. Go to this location Documents\Klei\DoNotStarveTogether\Cluster_1\Master, and the modoverrides.lua of the server you just created is there. You can probably learn more about how the modoverrides.lua work by playing around with this method. Since this method generates the modoverrides.lua through the game.

I hope that helps, if anyone with better know-how about this stuff and noticed I may have given incorrect information or misunderstood any specifics on the matter feel free to correct them. 

Cheers.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...