EXPWorlds / Godot-Dialog-System

A Dialog System Addon for the Godot Engine.
MIT License
124 stars 8 forks source link

Problems with get_nid_from_slot() #4

Closed sdeesknees closed 4 years ago

sdeesknees commented 4 years ago

Hi, I'm having an issue with reading my story files properly.

In the Dialogue player tutorial, you call play_dialog() in the ready of the dialogue player scene, like so: image

I created a function that lets me instance the dialogue player and call different records depending on the scene I'm in. here it is: image

The way I understand it, the play_dialog() doesn't have to appear in the ready() of the dialogue player's scene. My entire story runs fine across all the scenes I instance the dialogue player in, yet whenever I remove it from the dialogplayer scene, I get errors in the get_nid_from_slot() despite having no issues in the node tree or code (afaik):

image

It seems like there is a bug somewhere or there's something I missed about how this system should work.

EXPWorlds commented 4 years ago

Okay, thanks for the email bump, I don't come here to often.

So, a couple of things... First, the included dialog player example was only ever intended to be a teaching device to demonstrate how to use the Editor and StoryFile Reader. You are, of course, welcome to use it however you like, but I generally assumed people would write their own Dialog Player solution using the StoryReader's API. In other words, the focus of the addon isn't the included dialog player example, the focus is the Editor and the StoryReader class.

About the "get_nid_from_slot" function, it's hard to tell what's going wrong without the error message. You're right to say that the play_dialog() function shouldn't have to be in the _ready() function, that's true. I don't think there's anything wrong with the StoryReader though. It's more likely that something is wrong with the input being fed to the get_nid_from_slot() function. Put print_debug(_did, _nid, slot) before the function call and check the values in the output console. My guess is that they won't be what you expect. Then follow the values backward to keep narrowing down the problem to the source. Hope that helps you find the issue.

If not, send me more information about the errors you're getting, and/or a copy of the project file and I'll see what I can do.

Best!

sdeesknees commented 4 years ago

Hello! Thanks for the response! The error is always an Assertion failed or a failure to find a slot. I think I'm not quite familiar enough with programming yet to understand how to build my own dialogue player solution, so I was building on top of yours for my own game. But I understand your focus!

I've attempted your suggestions, and I'm still not sure what's wrong. I've narrowed it down to how the on spacebar pressed function is calling an get_next_node(), which tries to find the did, nid, and slot of a record name. without play_dialog having some existing record_name passed through it in the ready function, an Assertion failed is returned. So It's leading me to believe that play_dialog has to be called in ready(), yet that shouldn't be a problem. I think it will make more sense if I sent you a section of my game via email to clarify things!

EXPWorlds commented 4 years ago

I've taken a look at your project. Nice work, btw. I got an idea about what you're trying to do, but, like you said, I can't reproduce the error from your main project, even when removing the play_dialog function in the _ready function.

If one of the assertions failed it means that one or more of the values passed to the function are invalid or out of bounds for your story file. Make doubly sure all the nodes are connected correctly. Nice job narrowing the issue to when the _on_Dialog_Player_pressed_spacebar function is called, that helps a little. You're going to have to continue probing the values until you find the cause of the problem. Put "print_debug" functions right before the get_next_node() in the _on_Dialog_Player_pressed_spacebar function.

I might be able to help more with a screenshot of the Debugger's "Stack Frame" list when the error occurs.

As for advice on how to use the dialog player to trigger events, take a look at my YouTube channel. I just posted a video about how my RPG triggers events via dialog nodes: https://youtu.be/76hrohTTMM0

sdeesknees commented 4 years ago

Hi dave,

Thank you! We made the game in a week long game jam as well, and your dialog editor definitely helped a ton: https://anothernoodle.itch.io/shhh It's not finished, especially the ending, we're working on polishing it for an exhibition!

I'm not sure about sending you my entire project because it's still in need of a lot of work! I'm basically using tags in my story to trigger different events with if "string" in text: statements. Not very efficient but I'm currently pretty strapped for time in terms of cleaning it up.I'm hoping to refactor everything at some point based on the tips from your more recent tutorials!

So below is what happens when I try to advance my story from a scene without a play_dialog() in the Dialogue scene. So we know that it's caused by the StoryReader being unable to find a story to read once the spacebar is pressed. The thing is, the first line of my story file in the scene is loading, since it prints in my dialogue box. This is why I assumed something was wrong in StoryReader somehow, since It seemed like it was trying to read a non-existent file instead of the one it had been passed. [image: image.png] Below is the (did,nid,slot) output i get when the play_dialog() is removed. The 00 is the (_did,_nid) printed when the spacebar is pressed. so the (did,nid,slot) printed after the 00 happens, and then the above assertion failed is thrown by the StoryReader. [image: image.png] Below is what happens when the play_dialog is present, and you can see that I'm able to press the spacebar more than once with no problems. This is how my game is able to run now in the itch link I sent, where there is essentially a dummy story playing throughout in the play_dialog, while my scene_dialogue function overwrites it. You can see this happen with the "I'm a problem" statements, which are printing from the dummy story so I could check when the scene_dialogue story overwrote the dummy one. My understanding is that on starting the game, the ready() calls the play_dialog, then the dialogue system is instanced by my scene, and the play_dialog is called again by its instance, and then scene_dialogue's path is called. Hence we get the double print of "i'm a problem" as the dummy story is being called twice.I'm not sure what to do with the information about the did, nid and slot numbers though. [image: image.png]

