Author Topic: possible bug when asking a question  (Read 857 times)

Yosha

  • Newbie
  • *
  • Posts: 32
    • View Profile
possible bug when asking a question
« 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 ?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1043
    • View Profile
Re: possible bug when asking a question
« Reply #1 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 781
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: possible bug when asking a question
« Reply #2 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?

Yosha

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: possible bug when asking a question
« Reply #3 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.

MetalZelda

  • Hero Member
  • *****
  • Posts: 508
    • View Profile
Re: possible bug when asking a question
« Reply #4 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

Yosha

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: possible bug when asking a question
« Reply #5 on: January 11, 2017, 06:55:38 pm »
I use the alttp dialog box. The one in the ressource pack.

Diarandor

  • Hero Member
  • *****
  • Posts: 781
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: possible bug when asking a question
« Reply #6 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
  1. 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

MetalZelda

  • Hero Member
  • *****
  • Posts: 508
    • View Profile
Re: possible bug when asking a question
« Reply #7 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
« Last Edit: January 11, 2017, 07:45:45 pm by MetalZelda »

Yosha

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: possible bug when asking a question
« Reply #8 on: January 11, 2017, 08:16:53 pm »
Good job Diarandor! It works fine with the line self.choices = {} added.

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)

Diarandor

  • Hero Member
  • *****
  • Posts: 781
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: possible bug when asking a question
« Reply #9 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
« Last Edit: January 11, 2017, 09:24:58 pm by Diarandor »