How can I build a block that randomly select data from googlesheet to my game block

one more thanks to u for ur teaching.
I am now copying ur solution of block to my block, but I am not familiar with app inventor, therefore I don't know how to write some of the step(I have attach it under my response).

also, I want to know where should I put this 2 procedures into my block that can make my app run.
thx a lot.
cardflipping_UFO_test_ABG_2 (1).aia (301.2 KB)


For information on how to use procedure parameters, please read
http://www.appinventor.org/bookChapters/chapter21.pdf
from the free book in

I imagine you would call this procedure from your newgame procedure ...


but I see you blanking out the text in your buttons there, so I may have a different idea from yours as to when the text should appear in the buttons.

I imagined from your question that the game play involved having the buttons show words, and asking the player to click two buttons showing words that are synonyms to each other, then if they match as synonyms, blank them out.

By the way, global variables should have specific names telling what they hold, like student_names_list, my_teachers_list, etc.

they will not know the button repersent what card before they press the button.
only they press the button, the card will flip.
when they match the first pair, then win.
they don't need to match up all six pairs of cards.
and do u block aforementioned are the same direction with my idea?
thx a lot for ur help!!!

In that case, do not use my assign procedure to fill the button texts from the word list.

Instead, add these blocks ...
(Do not try to retype them, you can drag them directly).

This new global variable has the 12 words, but shuffled to make the game interesting. It is matched against your buttons list by index (1-12).

This was my old global variable with 12 words, before the shuffle. Keep it for debugging.

This is where the global word lists should be loaded at start up. Copy the last 2 lines into your new game procedure for fresh words.

This value procedure will return true if the 2 words you give it are synonyms of each other (they match). Feed it the select items from global shuffled words list using the indices of the last 2 buttons clicked. You would use this in a test in the common button checking procedure.

I can't comment on your global variable "list" because the name means nothing to me.
You can rename global variables in their init global blocks, and Ai2 will adjust the other blocks to fit.

just checked the blocks and seems I didnt use it at all, Sorry about the messy structure, i just so confused that how to assign different words and synonyms to 12 buttons and match them in pairs.

would u mind to help me look of what my block lacking in so that can it run? thx a lot.
I have change a lot but still cannot run.

cardflipping_UFO_test_ABG_2-3.aia (302.3 KB)

there are some global variables are useless, cause I change some blocks and also delete and add some blocks, so can u help me to delete those useless blocks.
thx a lot!!!

halo. do u free now?
sorry for disrupting u, but I need to hand it in 23 hrs later.

this is my prj and there are less than 24 hours til deadline! therefore I need some help for my app! thx a lot for click in this topic!

my app is a card flipping game.(matching the word and synonyms)
this game need to take data from google sheet and randomly select 6 pairs for game.
(this block is written)
but now we don't know how to distribute those 12 selected words to 12 buttons.

maybe my explanation is too messy. u will be clear after read the block.
thx a lot for help!
cardflipping_UFO_test_ABG_2-2.aia (302.3 KB)

Do you mean this procedure?

If so, you should change select list item list from word_list to button_list

I am looking at your app and your description of the game play,
and I don't see why you have 6 letter images in your Media folder, and why you keep lists
of them.

I am guessing you started your app from a copy of another Match game app that was intended to match based on image files, and that showed the images on the buttons without words.

When would you show one of those fancy letter images?

I don't see how they would fit into the game play.

I got the word matching and basic game play working.
I did not touch your extra useless images.
Here are the pieces ...
cardflipping_UFO_test_ABG_2_3.aia (299.6 KB)

And here is a cleaned up copy of the app without those 6 unused images...
cardflipping_UFO_test_ABG_2_3.aia (283.7 KB)

P.S. Your 12 button Click events collapse into a single When Any Button Click event.