Skip to content

Forms

Section notes in abi.h

Β§G forms (async result callback)

Slots

form_send

C
1
2
3
4
5
6
7
8
bool (*form_send)(
    PierModHandle mod,
    PierPlayerSel sel,
    int32_t kind,
    PierStr form_snbt,
    PierFormResultCb cb,
    void* user
);

kind: 0=SimpleForm 1=CustomForm 2=ModalForm. form_snbt describes the form (see docs/api/gui). The callback fires once, on the server thread, and is muted if the mod is disabled before the player responds.

Types

PierFormResultCb

C
typedef void (*PierFormResultCb)(void* user, PierStr result_snbt);

Form result callback. Invoked ONCE on the server thread when the player responds (or the form is cancelled). result_snbt:

Text Only
1
2
3
4
cancelled       : {cancelled:1b, reason:N}
SimpleForm      : {button:N}
CustomForm      : {values:{<name>: string|double|int64…}}
ModalForm       : {button:"upper"|"lower"}

Muted (never called) if the mod is disabled before the player responds.