Trivia help. endless blank questions instead of ending
ryan.js76
Member Posts: 4
I was following this tutorial Most things are working fine. I changed it so after the answer is selected, it goes to a new scene for an explanation of the answer. You click on the "next question" button and it does what it's supposed to do. The problem is on the last question explanation scene, when the button is pressed and is supposed to go to "winner" "loser" scene, it just keeps putting up blank multiple choice questions. I have added the question counting and answered rules to the "next question" button, but???? Will it have to look at the table itself?
Comments
It's tough to know from a 30-minute video what you might have missed. Post a screenshot of the rule(s) you're using to check for the End Game condition.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
My guess after a quick glance at the video is that you need a rule along these lines:
When [question is answered correctly]
Change attribute game.questionNumber to game.questionNumber+1
When game.questionNumber > tableRowCount(questionsTable)
Change Scene [game over scene]
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks, I'll try that. I suspected something like that, as when the question is answered, it loads the "explanation" scene and the "next question" button has to count the questions. Right now the button has "game.questionNumber+1." to load the next question. There are a number of other attributes to try and count the questions, but I'll try and have it look at the table itself.
When I'm back at my computer I'll post a screenshot.
Here is the rules / attributes for the next question button from the "explanation" scene. Adding the tableRowCount made it jump from the first question to the last.
Rule: actor receives event / touch /pressed
Change Attributes:
-go to scene / questions
-game.question number / game.questions number +1
-game.questions answered / game.questions answered
Rule: Attribute / game.questions answered = 10
Attribute / game.score ≥ 6
go to scene: winner
Rule: Attribute / game.questions answered = 10
Attribute / game.score ≤ 5
go to scene: loser
I'm not sure what "go to scene" refers to. This is why a screenshot (uploaded to a file-sharing site such as Dropbox and the link then posted here) is preferable. I assume you mean a Change Scene behavior, but if it's something else then it could make a difference as to how to troubleshoot this.
What does "game.questions answered / game.questions answered" mean? Is there supposed to be a "+1" on the end of that?
Anyway, it appears the game over condition is that game.questions answered = 10. So the problem lies in that rule. What I would recommend is either using a Log Debugging Statement to watch the value of that attribute or better yet, using a Display Text behavior to watch the value of that attribute. It may surprise you... for example, you may have answered 9 questions but the value is still 1 or you may have answered 9 questions and the value is 22, or whatever. Once you know that it is in fact counting incorrectly, you can then look at where the value of game.questions answered is changing and see what might be wrong in those rule(s).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
https://www.dropbox.com/s/osow0qb5k76bgjf/Screen Shot 2017-09-18 at 1.43.41 PM.png?dl=0
https://www.dropbox.com/s/4d3vp6844tcq5tt/Screen Shot 2017-09-15 at 1.14.48 PM.png?dl=0
the first is the next question button and the second is the questions attributes.
Like I said above, use a Display Text behavior (or several) to watch the value of your attribute(s). That way you know why a certain rule is not triggering when you think it should.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User