Disable a row after it has been selected

HackimHackim Member Posts: 2
edited May 2013 in Working with GS (Mac)
Hello and sorry for my english

There is my problem :

I make a game where a row is randomly selected in the table.
Each time an action is performed, the game randomly selects another row.
The problem is that sometimes the same line's selected several times.

I wish that each line can be selected only one time in the game.

Do you think this is possible?

Comments

  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    Make a boolean column in the table and when it is selected, turn it to true. Then say is it is selected and the boolean is already true then pick another one. :) Get what I'm saying?
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @uptimistik Well, thats another way of doing it. :) You always seem to have a better answer than I do. :P
  • HackimHackim Member Posts: 2
    Thank you for your advice

    I try to follow your advice but I have not yet succeeded.
    I made the boolean column, but what functions do you use to do this "and when it is selected, turn it to true" and this "is it is selected and the boolean is already true then pick another one." ?

    I m a beginner :\">
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @Hackim Okay, so boolean made. Ok so when the column is selected do change attribute tablecellvalue(game.(table name),(row selected),(column where boolean row is)) to true. Then if tablecellvalue(game.(table name),(row selected),(column where boolean row is)) is true then repeat your already made actions. :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This can be accomplished by first copying the "master" table to a new table and then each time you pick a random row, deleting the row. When you reset the game, just copy the master table over again.

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

  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    edited May 2013
    @tatiang Wouldn't that cause some memory spikes and lag? :/
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @tatiang Wouldn't that cause some memory spikes and lag? :/
    Doubt it. I think sometimes people are too concerned about lag. If you're spawning 50 actors at once or constraining 10 different attributes on an actor then you should definitely be worried about lag, but just copying a table once and then deleting a row once per selection is not going to have a negative effect on your game.

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

  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @tatiang Okay then. :) Just making sure.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2013
    Another way would be to randomize the table in place (see http://forums.gamesalad.com/discussion/53553/demo-randomize-table-rows) and then increase the chosen row number until there are no rows left. This is actually how I do quiz apps.

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

Sign In or Register to comment.