Settings
A mod can add rows to the Phigros++ tab of the game's settings. Phigros++ saves what the player picks, so it's the same after a restart.
local enabled = setting("Say hello", true) -- a toggle, on by default local times = setting("Times", 3, { 1, 10 }) -- a slider from 1 to 10 local mood = setting("Mood", "happy", { "happy", "sleepy" }) -- a choice, a tap picks the next one button("Say it now", function() for _ = 1, times() do toast("Hello, I'm " .. mood()) end end) if enabled() then toast("Hello!") end
setting gives back a function: call it to read the current value. Calling it with a value changes the setting, as if the player had.
The label is also the name the value is saved under, so it can be used only once across all mods: a second setting or button with the same label stops the mod from loading. Pick labels that say what they do, like "Say hello" rather than "Enabled".
Give a last argument to put the rows in a tab of their own, named after your mod:
local enabled = setting("Say hello", true, "My mod") button("Say it now", sayIt, "My mod")
To react the moment the player changes something:
on("setting", function(label, value) if label == "Say hello" then print("now", value) end end)
More kinds of rows (links, progress bars, rows that only show sometimes) are in Mod API.