Skip to content

Gotchas

Nenkai edited this page Jul 15, 2024 · 4 revisions

Event Results

This is crucial and used for UI operations/events (onKeyPress, onInitialize, etc).

There are three macros you have to keep in mind:

  • EVENTRESULT_CONTINUE - Event will continue to run across other relevant UI widgets.
  • EVENTRESULT_STOP - Other events for this widget will not fire.
  • EVENTRESULT_FILTER - Event will be filtered - this specific event will not be passed to any other widgets.

Always return it in UI related event functions as the engine expects for:

  • onKeyPress
  • onKeyRelease
  • onButtonPress (not seen used)
  • onButtonRelease (not seen used)
  • onEnter
  • onLeave
  • onActivate
  • onCancel
  • onFocusEnter
  • onFocusLeave
  • onTextOpen (>GT4)
  • onTextClose (>GT4)
  • onTextInput (>GT4)

Uncertain if using event results:

  • onVisibleNotify
  • onFocusNotify
  • onValueChanged

And potentially more.

Example:

function onKeyPress(context, event, item)
{
    if (event.keysym == CELL_PAD_CTRL_START)
    {
        return EVENTRESULT_FILTER;
    }

    return EVENTRESULT_CONTINUE;
}

Interpolator Callbacks

Remember to set your object's callback to nil inside the callback, otherwise it will always be called.

object.on_effect_end = (context) => 
{
    object.on_effect_end = nil;
}
Clone this wiki locally