Reseting Tables

Hello everyone,

I have a quiz app that I am creating and I have several tables related to different categories that the user can choose from. In my table I have the question (which is just a picture) and answers. I have it to where when they click the certain category it changes to the corresponding scene with that table list (starts random) and when they click an answer it either adds a score to correct or wrong scores, and changes the attribute to another random question (picture) within the table. I have a menu button on the page and when the user presses it, the scores will be returned to 0 (which was successfully done by changing attribute), but I am wanting the table to reset as well. However, if I go back to the category page and select the same category it starts where it left off (but the score attributes went back to 0). I also have it to where the row is removed after that question has been previewed.

I saw on one forum that someone suggested copying the table, but I am not sure what that entails. I do not want to reset the game. I also tried the reset scene, but that makes everything un-clickable and that doesn't reset attributes, either. I would really like either a further explanation on copying the tables, or if someone else has a different idea. I would like for when they went back to the menu and category scene (clicking the same category they've already done during same game play) to start back up random. So, whatever needs to be done I want it to be done within the menu button actor. Any input would be much appreciated!

Comments

  • pHghostpHghost London, UKMember Posts: 2,342

    Yes, you need to copy from a default table you set up. There is a behaviour for that. Google for a tutorial if necessary.

  • DarianTDarianT Member Posts: 8

    I am not seeing any videos on what exactly I am looking for. If I use a copy table behavior where do I put it? Within the menu button when it is pressed, or the category button to start the scene? Also, if my original table was 5x5 (for example) I would have to make another 5x5 table with this same data? I am just not understanding this behavior.

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

    I have a menu button on the page and when the user presses it, the scores will be returned to 0 (which was successfully done by changing attribute), but I am wanting the table to reset as well. However, if I go back to the category page and select the same category it starts where it left off (but the score attributes went back to 0).

    You wrote that you want the table to reset when the menu button is pressed but that you want the category to start where it left off. How can those both be true? If you reset the table, it won't start where it left off.

    Can you explain why you want the table to "reset"? What does that mean in the context of your game? By using the Copy Table behavior, you would be writing a copy of your existing master table to a blank table and then at some point repeating that process thereby restoring the blank table to the contents of the master table once more.

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

  • Two.ETwo.E Member Posts: 599
    edited August 2017

    I recently did this for a icon trivia project. You will need a table called "Data".
    And then a table for each category.

    When you click on a category, you will copy table 'Category 1" into the "Data" table.
    This is how you will reset it each time.

    If you want to record what row the player was on. Have a different attribute for each category that stores the row number. And have a Main Attribute called Row_Count. (If you want to reset, you would change the Row Count to a value of 1.)

    That way, if Category #1 is selected. You wold copy the Table_Category#1 into Table_Data.
    Then if you want the player to pick off from where they started, you would copy the attribute value form Category One attribute, to the Row Count.

    Edit:


    Attached is A quick demo. You could go even better with functions, but that might over complicate things at the moment.

    Best,
    Two.E

  • DarianTDarianT Member Posts: 8
    edited August 2017

    I am trying to preview your demo zip file, Two.E, but it is not wanting to download correctly and it will not create the project on my GS, it just stays blank. Thank you for your explanation on copying tables! I will try and see if I can manage to get something to work with no issues!

    My apologies tatiang, I did not mean to have the, "however," in my question which made it seem like I wanted both to happen, when I actually don't want it to be left where it was.

    ~~~~~~~~~~~~~~~~

    Edit:

    I created another table apart from my category tables, and attached the copy table behavior to the "category 1" button, but it still isn't restarting my table. I am not too sure if I am missing a step or anything, since I am still unsure about the entire behavior. I'm guessing the copy table behavior makes it where it takes the data from the first table and puts it in the second, but I still do not see how that is going to make my scene restart the original table since the logic I have on my category button is just of "category 1_table". Am I supposed to be adding/changing the logic to include the"data" table? Do I have to have a boolean attribute on my menu button, or am I supposed to have any additional logic to the menu button?

    I am terribly sorry if I am not making any sense, I am just not sure how to ask questions about something I am not understanding very well. I headed over to the cookbook to read up on copy table attribute, and that still did nothing to help me understand entirely.

  • Two.ETwo.E Member Posts: 599

    You might just need to rename the extension to .gameprojat
    As I am using Mac version.

    Best,

  • DarianTDarianT Member Posts: 8

    I got it to convert finally, however, when I try and open it in gamesalad it says that the object.xml is corrupt and I am not sure how to fix this. o.O

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

    The idea would be this:

    Put all of your category A data in a table called CategoryAMaster (or whatever you prefer). In your actor that allows the player to choose that category, Copy CategoryAMaster to CategoryAGameplay and use the CategoryAGameplay table in all of your rules for extracting or checking table data. The next time the player clicks the categoryA actor, the table will again be copied from the master to the gameplay table thereby resetting things.

    You're right about the Reset Scene behavior not resetting game attribute values. Likewise, copying a table will reset the table cell values but won't do anything with game attributes such as game.score, game.level, game.numberOfGuessesLeft, etc. You'll need to manually (i.e. Change Attribute) change all of those back to their original values.

    @Two.E's demo file worked fine on my Mac. Not sure why it's not working on your PC.

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

  • DarianTDarianT Member Posts: 8
    edited August 2017

    Thank you tatiang, I will try that right now! I am going to try opening Two.E's file on a mac later today and check it out!

    edit:

    It worked perfect on my example I work on before adding the logic to my actual quiz! Thank you so much!

Sign In or Register to comment.