I have been helping my 14 year old son create a quiz app as a school project. We watched the youtube video on the quiz blocks dozens of times and have figured out most of the basic functions in Thunkable X. What we are having problems figuring out is the APP Score. We cant seen to get it to keep track of the score. It will show 0/7 but will not count correct answers. I have attached a pic of our blocks and app screen and would appreciate any and all assistance.
The blocks are too small to read. Appreciate if you can share the link to your project so someone can review and hopefully advise how to solve the issue.
This is a great starting project! Although not a terribly easy one.
Your blocks look correct to me but I can’t really tell without seeing the database values. As @muneer suggested, it’s best to share the project link if you’re able.
Set the change of Score as the first block in the function. These blocks work asynchronously and therefore the after answer function will run and will not wait for the correct answer function to finish.
Thanks for the quick advice. I have tried it as you suggested and I still get no change on the score. I have even deleted the variable, recreated and tried in the incorrect answer function all with no success. Banging my had on the desk but still enjoying ever minute working with my son.
Without knowing what your actual data looks like, it’s hard to troubleshoot your blocks.
You can try adding a Vibrate block (from the Devices drawer) to one or more places in your code to determine if the code is firing or not when you test the project on a device. Or in a browser, you can make a change to a label’s value to also determine this.
Tonight I tried and created my own local db table and entered my data but still I can’t get it to count correct answers. I can move it around to different functions and it works with some but not all. I am greatly in need of assistance.
I don’t understand why you’re comparing the number 1 to a database value. Shouldn’t you compare the value of A’s button text to that database value? And only to the “answer column” value… which by the way should be the actual answer, not the index/position of the answer. And then the column names are integers which adds to the confusion, at least for me! Let me see if I can craft a simpler way to do this…
The conditions are not just confusing but unachievable. See this example for first question
I added a Yes/No message to make it easier for me. The correct answer for Q1 is button A, but the condition can never be valid because the saved value under column 1 is actually 2 but the condition is expecting 1 so the score variable will never increment resulting on displaying 0 at the results screen.
I am still trying to wrap my head around what you did but it’s amazing. I have only been using Thunkable for around 2 weeks and have learned a lot but what you did is going to take some time to sink in. I can not thank everyone in the community enough for their help.
I have a side question to ask and I can post a separate question if you would like so everyone can see. My local DB will eventually have around 100 questions. If I wanted to say do a short quiz of 15 or 20 random questions. Would that be done by modifying the “initialize app variable question” block. I see the "random integer from 1 to 100 " block but not sure how to limit it to say 15 questions.
This will get (and display, for testing purposes) 15 random row numbers from the local database. You can then use the generated list to select questions from the original database.