Easier fields for script configuration

Setting up custom fields in Rename scripts has become easier in v13:

Instead of using a separate Map object for labels and tooltips, these can now be assigned to properties of the custom field itself.

Wouldn't it make sense to apply the same logic to ScriptInitData's config property?

Instead of

initData.config_desc('logLevel') = 'Set level of logging';
initData.config_groups('logLevel') = '3 - Misc';
initData.config.logLevel = DOpus.Create.Vector(1,
    'none',
    'standard',
    'max');

we could write

initData.config.logLevel.desc = 'Set level of logging';
initData.config.logLevel.groups = '3 - Misc';
initData.config.logLevel = DOpus.Create.Vector(1,
    'none',
    'standard',
    'max');

And how about a few more properties?

friendlyname to avoid having to show the sometimes akward variable names.

sortorder and grouporder to have a custom order without number prefixes.

5 Likes

By the way, I'm using this updated config helper function that allows shorter (and customizable) prop names so you can add config like

C.add('⎋').val(DC.Vector('q')).g('Keybind').des('Cancel');

And you can add an invisible space symbol like this to move your group to the bottom without adding any z prefixes

inc_cfg.js.txt (1.6 KB)

originally from here