Working with tables
egyptcapri
Member Posts: 17
Hello all, great resource here and it has helped immensely while i have been building my quiz app.
My question is this, if i have a master list say with 100 questions and answers and i would like to randomly copy ten rows into a new table so each time the user plays they get 10 that with the random shuffle should mean not much repeats unless they play the same level over and over?
Comments
Here's the algorithm I would use:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
not sure i understand step 5
think i get most of this actually trying to incorporate it at the moment.
Step 5 is the least intuitive but the reason for it is that if you add a row to an empty table then you end up with a table that looks like this:
[blank]
question1 answer1
question2 answer2
...
So instead if the first row is empty, just change the value of the cells (step 6). Once you've added data to the first row, you'll always thereafter want to add a row first so that there's somewhere to add new data.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
ok cool for that explanation.
working on my code so will let you know how it works out.
ok sorry but after starting to work on this i totally blanked and now am lost as to how to implement this.
Sorry to hear that! Is there a question you have about a particular step?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
how do i go about doing step 5 im sorry ive been looking at your post and as im learning the software and also programming im drawing a blank. Thanks again
When text expression tableCellValue(tableName,1,1) is not [blank]
Add row to end of table
Change Table Value [row: tableRowCount(tableName)]
The first time through, it will just change the value of the first row but thereafter, it will add a row and then change the value within that row.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User