Scoreboard - To Only Show Completed Questions?

I’m working on a word question game, and would like to set up a scene to see the scores of completed questions.
In a table I have the questions, scores, and a boolean that is true when the question is complete and false if not completed.
How can I show only the questions and scores for completed questions, while omitting the incomplete questions?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Copy the table. In the copied table, Loop over Table and Remove Row for any row where the boolean is false. Then display the copied table's contents.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    @tatiang said:
    Copy the table. In the copied table, Loop over Table and Remove Row for any row where the boolean is false. Then display the copied table's contents.

    Awesome, thank you!

    Here's a screenshot, did I set things up right? How do I display the table contents though?
    I tried using a 'display text' with the value being the table, but nothing shows up...

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2019

    Yep, those rules look correct.

    Displaying tables isn't a simple process. One method is to use the tableMergeValues() function. Oddly enough, I can't get the function to work in the demo I was making for you ("Invalid target row/col or range"). Sorry! But I've definitely used it many times before. It merges all values in a single row (or column) with a separator (e.g. a space, a bullet symbol, etc.) and can be entered into a Display Text behavior.

    For multiple rows, you'd either need multiple Display Text behaviors or a way to enter multiple expressions in a single Display Text behavior (I do this by adding ..."\n"... between expressions. The \n is a newline character that creates a new line of text.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    For some reason, the tableMergeValues() function didn't like the text cell value "When was the U.S. constitution written?" I removed that and the demo works. Be right back with that file...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    This only displays the first two rows of the table:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    And here's a better example that converts the whole table into a text string. There is likely a limit to how many rows you can do this with since it's storing all of the data in a single text attribute.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Here's one with ten rows that works. :)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    @tatiang said:
    Here's one with ten rows that works. :)

    Nice! I tried changing the boolean values to false but it still shows them... is there a way to omit the rows with 'false' booleans, or would those rows have to be removed?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You have to copy the table, remove the rows with false boolean values, and then display the rows from the copied table.

    Alternatively, you could Loop Over Table and have a rule condition that checks for a true boolean value and only appends/concatenates the row if it meets that condition.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    @tatiang said:
    You have to copy the table, remove the rows with false boolean values, and then display the rows from the copied table.

    Alternatively, you could Loop Over Table and have a rule condition that checks for a true boolean value and only appends/concatenates the row if it meets that condition.

    Got it. Now I've ran into a new problem though... my table is set up with the question in the first column - but the score is in the 4th. How can I skip columns 2 and 3?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2019

    @rainwaterstudios said:
    Got it. Now I've ran into a new problem though... my table is set up with the question in the first column - but the score is in the 4th. How can I skip columns 2 and 3?

    No idea! :(

    Sometimes, this kind of thing requires advanced planning in terms of formatting tables, etc. Going back and trying to get it to work with a format that isn't ideal can be really tricky.

    Could you export the table and shift the columns around in Excel/Google Sheets and then re-import it?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    @tatiang said:

    @rainwaterstudios said:
    Got it. Now I've ran into a new problem though... my table is set up with the question in the first column - but the score is in the 4th. How can I skip columns 2 and 3?

    No idea! :(

    Sometimes, this kind of thing requires advanced planning in terms of formatting tables, etc. Going back and trying to get it to work with a format that isn't ideal can be really tricky.

    Could you export the table and shift the columns around in Excel/Google Sheets and then re-import it?

    Figured it out - I just made a 2nd text attribute! So 1 text attribute gets the questions from column 1, and the 2nd text attribute gets the scores from column 4. A display text behavior for each, and it seems to be functioning how I need it to. Thanks for the help!

  • Two.ETwo.E Member Posts: 599

    This may not be helpful since @tatiang has been very informative.
    For quiz games, and for stat collecting in the way you sort of want.
    I would have a table called Stats and reset it to an empty Table (Copy over a blank table) each new game.

    Then for every question that is answered correctly, add in a row and fill in each column with the current question data. And any stats you want.

    This way, and if I am reading these responses correctly, you can have a "leaderboard" showing which questions were answered in order. Since I know your quiz game is selecting random questions, doing it the current way will just show a list in the order you have manually entered into the table, instead of the order the player has.

    Hope that provides some insight. I haven't tested as I don't use GS.

    Best,
    Two.E

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    @Two.E said:
    This may not be helpful since @tatiang has been very informative.
    For quiz games, and for stat collecting in the way you sort of want.
    I would have a table called Stats and reset it to an empty Table (Copy over a blank table) each new game.

    Then for every question that is answered correctly, add in a row and fill in each column with the current question data. And any stats you want.

    This way, and if I am reading these responses correctly, you can have a "leaderboard" showing which questions were answered in order. Since I know your quiz game is selecting random questions, doing it the current way will just show a list in the order you have manually entered into the table, instead of the order the player has.

    Hope that provides some insight. I haven't tested as I don't use GS.

    Best,
    Two.E

    Ooo, thanks for the input! Now I'm running into a new problem though... how do I make this table scrollable? Or would I have to separate the table into multiple scenes or actors?

Sign In or Register to comment.