dialogic-godot / documentation

📖 The documentation for the Dialogic Godot plugin.
http://docs.dialogic.pro
16 stars 12 forks source link

Add example of how to use `_set_extra_data`. #57

Closed AHuynh closed 2 months ago

AHuynh commented 2 months ago

I recently was attempting to use the extra_data field, found as part of custom portraits: https://docs.dialogic.pro/custom-portraits.html

But it took me quite a while to figure out how to use it, as though the extra_data feature is described by the docs ("...allows specifying some extra information in the text editor"), the actual syntax it expects it isn't shown on this page. Instead, you'd have to search for it and find it on a different page: https://docs.dialogic.pro/layered-portraits.html?highlight=extra_data#5-controlling-the-layers

This is a problem because, unlike the other potential fields the join and update events can take, such as mirror or z_index, extra_data can only be specified using the text editor, not the visual editor. You'd have no way of knowing the syntax from this doc page alone.

This change adds a short example on the explicit syntax Dialogic expects to use extra_data.

Note: The update event doesn't actually update extra_data in the current release of Dialogic (2.0 - Alpha 14). The following commit fixes this behavior, but until it's included as part of the current release, what this pull request describes doesn't actually work as advertised: https://github.com/dialogic-godot/dialogic/commit/1bf165bc4557535c341460c59dd02b295c45b260

Jowan-Spooner commented 2 months ago

Thanks. This looks good to me. I think there wasn't a more specific example given because the use of the extra_data is highly dependant on the implementation of the custom portrait, but this general example seems good to me, maybe we can expand on the whole thing in the future.