Apologies for the mess, thank you so much for your help!

Best,

Wei Ting

On Sat, 22 Aug 2020, 07:15 Dave the Dev, notifications@github.com wrote:

I've taken a look at your project. Nice work, btw. But, I can't reproduce the error you're talking about, even when removing the play_dialog function in the _ready function.

If one of the assertions failed it means that one or more of the values passed to the function are invalid or out of bounds for your story file. Make doubly sure all the nodes are connected correctly. Nice job narrowing the issue to when the _on_Dialog_Player_pressed_spacebar function is called, that helps a little. You're going to have to continue probing the values until you find the cause of the problem. Put "print_debug" functions right before the get_next_node() in the _on_Dialog_Player_pressed_spacebar function.

I might be able to help more with a screenshot of the Debugger's "Stack Frame" list when the error occurs.

As for advice on how to use the dialog player to trigger events, take a look at me YouTube channel. I just posted a video about how my RPG triggers events via dialog nodes: https://youtu.be/76hrohTTMM0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-678552778, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPEI5I66L6Z5FIH62ULSB35YFANCNFSM4P7HNLHQ .

EXPWorlds commented 4 years ago

Can you fix the images in the previous post?

A DID of 0 and NID of 0 are both invalid values. You need to figure out why they're 0. Remove the play_dialog from the _ready function, you shouldn't need it. Keep moving your print_debug throughout the script and checking the values. My recommendation is to start at the beginning of the script and test the values along each step of the way until they become invalid.

sdeesknees commented 4 years ago

Hi!

Not sure what you mean by fix, I assume you mean the order in which they are presented? If so, I put it all in a word doc so you could take a look. Sorry for the trouble!

Best,

Wei TIng

On Sun, Aug 23, 2020 at 8:13 PM Dave the Dev notifications@github.com wrote:

Can you fix the images in the previous post?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-678766734, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPDLVM4ZJPL2NAWMXN3SCEBYDANCNFSM4P7HNLHQ .

EXPWorlds commented 4 years ago

Sorry, I mean, for me they're not showing up. They look like this "[image: image.png]"

sdeesknees commented 4 years ago

Oh i see! Does the word doc work for you?

On Tue, 25 Aug 2020, 05:26 Dave the Dev, notifications@github.com wrote:

Sorry, I mean, for me they're not showing up. They look like this "[image: image.png]"

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-679375157, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPGEWUMKPKOKGUPYEOLSCLLIZANCNFSM4P7HNLHQ .

EXPWorlds commented 4 years ago

Is there suppose to be one? If there is, I don't see it. If you asking if a word doc would work for me, then sure, attach it to an email.

Besides that, any luck with the troubleshooting?

sdeesknees commented 4 years ago

Hi!

The word doc is attached to the email before the last one i sent you!

Not luck troubleshootimg at the moment, just using my dummy story to keep things working.

Thank you!!

Best Regards,

Wei Ting

On Tue, 25 Aug 2020, 20:44 Dave the Dev, notifications@github.com wrote:

Is there suppose to be one? If there is, I don't see it. If you asking if a word doc would work for me, then sure, attach it to an email.

Besides that, any luck with the troubleshooting?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-680001899, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPACUFCWOHCIAI2SKM3SCOW3HANCNFSM4P7HNLHQ .

sdeesknees commented 4 years ago

Attached is the word doc i was referring to just to make it easier to find!

-Wei Ting

On Wed, 26 Aug 2020, 08:14 Wei Ting, huwettchia@gmail.com wrote:

Hi!

The word doc is attached to the email before the last one i sent you!

Not luck troubleshootimg at the moment, just using my dummy story to keep things working.

Thank you!!

Best Regards,

Wei Ting

On Tue, 25 Aug 2020, 20:44 Dave the Dev, notifications@github.com wrote:

Is there suppose to be one? If there is, I don't see it. If you asking if a word doc would work for me, then sure, attach it to an email.

Besides that, any luck with the troubleshooting?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-680001899, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPACUFCWOHCIAI2SKM3SCOW3HANCNFSM4P7HNLHQ .

EXPWorlds commented 4 years ago

Sorry, not seeing any attachments in this thread. Lets continue via email and attached the files there instead. This isn't an issue with the Dialog Editor anyway, so I'm going to close the issue.

sdeesknees commented 4 years ago

Got it! I emailed you in another email thread with more details

On Fri, 28 Aug 2020, 19:28 Dave the Dev, notifications@github.com wrote:

Sorry, not seeing any attachments in this thread. Lets continue via email and attached the files there instead. This isn't an issue with the Dialog Editor anyway, so I'm going to close the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EXPWorlds/Godot-Dialog-System/issues/4#issuecomment-682474059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIPQPAP6QRD6RLWKOUYKYTSC6IGTANCNFSM4P7HNLHQ .