AnidemDex / Godot-DialogPlugin

🗨️ A Dialog Node for Godot Engine
MIT License
213 stars 11 forks source link

get_wordwrap_string_size: Condition "p_width <= 0" is true. Returned: Vector2(0, get_height()) #62

Closed tavurth closed 2 years ago

tavurth commented 2 years ago

OS

Mac OSX

Godot Version

3.4.1

Plugin Version

1.0 (lastest)

Issue description

Black box displays but no text is present and the error is shown in the console.

Screenshot 2021-12-22 at 21 36 08

Steps to reproduce

func _ready() -> void:
  # Creates a new DialogNode instance
  var dialog_node = DialogNode.instance()

  # Add the node as child
  add_child(dialog_node)

  # Shows the dialog node
  dialog_node.show()

  # Show an string. BBCode works too!
  dialog_node.show_text("Hello world!")

Workaround

Perhaps adding the dialog to the tree directly?

Finally I gave up as it's a bit confusing to use so far. I'll write a dialog system myself 😅

AnidemDex commented 2 years ago

This is because the node is hidden before adding text. See https://github.com/AnidemDex/Godot-DialogPlugin/issues/52#issuecomment-997280411 and https://github.com/AnidemDex/Godot-DialogPlugin/issues/51

If you don't need the autoscroll feature, you can disable it, and that'll hide this error.

tavurth commented 2 years ago

Hi @AnidemDex, currently I'm working around this by adding a node to my tree and it seems to be ok, nice scrolling feature 👍

The node is hidden? Do you mean the parent node? This script was taken from the documentation directly.

AnidemDex commented 2 years ago

@tavurth if DialogManager or DialogNode is hidden, the autoscroll will fail because it'll not have a correct size to know when and from what size it should start scrolling (since hidding nodes set its size to 0).

If you managed to solve the issue, please, edit the issue to add your workaround

tavurth commented 2 years ago

Ok I'm still playing around a little bit, when I find a solid solution I will edit the post

AnidemDex commented 2 years ago

@tavurth I wasn't able to replicate the issue. Can you please add more information about your scene? Maybe you're adding it as child of a Node2D?

AnidemDex commented 2 years ago

I made a little example with the code. textalog

tavurth commented 2 years ago

Yep that must be it, I was using as a child of Node2D.

Finally I realised this plugin is a bit too complex for my use case, so I wrote a quick script to do the same thing with sound effects.

https://gist.github.com/tavurth/65234316a2f6c980507515de2eec67e9

AnidemDex commented 2 years ago

Welp, glad that you managed to make a solution.

Hope that, in the future, you can give Textalog another chance, I know that it needs more docs/tutorials so I wish in the future I was able to make them