GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Current row number (or index)

I've done a search of a row successfully. How do I now
know what the row number or index is?
Thanks

Comments

  • tatiangtatiang Posts: 11,414Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 12

    The tableSearch function returns the row (or column) number where the key was found.

    So you can use that function as an expression... anywhere. For example, in a Display Text behavior, a Change Attribute behavior, a Log Debugging Statement behavior, etc.

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

  • helpingtogrowhelpingtogrow Posts: 27Member, PRO

    HI
    I have set game.currentlabel to tablecellvalue(game.table1(tablesearch(game.table1),"0","col" , 2,1,tablerowcount(game.table1), exact",1)

    This has taken me to a cell that I want.
    Now I just need to know what the row number that cell is in.
    Thanks

  • tatiangtatiang Posts: 11,414Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 12

    Then you need to do an intermediate step to determine that. Because right now, you're feeding the result of a function to another function which effectively hides the value.

    Try this:

    Change Attribute game.foundInRow to tablesearch(game.table1,"0","col" , 2,1,tablerowcount(game.table1), exact")

    Change Attribute game.currentlabel to tablecellvalue(game.table1(game.foundInRow,1))

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

  • helpingtogrowhelpingtogrow Posts: 27Member, PRO

    Worked!
    Thanks so much for your time.

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

    I deleted your last comment because it wasn't related to this thread and because you had already posted it as a new thread.

    Please don't keep re-posting it here.

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

Sign In or Register to comment.