possible bug when asking a question

Started by Yosha, January 10, 2017, 04:00:35 PM

Previous topic - Next topic
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 ?

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.

My guess is that it could be some local variable overriding another variable, or some variable that is not cleared maybe?
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

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.

It depends on a thing, are you using a custom dialog script ? If yes, then this might be user-side issue, not engine-side

I use the alttp dialog box. The one in the ressource pack.

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
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

January 11, 2017, 07:39:34 PM #7 Last Edit: January 11, 2017, 07:45:45 PM by MetalZelda
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

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)

January 11, 2017, 08:22:25 PM #9 Last Edit: January 11, 2017, 09:24:58 PM by Diarandor
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
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."