Remix Menu

From Rain World Modding
Jump to navigation Jump to search


Cleanup needed
This article needs structural or tonal clean-up to meet quality standards. Feel free to help improve it.


This section is unfinished
This section is lacking some / all of critical information.

Remix uses ConfigMachine for it's option interfaces.

Creating an options menu:[edit source]

Options menus are inherited from OptionInterface

public class OptionsMenu : OptionInterface

You will want to store your configurable variables as: public readonly Configurable<TYPE> NAME; , then initialize them in the constructor:

public OptionsMenu(Plugin plugin)
    NAME = this.config.Bind<TYPE>("KEY", DEFAULTVALUE);

IMPORTANT: Config entry keys should only contain Latin letters and underscores! Putting an unexpected character will throw an exception

Setting up the interface[edit source]

In your Initialize() method:

var opTab = new OpTab(this, "TABNAME"); //Create a tab.
this.Tabs = new OpTab[] {
opTab //Add the tab into your list of tabs.
UIelement[] UIarrayOptions = new UIelement[] { //create an array of ui elements
    new OpLabel(10f, 550f, "Options", true), //Creates a label at 10,550 with big text saying "Options"
opTab.AddItems(UIarrayOptions); //adds the elements to the tab

A list of all UI elements in ConfigMachine is available here.

Connecting your options interface[edit source]

You will need to setup an instance of your optionsmenu in the main plugin:

private OptionsMenu options;
public Plugin()
    options = new OptionsMenu(this);

Then in your OnModsInit hook, add a call to register your interface:

public Hook_OnModsInit(On.RainWorld.orig_OnModsInit orig, RainWorld self)
    try {
        MachineConnector.SetRegisteredOI("PLUGINID", options);
    catch (Exception ex) { 
        /* make sure to error-proof your hook, 
        otherwise the game may break 
        in a hard-to-track way
        and other mods may stop working */

Plugin id must be EXACT to the id specified in your mod's ModInfo.json

You can retrieve the values from the option menu simply by doing .
For player specific values you can have the option value as an array, and simply do[self.playerNumber].value to return that player's version.