Solarus-Games English Forum

Solarus => Bugs & Feature requests => Topic started by: Yosha on January 10, 2017, 04:00:35 PM

Title: possible bug when asking a question
Post by: Yosha on January 10, 2017, 04:00:35 PM
Hello! I don't know if it is a bug,if someone already told it, or if it's just my mistake, but when I wanted to ask a question with 3 answers, if one of this answer has another question with only 2 answers, the cursor moves like there was 3 answers, like the first question(even if the fourth line is blank, or the answers start on the third line, the cursor moves on line 2,3 and 4

I found why it was like that, but I don't know if it's normal: in my dialog, I put all the questions in the same sub directory like this :

- somedialog.question.question1
- somedialog.question.question2

question1 having 3 answers, question2 having 2 answers. When testing, there's the bug I mentionned.

To avoid the bug, I had to do this.
- somedialog.question1.question
- somedialog.question2.question

Did anyone already see this ?
Title: Re: possible bug when asking a question
Post by: Christopho on January 10, 2017, 06:07:20 PM
Maybe you should report the bug on https://github.com/solarus-games/solarus/issues/new with an example of dialogs file so that I can reproduce it.
But it is very strange that changing dialog ids fixes the problem.
Title: Re: possible bug when asking a question
Post by: Diarandor on January 10, 2017, 06:38:51 PM
My guess is that it could be some local variable overriding another variable, or some variable that is not cleared maybe?
Title: Re: possible bug when asking a question
Post by: Yosha on January 11, 2017, 06:42:21 AM
Done ! I put an issue on github : https://github.com/solarus-games/solarus/issues/1016
I was wondering if my dialog code was right, but I don't think it was the problem.
Title: Re: possible bug when asking a question
Post by: MetalZelda on January 11, 2017, 05:11:13 PM
It depends on a thing, are you using a custom dialog script ? If yes, then this might be user-side issue, not engine-side
Title: Re: possible bug when asking a question
Post by: Yosha on January 11, 2017, 06:55:38 PM
I use the alttp dialog box. The one in the ressource pack.
Title: Re: possible bug when asking a question
Post by: Diarandor on January 11, 2017, 07:38:28 PM
I agree with MetalZelda, this has to be something related to the script and not the engine.

I am not sure, but I think the problem is that the "choices" list is not cleared when starting a new dialog after another. This is untested, but maybe adding the line
Code (Lua) Select
self.choices = {}
somewhere inside the function "function dialog_box:show_next_dialog()" could solve this bug.

Can someone test if this works or if this is the problem?

The script is here:
https://github.com/solarus-games/solarus-alttp-pack/blob/dev/data/scripts/menus/alttp_dialog_box.lua
Title: Re: possible bug when asking a question
Post by: MetalZelda on January 11, 2017, 07:39:34 PM
If it is related to the ALTTP pack then the bug is related to the script, maybe the algorythm that handle how and where the cursor should be.

My guess is that something is wrong here, might investigate it tonight

https://github.com/solarus-games/solarus-alttp-pack/blob/dev/data/scripts/menus/alttp_dialog_box.lua#L530

Edit: Diarandor might have the solution
Title: Re: possible bug when asking a question
Post by: Yosha on January 11, 2017, 08:16:53 PM
Good job Diarandor! It works fine with the line self.choices = {} added.

Quote from: MetalZelda on January 11, 2017, 07:39:34 PM
Edit: Diarandor might have the solution
He definitely had the solution.  ;)
Sorry to have opened an issue on github for a script error... (I don't even think to check it, and even if I checked the script, I'm not familiar with all the subtility of the lua language)
Title: Re: possible bug when asking a question
Post by: Diarandor on January 11, 2017, 08:22:25 PM
Great. :)

@Yosha: you can now close the issue from the solarus repo.
Could you open a new issue for this bug in the alttp_pack repo? Add there a link to this post too.
Thanks.

(I'll do it myself.)
EDIT: done. https://github.com/solarus-games/solarus-alttp-pack/issues/6