HEX
HexscriptsJobscreatorExports

Custom Interactions

Register your own interaction type from another resource the creator renders a form for it, validates what staff enter and stores the result.

registerInteraction lets another resource add its own interaction type to the creator. The creator then renders a form for it, validates what staff enter, and stores the result as that point's data.

registerInteraction

exports['hex_jobscreator']:registerInteraction({
    name = 'my_atm',
    label = 'My ATM',
    data = {
        { name = 'fee', label = 'Fee', type = 'number', min = 0, max = 100, default = 5 },
        { name = 'tint', label = 'Screen Colour', type = 'color', hasColorPicker = true },
        { name = 'needed', label = 'Required Items', type = 'itemlist', min = 1, max = 5 }
    }
})

Prop

Type

Returns

ValueMeaning
truetype registered
false, reasonregistration was refused; the reason is also printed to the console

Naming rules

name must start with a letter and contain only letters, numbers and _, and cannot be one of the built-in types.

Lifecycle

SituationWhat happens
You re-register your own typeit is overwritten
You register another resource's typeit is refused
Your resource stopsyour types are removed

When your resource is not running

Points you created stay in the database and staff can still edit their General, Access and Placement settings. The custom fields cannot be rendered without your definition, so the creator shows a notice in their place.

Nothing is lost

The point's stored settings are passed through untouched when staff save, so nothing you configured is lost while your resource is down.

Next