Mod Options

There is a possibility to provide some settings to your mod.



Setup
To do so you need define options in info.lua:

local speeds = { "Slow", "Normal" , "High" } return {   majorName = StringOption( "Major name", "John" ), peopleCount = IntOption( "People count", 4 ), weddingCost = NumberOption( "Wedding cost", 2.5 ), allowWeddings = BooleanOption( "Allow weddings", true ), gameSpeed = EnumOption( "Game speed", speeds, 2 ), }

As you can see there are several types of options: String, Int, Boolean and Enum.

StringOption
Represented by editbox.


 * First argument is visible name in menu.
 * Second argument is default value.
 * Last argument is optional tooltip text.

IntOption
Represented by editbox. Allow only integer values.


 * First argument is visible name in menu.
 * Second argument is default value.
 * Last argument is optional tooltip text.

NumberOption
Represented by editbox. Allow real values.


 * First argument is visible name in menu.
 * Second argument is default value.
 * Last argument is optional tooltip text.

BooleanOption
Represented by checkbox.


 * First argument is visible name in menu.
 * Second argument is default value (true or false).
 * Last argument is optional tooltip text.

EnumOption
Represented by combobox with several options.


 * First argument is visible name in menu.
 * Second argument is list of possible options.
 * Third argument is default value. It is serial number of option in the list.
 * Last argument is optional tooltip text.

Usage
In mod scripts you can access global variable OPTIONS. It will contain table with filled values:

{    majorName = "John" , peopleCount = 4 , weddingCost = 2.5 , allowWeddings = true , gameSpeed = 2 , }