Making a basic menu
Learn how to make a basic menu with DSS.
Intro
We're going to make a simple menu with an options page featuring an on/off switch, as well as a page where you can heal every player at the click of a button. We'll be storing data using the :SaveData() method of our ModReference.
Setting up your mod
Before we can use DSS, we first need to register our mod in our main.lua file. While we're at it, let's define a couple functions that'll handle saving and loading our mod's data.
DSS expects us to save the menu-related data ourselves. If your mod has its own save manager in it, them use those! Otherwise, you can use the code below.
Setting up DSS
As the developer, you get to choose how your save data is loaded and saved. This means that you need to define the functions DSS uses to save and load its own data.
Let's define a table that'll contain all of the aforementioned functions. We'll store this table in a variable named menuProvider. Make sure to customize these functions to suit your mod's save data structure.
It's time to initialize DSS. We'll include dssmenucore and use the function it returns to initialize DSS.
Creating your menu's main page
Creating a menu is a simple and intuitive process. Your entire menu will be defined within a main "directory," which is just a table. Let's create our directory, then make the main page that will appear when your menu is opened.
Creating a page to heal all players
We're going to define another page in our menu just like before. This page will have only two buttons: one button that will take you to the previous menu, and one that will play a sound effect and heal all players when pressed.
Creating a settings page
The final page of our menu will be the settings page. There will only be one setting, which can either be on or off. To achieve this, we're going to make a settings button. There are many different types of settings buttons. For our purposes, we want to make a multiple choice button that lets us choose either "on" or "off."
Implementing our menu
We're almost done! The last thing we need to do is to actually add our menu to DSS. First, we must make a directory key. This is a table used by DSS and tells it about our directory.
Finally, let's add our menu using the AddMenu function of the DeadSeaScrollsMenu global.
Conclusion
With all of this, you now have your first menu up and running.

You can download the example mod and inspect how it works below. It includes the code found in the "Adding changelogs" tutorial and the "Adding menu palettes" tutorial.
Last updated