Merge Table Cell Values to form a text attribute - SOLVED

BalvamarBalvamar Member, PRO Posts: 117
edited June 2015 in Working with GS (Mac)

I am working on a card game project.

I have 2 tables.

When the player clicks a card it saves the value of that card to row 1 col 1 table 1. Through behaviours that value would be (A,K,Q,J,T,9,etc).

When the player clicks another card it saves the value to row 1 col 2 table 1.

It then determines whether the 2 cards are a pair (P), suited (S), or off suit (O).

So if the player picked Ace Diamonds, and Ace Hearts the table would be AAP.

I can merge this correctly and have it display onscreen.....however

I then want to take that merged cell value (AAP) and search the second table (table2, a single column table) and tell me which row contains the matching text value (AAP).

I have tried a number of ways to use this value but it only ever shows me the first item (A).

I want all the items in table 1 to concatenate and become 1 text attribute I can then search another table with.

If anyone can suggest a method I would much appreciate it.

Cheers ;)

If I enter an integer into the "text" cell of the table does the integer then get recognised as "2" rather than the integer 2? Perhaps this is the problem. ??

Comments

  • BalvamarBalvamar Member, PRO Posts: 117
    edited June 2015

    I think I fixed it, will post as solved after i test it a bit more

    Solved....quite an expression, but it works!

    "CardText:".. tableMergeValues( game.TB_MYHAND ,"row",1,1,tableColCount( game.TB_MYHAND ),"").."\n"..tableSearch( game.TB_P&S ,tableMergeValues( game.TB_MYHAND ,"row",1,1,tableColCount( game.TB_MYHAND ),""),"col",1,1,tableRowCount( game.TB_P&S ),"exact")

Sign In or Register to comment.