onimitch / ffxi-balloon-ashitav4

This is an Ashita v4 port of the Balloon addon, forked from StarlitGhost's version. The original Windower Balloon addon was created by Hando and modified by Kenshi, Yuki and Ghosty.
Other
3 stars 1 forks source link

Default to system settings for unknown message modes #10

Closed Herschel closed 7 months ago

Herschel commented 7 months ago

Use a default message mode in ui:set_type to avoid an error when an arbitrary chat mode is added to settings.additional_chat_mode.

For example, I added chat mode 148 to my settings, and when a mode 148 message is received, the following error is thrown:

[15:52:56] [15:52:56] [Addons] Addon 'balloon' encountered an error during an event callback 'text_in'. Error: \addons\balloon\ui.lua:353: attempt to index field '_type' (a nil value)
[15:52:56] stack traceback:
[15:52:56]  \addons\balloon\ui.lua: in function 'set_type'
[15:52:56]  \addons\balloon\\balloon.lua:355: in function 'process_balloon'
[15:52:56]  \addons\balloon\\balloon.lua:219: in function 'process_incoming_message'
[15:52:56]  \addons\balloon\\balloon.lua:707: in function <\addons\balloon\\balloon.lua:695>

Defaulting to _system_settings seemed reasonable to me. Other possibilities include logging an error message in this case, or changing the additional_chat_mode table to also contain to UI setting for each mode.

onimitch commented 7 months ago

Yeah falling back to system settings sounds fine for now. I agree that ideally it would be nice to have it user configurable when adding extra chat modes but let's see if many people request that.