GameSalad

Howdy, Stranger!

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

Memory Match Template

patricia.bradypatricia.brady Posts: 41Member, PRO

Hello,

Grateful for some assistance with the Memory Match Template.

I'd like separate scenes to deal 16, 24 & 36 cards:

  1. I added a "number of cards" attribute to the actor in each scene and changed to 16, 24 & 36 accordingly.
  2. In "Round rules" I changed ("game.number of cards" "16") to ("game.number of cards""self.number of cards")
  3. Only scene 1, 16 cards, deals properly...the others do not deal.

Is there a simple fix?
Really appreciate your assistance...I've tried multiple fixes to no avail.

Thank you

Patricia

Comments

  • tatiangtatiang Posts: 11,716Member, Sous Chef, PRO, Senior Sous-Chef
    edited November 2018

    Are you referring to this template?

    https://gshelper.com/product/memory-match-template-v2/

    It's helpful to include a link to the template you're using. Otherwise we have to guess as there are hundreds of templates at this point.

    If so, there is a link to a video tutorial provided in the download:

    Have you already watched that video?

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    Thank you Tatiang, I've resolved the issue.

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    Hello,

    When the cards deal for the first time one is missing!
    When I re-deal all cards are dealt.

    Any ideas what's going wrong?

    Appreciate your help.

    Thank you,

    Patricia

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

    /merged threads

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

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

    It's hard to know the answer without seeing your rules. Normally, I'd advise against posting a modified template but since this one is free I think it's probably fine.

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    I have a scene with menu buttons and the following code:

    [Actor receives an event] [touch] [pressed]
    Change Scene [level 1]
    Change Attribute [game.how many cards] to [16]

    The first time this is pressed only 15 cards are dealt on level 1.
    Subsequently, 16 if I press the [back to menu] and hit the actor again. If I switch to another level e.g., Level 2 and back to menu scene again...the pattern repeats itself, 15 cards the first time and 16 the second etc. It does also sometimes deal 24 or 36 in level one!

    I've tried umpteen million solutions to no avail...well as much as a beginner can do...anyone out there with experience using Tshitbooth's Memory Match template?

    Your help would be much appreciated.

    Thank you

    Patricia

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    I also wanted to ask if it's better to use triggers other than timers to get rules to run in order?

    Thank you!!

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

    Without seeing the project file itself or MANY of the card dealing rules, it's not going to be possible to diagnose the problem.

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    Dear Tatiang,

    How do I send this to you?

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

    You can upload your project file to a file-sharing site (e.g. Dropbox, etc.) and then post the download link here.

    If you'd like you can PM the link to me but it's generally better to post it here unless you're keeping the contents private. I can't promise to help so probably best to let more eyes see it if you can.

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    I have selected random 12 cards from a table using TableCellValue, if the number [self. blank or image] is <7 the card flips but there is no image, if [self. blank or image]>6 an image is shown. I'd like to then select at random one of the 1-6 cards where an image is shown.

    I've tried variations on:

    Change Attribute [self.setimage] to [self. blank or image], random,(1,6).
    But no image shows at all.

    Grateful for your help.

    Patricia

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

    If you're trying to change self.Image to one of six images randomly, you'll need to:

    1. Name your images sequentially, for example card1.png, card2.png, card3.png, card4.png, card5.png, card6.png.
    2. Change Attribute self.Image to "card"..random(1,6)

    That's two periods (..) between "card" and random(1,6) in the expression editor.

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    ...my images are named 1,2,3,4 through to 12. I have selected two groups of six cards randomly using TableCellValue. I'd then like to randomly select one card from one of these groups of six.

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

    It's hard to tell what's going on from your comments. I suggested you post a link to your project file but if that's not something you prefer to do, at least a screenshot or two of your rules. Otherwise it's just major guessing on anyone's part because we have no idea how you've set things up.

    What's an example of an exact image filename you're using? 1.png? 1.jpg?

    What happens when you add a new actor to the scene with only one rule (below)?

    Change Attribute self.Image to 3

    Does that change the actor's image?

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

  • patricia.bradypatricia.brady Posts: 41Member, PRO

    Yes if I change self.image to 3 it changes the actors image....but I've set up a separate integer in the actors which randomly numbers from 1-12 and selects 6 images at random, I'd like the self.image to then randomly select just one image from the 1-6 selection.

    So something like:
    Change Attribute [self.image] to [integerAttribute]random,(1,6)

    Is this possible?

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

    I don't understand what this all means:

    but I've set up a separate integer in the actors which randomly numbers from 1-12 and selects 6 images at random

    I have no idea what those rules look like. Sorry.

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

  • JB makin' a gameJB makin' a game Posts: 35Member, BASIC
    edited December 2018

    I think I get what you mean and picking 6 random numbers out of 12 and then 1 out of those 6 is possible for sure, but not in the way you mentioned.

    In this case, I'd use a table (let's name it Table Image Names) in which you have 12 rows and a text column and then create another table with identical content and name it [Copy] Table Image Names. See for yourself if you need to add more columns, but stick with the number of rows being as much as the number of images you have.
    In the 12 rows (which could be any number you like with just slight adjustments in your logic) you put the image names. For the sake of keeping things simple, I'd put 1 in row 1, but that's up to you, it doesn't really matter.
    Make an index attr: randomRow1-6, then make an index attr. called Table.rowCount (or whatever) and a text attr. imageName
    Change Attr: set Table.rowCount to tableRowCount(Table Image Names)
    Start a loop that remains valid, if Table.rowCount >= 7
    In the loop, Remove one row from Table Image Names at index: random(1, tableRowCount(Table Image Names)
    Change Attr: set Table.rowCount to Table.rowCount -1 (or to the function tableRowCount(Table Image Names), that should have the same result.

    This should leave 6 rows (and remove the other 6 rows) from your table and leave Table.rowCount at a value of 6.
    Add a rule that if Table.rowCount = 6
    set index attr randomRow1-6 to random(1, tableRowCount(Table Image Names))
    You now have your one row selected out of the random 6 row that were left over.
    Now Change text attr: set imageName to tableCellValue(Table Image Names, randomRow1-6, 1). randomRow1-6 is the index attr. and 1 is column 1.
    Last but certainly not least: Copy Table: [Copy] Table Image Names to Table Image Names and Save Table Image Names.
    When this is done, your table is back to the original with 12 rows. Change attr:
    set self.image to tekst-attr. imageName and it takes the picture as its image.

    Wrote this quite quickly, so might've forgotten something, but I think not. Good luck!
    By the way, the way I described it is probably not the easiest way to do it. You can do it with just a few rules and attributes, I guess. However, when you use this construction, you take the value from the text column in your Table (which is "1", "2", etc. in your case), which means that you can use this way for every image you put into the table, no matter what the image name is, as long as you put the exact image name in the tables.
    Also, you don't need to remove the rows and copy the table back to its original. There are other ways without removing any of the rows, but right now I'm puzzling on a complicated construction myself that involves Adding/Removing Rows, so it was in my head anyway ;)

  • StoodeldStoodeld Posts: 7Member
    edited May 22

    ">

    Those complicated tasks :'(

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

    @Stoodeld Please stop spamming old threads.

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

Sign In or Register to comment.