Skip to content

Settings

Declared in onLoad, shown in the menu, saved with your config, and changeable with /fkdr set <script> <setting> <value>.

fkdr keeps them for the script, for one reason: the value survives the script being edited. Anything living in a script's own variables resets on every reload, which is exactly when you are iterating and least want it.

function onLoad() {
    settings.bool('Alert', true, 'Shout when a bed is close.');
    settings.number('Range', 24, 4, 128, 1, 'How far to look, in blocks.');
    settings.mode('Style', 'Box', ['Box', 'Outline', 'Corners'], 'How to draw it.');
    settings.text('Message', 'bed!', 'What to shout.');
    settings.key('Toggle', 0, 'Bind.');
    settings.multi('Teams', ['Red', 'Blue', 'Green', 'Yellow'], 'Which teams count.');
    settings.color('Colour', 0xFF5BD75B, 'The colour to draw in.');
    settings.button('Open folder', function () { script.openFolder(); });

    settings.group('Advanced');        // everything after this is prefixed in the menu
    settings.bool('Verbose', false);
    settings.group('');                // stop grouping
}

Reading and writing

Two ways; they are the same value:

settings.Range              // 24
settings.get('Range')       // 24
settings.Range = 32;        // clamped to the declared range
settings.set('Range', 32);

Types come back as the JavaScript type you would expect:

declared with reads back as
bool boolean
number number
mode, text string
multi array of the selected options
key number (LWJGL key code)
color the packed 0xAARRGGBB integer

settings.ref('Range') gives the setting object itself (.min, .max, .step, .options, .type) if you need it.

Notes on three of them

color is stored as #AARRGGBB text and read back as a packed integer. A script colour shows as an editable hex field you can set with /fkdr set, and it keeps its alpha, which the built-in colour picker (Hitboxes, Outline, BedESP) deliberately does not carry.

button shows as a switch: ticking it runs your function and puts it straight back, so it flicks and springs back like a button.

group prefixes the setting's menu name with Group ·. Your script still refers to it by the plain name.

Renaming resets

Renaming a group or a setting puts those settings back to their defaults once.